mirror of
https://github.com/aljazceru/notedeck.git
synced 2026-01-06 18:04:20 +01:00
fix note content rects
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -119,6 +119,7 @@ pub fn render_note_preview(
|
||||
.note_previews(false)
|
||||
.options_button(true)
|
||||
.parent(parent)
|
||||
.is_preview(true)
|
||||
.show(ui)
|
||||
})
|
||||
.inner
|
||||
@@ -145,6 +146,11 @@ fn render_note_contents(
|
||||
let hide_media = options.has_hide_media();
|
||||
let link_color = ui.visuals().hyperlink_color;
|
||||
|
||||
if !options.has_is_preview() {
|
||||
// need this for the rect to take the full width of the column
|
||||
let _ = ui.allocate_at_least(egui::vec2(ui.available_width(), 0.0), egui::Sense::click());
|
||||
}
|
||||
|
||||
let response = ui.horizontal_wrapped(|ui| {
|
||||
let blocks = if let Ok(blocks) = ndb.get_blocks_by_key(txn, note_key) {
|
||||
blocks
|
||||
|
||||
@@ -145,6 +145,11 @@ impl<'a> NoteView<'a> {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn is_preview(mut self, is_preview: bool) -> Self {
|
||||
self.options_mut().set_is_preview(is_preview);
|
||||
self
|
||||
}
|
||||
|
||||
fn textmode_ui(&mut self, ui: &mut egui::Ui) -> egui::Response {
|
||||
let note_key = self.note.key().expect("todo: implement non-db notes");
|
||||
let txn = self.note.txn().expect("todo: implement non-db notes");
|
||||
|
||||
@@ -18,6 +18,9 @@ bitflags! {
|
||||
|
||||
/// Scramble text so that its not distracting during development
|
||||
const scramble_text = 0b0000001000000000;
|
||||
|
||||
/// Whether the current note is a preview
|
||||
const is_preview = 0b0000010000000000;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +59,7 @@ impl NoteOptions {
|
||||
create_bit_methods!(set_options_button, has_options_button, options_button);
|
||||
create_bit_methods!(set_hide_media, has_hide_media, hide_media);
|
||||
create_bit_methods!(set_scramble_text, has_scramble_text, scramble_text);
|
||||
create_bit_methods!(set_is_preview, has_is_preview, is_preview);
|
||||
|
||||
pub fn new(is_universe_timeline: bool) -> Self {
|
||||
let mut options = NoteOptions::default();
|
||||
|
||||
@@ -48,6 +48,7 @@ pub fn reply_desc(
|
||||
ui::NoteView::new(ndb, note_cache, img_cache, note, note_options)
|
||||
.actionbar(false)
|
||||
.wide(true)
|
||||
.is_preview(true)
|
||||
.show(ui);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user