From 66d37cb2345fe7650da49bc28ba6f4b64e8822d4 Mon Sep 17 00:00:00 2001 From: Jonathan Johnson Date: Thu, 28 Nov 2024 09:03:50 -0800 Subject: [PATCH] Added context to DynamicDisplay::generation --- src/widgets/label.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/widgets/label.rs b/src/widgets/label.rs index c6d97df02..ae70b3517 100644 --- a/src/widgets/label.rs +++ b/src/widgets/label.rs @@ -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) { @@ -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( @@ -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 { + #[allow(unused_variables)] + fn generation(&self, context: &WidgetContext<'_>) -> Option { None }