diff --git a/crates/ui-patterns/src/patterns/form_dialogs/sizing/canvas.rs b/crates/ui-patterns/src/patterns/form_dialogs/sizing/canvas.rs index 1b60d169d..7147061d8 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/sizing/canvas.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/sizing/canvas.rs @@ -238,10 +238,13 @@ pub struct HostedCanvasSize { } impl HostedCanvasSize { + /// The dialog's key: its [`DialogId`] is `dialog_id(KEY)`, so an app finds the open dialog by it. + pub const KEY: &'static str = "sizing.canvasSize"; + /// A dialog opening with `values`; `build` makes it over the values (`CanvasSize::new` with its settings). pub fn new(values: CanvasSizeValues, build: impl for<'b> Fn(Bind<'b, CanvasSizeValues>) -> CanvasSize<'b> + Send + 'static) -> Self { HostedCanvasSize { - id: dialog_id(KEY), + id: dialog_id(Self::KEY), open: true, values, build: Box::new(build), @@ -256,9 +259,6 @@ impl HostedCanvasSize { } } -/// The key of the hosted dialog. -const KEY: &str = "sizing.canvasSize"; - impl StackDialog for HostedCanvasSize { type Result = CanvasSizeResult; @@ -317,7 +317,7 @@ impl StackDialog for HostedCanvasSize { } fn key(&self) -> Option<&str> { - Some(KEY) + Some(Self::KEY) } #[cfg(feature = "testing")] diff --git a/crates/ui-patterns/src/patterns/form_dialogs/sizing/image.rs b/crates/ui-patterns/src/patterns/form_dialogs/sizing/image.rs index d9b309909..458dd3a86 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/sizing/image.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/sizing/image.rs @@ -243,10 +243,13 @@ pub struct HostedImageSize { } impl HostedImageSize { + /// The dialog's key: its [`DialogId`] is `dialog_id(KEY)`, so an app finds the open dialog by it. + pub const KEY: &'static str = "sizing.imageSize"; + /// A dialog opening with `values`; `build` makes it over the values (`ImageSize::new` with its settings). pub fn new(values: ImageSizeValues, build: impl for<'b> Fn(Bind<'b, ImageSizeValues>) -> ImageSize<'b> + Send + 'static) -> Self { HostedImageSize { - id: dialog_id(KEY), + id: dialog_id(Self::KEY), open: true, values, build: Box::new(build), @@ -261,9 +264,6 @@ impl HostedImageSize { } } -/// The key of the hosted dialog. -const KEY: &str = "sizing.imageSize"; - impl StackDialog for HostedImageSize { type Result = ImageSizeResult; @@ -347,7 +347,7 @@ impl StackDialog for HostedImageSize { } fn key(&self) -> Option<&str> { - Some(KEY) + Some(Self::KEY) } #[cfg(feature = "testing")]