Hue/Saturation: AdjustedFn borrows for the editor's lifetime; swatch trials drop an unused import

This commit is contained in:
aiongg
2026-11-23 02:35:34 +00:00
parent 25c3f64902
commit 5ddae9f82d
2 changed files with 4 additions and 4 deletions
@@ -275,7 +275,7 @@ impl std::ops::Deref for HueSaturationOutput {
}
/// What a colour of the image becomes under a Hue/Saturation value; see [`HueSaturationEditor::adjusted`].
pub type AdjustedFn = dyn Fn(&HueSaturation, Srgba) -> Srgba;
pub type AdjustedFn<'a> = dyn Fn(&HueSaturation, Srgba) -> Srgba + 'a;
/// Hue/Saturation.
///
@@ -303,7 +303,7 @@ pub type AdjustedFn = dyn Fn(&HueSaturation, Srgba) -> Srgba;
pub struct HueSaturationEditor<'a> {
label: Label,
value: Bind<'a, HueSaturation>,
adjusted: Option<&'a AdjustedFn>,
adjusted: Option<&'a AdjustedFn<'a>>,
range: Option<Option<usize>>,
context: AdjustContext,
}
@@ -317,7 +317,7 @@ impl<'a> HueSaturationEditor<'a> {
/// What a colour of the image becomes under a value: the host runs its engine. The lower spectrum bar asks for 37
/// full hues under the shown value, each edited range's swatch for its centre colour under a value holding only
/// that range, and Colorize's swatch for a mid grey under the shown value. Without it every colour stays as it is.
pub fn adjusted(mut self, adjusted: &'a AdjustedFn) -> Self {
pub fn adjusted(mut self, adjusted: &'a AdjustedFn<'a>) -> Self {
self.adjusted = Some(adjusted);
self
}
+1 -1
View File
@@ -2,7 +2,7 @@
use craft_theme::Srgba;
use craft_ui::choice::{RadioGroup, Swatch, SwatchShape};
use craft_ui::contract::{Bind, Props as _, Show as _, ShowContainer as _};
use craft_ui::contract::{Bind, Show as _, ShowContainer as _};
use craft_ui::layout_components::Row;
use craft_ui::testing::{Fixture, trial};
use egui::{Key, Modifiers, Shape, vec2};