Skip to content

Commit

Permalink
Added context to DynamicDisplay::generation
Browse files Browse the repository at this point in the history
  • Loading branch information
ecton committed Nov 28, 2024
1 parent 25585a2 commit 66d37cb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/widgets/label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ where
width = Px::MAX;
}
let check_generation = self.display.generation();
let check_display_generation = self.display.map(DynamicDisplay::generation);
let check_display_generation = self.display.map(|display| display.generation(context));
context.apply_current_font_settings();
let current_families = context.current_family_list();
match self.prepared_text.get(context) {
Expand All @@ -97,7 +97,7 @@ where
context
.gfx
.measure_text(Text::new(&self.displayed, color).align(align, width)),
text.generation(),
text.generation(context),
)
});
self.prepared_text.set(
Expand Down Expand Up @@ -237,7 +237,8 @@ pub trait DynamicDisplay {
///
/// To ensure the contents are recached by a [`Label`] widget, return a
/// unique value from this function each time the contents are updated.
fn generation(&self) -> Option<Generation> {
#[allow(unused_variables)]
fn generation(&self, context: &WidgetContext<'_>) -> Option<Generation> {
None
}

Expand Down

0 comments on commit 66d37cb

Please sign in to comment.