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)
|
.note_previews(false)
|
||||||
.options_button(true)
|
.options_button(true)
|
||||||
.parent(parent)
|
.parent(parent)
|
||||||
|
.is_preview(true)
|
||||||
.show(ui)
|
.show(ui)
|
||||||
})
|
})
|
||||||
.inner
|
.inner
|
||||||
@@ -145,6 +146,11 @@ fn render_note_contents(
|
|||||||
let hide_media = options.has_hide_media();
|
let hide_media = options.has_hide_media();
|
||||||
let link_color = ui.visuals().hyperlink_color;
|
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 response = ui.horizontal_wrapped(|ui| {
|
||||||
let blocks = if let Ok(blocks) = ndb.get_blocks_by_key(txn, note_key) {
|
let blocks = if let Ok(blocks) = ndb.get_blocks_by_key(txn, note_key) {
|
||||||
blocks
|
blocks
|
||||||
|
|||||||
@@ -145,6 +145,11 @@ impl<'a> NoteView<'a> {
|
|||||||
self
|
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 {
|
fn textmode_ui(&mut self, ui: &mut egui::Ui) -> egui::Response {
|
||||||
let note_key = self.note.key().expect("todo: implement non-db notes");
|
let note_key = self.note.key().expect("todo: implement non-db notes");
|
||||||
let txn = self.note.txn().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
|
/// Scramble text so that its not distracting during development
|
||||||
const scramble_text = 0b0000001000000000;
|
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_options_button, has_options_button, options_button);
|
||||||
create_bit_methods!(set_hide_media, has_hide_media, hide_media);
|
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_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 {
|
pub fn new(is_universe_timeline: bool) -> Self {
|
||||||
let mut options = NoteOptions::default();
|
let mut options = NoteOptions::default();
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ pub fn reply_desc(
|
|||||||
ui::NoteView::new(ndb, note_cache, img_cache, note, note_options)
|
ui::NoteView::new(ndb, note_cache, img_cache, note, note_options)
|
||||||
.actionbar(false)
|
.actionbar(false)
|
||||||
.wide(true)
|
.wide(true)
|
||||||
|
.is_preview(true)
|
||||||
.show(ui);
|
.show(ui);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user