mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 02:09:00 +00:00
Hue/Saturation: AdjustedFn borrows for the editor's lifetime; swatch trials drop an unused import
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user