From 63217feac6c47825ca44f63b6d060ed4edb34dcf Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Tue, 23 Dec 2025 21:23:13 -0800 Subject: [PATCH] Organize the categories of widget component props --- .../export_dialog_message_handler.rs | 16 +- .../new_document_dialog_message_handler.rs | 14 +- .../preferences_dialog_message_handler.rs | 44 +-- .../licenses_third_party_dialog.rs | 4 +- .../utility_types/widgets/button_widgets.rs | 114 +++---- .../utility_types/widgets/input_widgets.rs | 271 +++++++--------- .../utility_types/widgets/label_widgets.rs | 78 +++-- .../data_panel/data_panel_message_handler.rs | 4 +- .../document/document_message_handler.rs | 22 +- .../node_graph/document_node_definitions.rs | 6 +- .../node_graph/node_graph_message_handler.rs | 34 +- .../document/node_graph/node_properties.rs | 102 +++--- .../document/overlays/grid_overlays.rs | 20 +- .../common_functionality/color_selector.rs | 8 +- .../tool/common_functionality/pivot.rs | 2 +- .../messages/tool/tool_messages/brush_tool.rs | 12 +- .../tool/tool_messages/freehand_tool.rs | 4 +- .../messages/tool/tool_messages/path_tool.rs | 4 +- .../messages/tool/tool_messages/pen_tool.rs | 6 +- .../tool/tool_messages/select_tool.rs | 14 +- .../messages/tool/tool_messages/shape_tool.rs | 16 +- .../tool/tool_messages/spline_tool.rs | 4 +- .../messages/tool/tool_messages/text_tool.rs | 10 +- editor/src/messages/tool/utility_types.rs | 6 +- .../floating-menus/ColorPicker.svelte | 20 +- .../components/floating-menus/MenuList.svelte | 2 +- .../floating-menus/NodeCatalog.svelte | 2 + .../src/components/panels/Document.svelte | 2 +- .../src/components/widgets/WidgetSpan.svelte | 5 +- .../buttons/BreadcrumbTrailButtons.svelte | 2 + .../widgets/buttons/IconButton.svelte | 11 +- .../widgets/buttons/ImageButton.svelte | 2 + .../buttons/ParameterExposeButton.svelte | 2 + .../widgets/buttons/PopoverButton.svelte | 18 +- .../widgets/buttons/TextButton.svelte | 17 +- .../widgets/inputs/CheckboxInput.svelte | 9 +- .../widgets/inputs/ColorInput.svelte | 13 +- .../widgets/inputs/CurveInput.svelte | 13 +- .../widgets/inputs/DropdownInput.svelte | 16 +- .../widgets/inputs/NumberInput.svelte | 60 ++-- .../widgets/inputs/RadioInput.svelte | 10 +- .../widgets/inputs/ReferencePointInput.svelte | 2 + .../widgets/inputs/TextInput.svelte | 23 +- .../widgets/inputs/WorkingColorsInput.svelte | 1 + .../widgets/labels/IconLabel.svelte | 6 +- .../widgets/labels/ImageLabel.svelte | 2 + .../widgets/labels/Separator.svelte | 9 +- .../widgets/labels/ShortcutLabel.svelte | 1 + .../widgets/labels/TextLabel.svelte | 15 +- frontend/src/messages.ts | 294 ++++++++---------- 50 files changed, 643 insertions(+), 729 deletions(-) diff --git a/editor/src/messages/dialog/export_dialog/export_dialog_message_handler.rs b/editor/src/messages/dialog/export_dialog/export_dialog_message_handler.rs index 32593b80c4..ec6edfe0fb 100644 --- a/editor/src/messages/dialog/export_dialog/export_dialog_message_handler.rs +++ b/editor/src/messages/dialog/export_dialog/export_dialog_message_handler.rs @@ -92,14 +92,14 @@ impl LayoutHolder for ExportDialogMessageHandler { .collect(); let export_type = vec![ - TextLabel::new("File Type").table_align(true).min_width("100px").widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + TextLabel::new("File Type").table_align(true).min_width(100).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), RadioInput::new(entries).selected_index(Some(self.file_type as u32)).widget_instance(), ]; let resolution = vec![ - TextLabel::new("Scale Factor").table_align(true).min_width("100px").widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + TextLabel::new("Scale Factor").table_align(true).min_width(100).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), NumberInput::new(Some(self.scale_factor)) .unit("") .min(0.) @@ -144,15 +144,15 @@ impl LayoutHolder for ExportDialogMessageHandler { } let export_area = vec![ - TextLabel::new("Bounds").table_align(true).min_width("100px").widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + TextLabel::new("Bounds").table_align(true).min_width(100).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), DropdownInput::new(entries).selected_index(Some(index as u32)).widget_instance(), ]; let checkbox_id = CheckboxId::new(); let transparent_background = vec![ - TextLabel::new("Transparency").table_align(true).min_width("100px").for_checkbox(checkbox_id).widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + TextLabel::new("Transparency").table_align(true).min_width(100).for_checkbox(checkbox_id).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), CheckboxInput::new(self.transparent_background) .disabled(self.file_type == FileType::Jpg) .on_update(move |value: &CheckboxInput| ExportDialogMessage::TransparentBackground { transparent: value.checked }.into()) diff --git a/editor/src/messages/dialog/new_document_dialog/new_document_dialog_message_handler.rs b/editor/src/messages/dialog/new_document_dialog/new_document_dialog_message_handler.rs index 9fae872331..1b9a3d5b0f 100644 --- a/editor/src/messages/dialog/new_document_dialog/new_document_dialog_message_handler.rs +++ b/editor/src/messages/dialog/new_document_dialog/new_document_dialog_message_handler.rs @@ -73,8 +73,8 @@ impl DialogLayoutHolder for NewDocumentDialogMessageHandler { impl LayoutHolder for NewDocumentDialogMessageHandler { fn layout(&self) -> Layout { let name = vec![ - TextLabel::new("Name").table_align(true).min_width("90px").widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + TextLabel::new("Name").table_align(true).min_width(90).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), TextInput::new(&self.name) .on_update(|text_input: &TextInput| NewDocumentDialogMessage::Name { name: text_input.value.clone() }.into()) .min_width(204) // Matches the 100px of both NumberInputs below + the 4px of the Unrelated-type separator @@ -83,8 +83,8 @@ impl LayoutHolder for NewDocumentDialogMessageHandler { let checkbox_id = CheckboxId::new(); let infinite = vec![ - TextLabel::new("Infinite Canvas").table_align(true).min_width("90px").for_checkbox(checkbox_id).widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + TextLabel::new("Infinite Canvas").table_align(true).min_width(90).for_checkbox(checkbox_id).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), CheckboxInput::new(self.infinite) .on_update(|checkbox_input: &CheckboxInput| NewDocumentDialogMessage::Infinite { infinite: checkbox_input.checked }.into()) .for_label(checkbox_id) @@ -92,8 +92,8 @@ impl LayoutHolder for NewDocumentDialogMessageHandler { ]; let scale = vec![ - TextLabel::new("Dimensions").table_align(true).min_width("90px").widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + TextLabel::new("Dimensions").table_align(true).min_width(90).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), NumberInput::new(Some(self.dimensions.x as f64)) .label("W") .unit(" px") @@ -104,7 +104,7 @@ impl LayoutHolder for NewDocumentDialogMessageHandler { .min_width(100) .on_update(|number_input: &NumberInput| NewDocumentDialogMessage::DimensionsX { width: number_input.value.unwrap() }.into()) .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), NumberInput::new(Some(self.dimensions.y as f64)) .label("H") .unit(" px") diff --git a/editor/src/messages/dialog/preferences_dialog/preferences_dialog_message_handler.rs b/editor/src/messages/dialog/preferences_dialog/preferences_dialog_message_handler.rs index c17f2c497c..1955986fc6 100644 --- a/editor/src/messages/dialog/preferences_dialog/preferences_dialog_message_handler.rs +++ b/editor/src/messages/dialog/preferences_dialog/preferences_dialog_message_handler.rs @@ -46,13 +46,13 @@ impl PreferencesDialogMessageHandler { let zoom_rate_description = "Adjust how fast zooming occurs when using the scroll wheel or pinch gesture (relative to a default of 50)."; let zoom_rate_label = vec![ - Separator::new(SeparatorType::Unrelated).widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), TextLabel::new("Zoom Rate").tooltip_label("Zoom Rate").tooltip_description(zoom_rate_description).widget_instance(), ]; let zoom_rate = vec![ - Separator::new(SeparatorType::Unrelated).widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), NumberInput::new(Some(map_zoom_rate_to_display(preferences.viewport_zoom_wheel_rate))) .tooltip_label("Zoom Rate") .tooltip_description(zoom_rate_description) @@ -74,8 +74,8 @@ impl PreferencesDialogMessageHandler { let checkbox_id = CheckboxId::new(); let zoom_with_scroll_description = "Use the scroll wheel for zooming instead of vertically panning (not recommended for trackpads)."; let zoom_with_scroll = vec![ - Separator::new(SeparatorType::Unrelated).widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), CheckboxInput::new(preferences.zoom_with_scroll) .tooltip_label("Zoom with Scroll") .tooltip_description(zoom_with_scroll_description) @@ -104,8 +104,8 @@ impl PreferencesDialogMessageHandler { let header = vec![TextLabel::new("Editing").italic(true).widget_instance()]; let selection_label = vec![ - Separator::new(SeparatorType::Unrelated).widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), TextLabel::new("Selection") .tooltip_label("Selection") .tooltip_description("Choose how targets are selected within dragged rectangular and lasso areas.") @@ -147,8 +147,8 @@ impl PreferencesDialogMessageHandler { .selected_index(Some(preferences.selection_mode as u32)) .widget_instance(); let selection_mode = vec![ - Separator::new(SeparatorType::Unrelated).widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), selection_mode, ]; @@ -164,13 +164,13 @@ impl PreferencesDialogMessageHandler { let scale_description = "Adjust the scale of the entire user interface (100% is default)."; let scale_label = vec![ - Separator::new(SeparatorType::Unrelated).widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), TextLabel::new("Scale").tooltip_label("Scale").tooltip_description(scale_description).widget_instance(), ]; let scale = vec![ - Separator::new(SeparatorType::Unrelated).widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), NumberInput::new(Some(ui_scale_to_display(preferences.ui_scale))) .tooltip_label("Scale") .tooltip_description(scale_description) @@ -204,8 +204,8 @@ impl PreferencesDialogMessageHandler { let node_graph_section_description = "Configure the appearance of the wires running between node connections in the graph."; let node_graph_wires_label = vec![ - Separator::new(SeparatorType::Unrelated).widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), TextLabel::new("Node Graph Wires") .tooltip_label("Node Graph Wires") .tooltip_description(node_graph_section_description) @@ -226,8 +226,8 @@ impl PreferencesDialogMessageHandler { .selected_index(Some(preferences.graph_wire_style as u32)) .widget_instance(); let graph_wire_style = vec![ - Separator::new(SeparatorType::Unrelated).widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), graph_wire_style, ]; @@ -239,8 +239,8 @@ impl PreferencesDialogMessageHandler { vello_description.push_str("\n\n(Your browser must support WebGPU.)"); let use_vello = vec![ - Separator::new(SeparatorType::Unrelated).widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), CheckboxInput::new(preferences.use_vello && preferences.supports_wgpu()) .tooltip_label("Vello Renderer") .tooltip_description(vello_description.clone()) @@ -266,8 +266,8 @@ impl PreferencesDialogMessageHandler { " .trim(); let brush_tool = vec![ - Separator::new(SeparatorType::Unrelated).widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), CheckboxInput::new(preferences.brush_tool) .tooltip_label("Brush Tool") .tooltip_description(brush_tool_description) diff --git a/editor/src/messages/dialog/simple_dialogs/licenses_third_party_dialog.rs b/editor/src/messages/dialog/simple_dialogs/licenses_third_party_dialog.rs index e891ed2051..1f161cf1b6 100644 --- a/editor/src/messages/dialog/simple_dialogs/licenses_third_party_dialog.rs +++ b/editor/src/messages/dialog/simple_dialogs/licenses_third_party_dialog.rs @@ -29,14 +29,14 @@ impl LayoutHolder for LicensesThirdPartyDialog { }; // Two characters (one before, one after) the sequence of underscore characters, plus one additional column to provide a space between the text and the scrollbar - let non_wrapping_column_width = license_text.split('\n').map(|line| line.chars().filter(|&c| c == '_').count()).max().unwrap_or(0) + 2 + 1; + let non_wrapping_column_width = license_text.split('\n').map(|line| line.chars().filter(|&c| c == '_').count() as u32).max().unwrap_or(0) + 2 + 1; Layout(vec![LayoutGroup::Row { widgets: vec![ TextLabel::new(license_text) .monospace(true) .multiline(true) - .min_width(format!("{non_wrapping_column_width}ch")) + .min_width_characters(non_wrapping_column_width) .widget_instance(), ], }]) diff --git a/editor/src/messages/layout/utility_types/widgets/button_widgets.rs b/editor/src/messages/layout/utility_types/widgets/button_widgets.rs index e1b48940f6..54a1e5ba1d 100644 --- a/editor/src/messages/layout/utility_types/widgets/button_widgets.rs +++ b/editor/src/messages/layout/utility_types/widgets/button_widgets.rs @@ -9,25 +9,23 @@ use graphite_proc_macros::WidgetBuilder; #[derive(Clone, Default, Derivative, serde::Serialize, serde::Deserialize, WidgetBuilder, specta::Type)] #[derivative(Debug, PartialEq)] pub struct IconButton { + // Content #[widget_builder(constructor)] pub icon: String, - #[serde(rename = "hoverIcon")] pub hover_icon: Option, - #[widget_builder(constructor)] pub size: u32, // TODO: Convert to an `IconSize` enum - pub disabled: bool, - pub active: bool, + // Styling + pub emphasized: bool, + // Tooltips #[serde(rename = "tooltipLabel")] pub tooltip_label: String, - #[serde(rename = "tooltipDescription")] pub tooltip_description: String, - #[serde(rename = "tooltipShortcut")] pub tooltip_shortcut: Option, @@ -35,7 +33,6 @@ pub struct IconButton { #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_update: WidgetCallback, - #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_commit: WidgetCallback<()>, @@ -44,29 +41,26 @@ pub struct IconButton { #[derive(Clone, serde::Serialize, serde::Deserialize, Derivative, WidgetBuilder, specta::Type)] #[derivative(Debug, PartialEq, Default)] pub struct PopoverButton { + // Content pub style: Option, + pub icon: Option, + pub disabled: bool, + // Children + #[serde(rename = "popoverLayout")] + pub popover_layout: Layout, + #[serde(rename = "popoverMinWidth")] + pub popover_min_width: Option, #[serde(rename = "menuDirection")] pub menu_direction: Option, - pub icon: Option, - - pub disabled: bool, - + // Tooltips #[serde(rename = "tooltipLabel")] pub tooltip_label: String, - #[serde(rename = "tooltipDescription")] pub tooltip_description: String, - #[serde(rename = "tooltipShortcut")] pub tooltip_shortcut: Option, - - #[serde(rename = "popoverLayout")] - pub popover_layout: Layout, - - #[serde(rename = "popoverMinWidth")] - pub popover_min_width: Option, } #[derive(Clone, Default, Debug, PartialEq, serde::Serialize, serde::Deserialize, specta::Type)] @@ -86,17 +80,16 @@ pub enum MenuDirection { #[derive(Clone, serde::Serialize, serde::Deserialize, Derivative, Default, WidgetBuilder, specta::Type)] #[derivative(Debug, PartialEq)] pub struct ParameterExposeButton { + // Content pub exposed: bool, - #[serde(rename = "dataType")] pub data_type: FrontendGraphDataType, + // Tooltips #[serde(rename = "tooltipLabel")] pub tooltip_label: String, - #[serde(rename = "tooltipDescription")] pub tooltip_description: String, - #[serde(rename = "tooltipShortcut")] pub tooltip_shortcut: Option, @@ -104,7 +97,6 @@ pub struct ParameterExposeButton { #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_update: WidgetCallback, - #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_commit: WidgetCallback<()>, @@ -113,46 +105,42 @@ pub struct ParameterExposeButton { #[derive(Clone, serde::Serialize, serde::Deserialize, Derivative, Default, WidgetBuilder, specta::Type)] #[derivative(Debug, PartialEq)] pub struct TextButton { + // Content #[widget_builder(constructor)] pub label: String, - pub icon: Option, - #[serde(rename = "hoverIcon")] pub hover_icon: Option, - - pub flush: bool, - - pub emphasized: bool, - - #[serde(rename = "minWidth")] - pub min_width: u32, - pub disabled: bool, - pub narrow: bool, - - #[serde(rename = "tooltipLabel")] - pub tooltip_label: String, - - #[serde(rename = "tooltipDescription")] - pub tooltip_description: String, - - #[serde(rename = "tooltipShortcut")] - pub tooltip_shortcut: Option, - + // Children #[serde(rename = "menuListChildren")] pub menu_list_children: MenuListEntrySections, - #[serde(rename = "menuListChildrenHash")] #[widget_builder(skip)] pub menu_list_children_hash: u64, + // Styling + pub emphasized: bool, + pub flush: bool, + pub narrow: bool, + + // Sizing + #[serde(rename = "minWidth")] + pub min_width: u32, + + // Tooltips + #[serde(rename = "tooltipLabel")] + pub tooltip_label: String, + #[serde(rename = "tooltipDescription")] + pub tooltip_description: String, + #[serde(rename = "tooltipShortcut")] + pub tooltip_shortcut: Option, + // Callbacks #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_update: WidgetCallback, - #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_commit: WidgetCallback<()>, @@ -161,19 +149,17 @@ pub struct TextButton { #[derive(Clone, serde::Serialize, serde::Deserialize, Derivative, Default, WidgetBuilder, specta::Type)] #[derivative(Debug, PartialEq)] pub struct ImageButton { + // Content #[widget_builder(constructor)] pub image: String, - pub width: Option, - pub height: Option, + // Tooltips #[serde(rename = "tooltipLabel")] pub tooltip_label: String, - #[serde(rename = "tooltipDescription")] pub tooltip_description: String, - #[serde(rename = "tooltipShortcut")] pub tooltip_shortcut: Option, @@ -181,7 +167,6 @@ pub struct ImageButton { #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_update: WidgetCallback<()>, - #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_commit: WidgetCallback<()>, @@ -190,32 +175,26 @@ pub struct ImageButton { #[derive(Clone, Derivative, serde::Serialize, serde::Deserialize, WidgetBuilder, specta::Type)] #[derivative(Debug, PartialEq, Default)] pub struct ColorInput { + // Content /// WARNING: The colors are gamma, not linear! #[widget_builder(constructor)] pub value: FillChoice, - - // TODO: Implement - // #[serde(rename = "allowTransparency")] - // #[derivative(Default(value = "false"))] - // pub allow_transparency: bool, - // #[serde(rename = "allowNone")] #[derivative(Default(value = "true"))] pub allow_none: bool, - - pub disabled: bool, - - pub narrow: bool, - + // #[serde(rename = "allowTransparency")] pub allow_transparency: bool, // TODO: Implement #[serde(rename = "menuDirection")] pub menu_direction: Option, + pub disabled: bool, + // Styling + pub narrow: bool, + + // Tooltips #[serde(rename = "tooltipLabel")] pub tooltip_label: String, - #[serde(rename = "tooltipDescription")] pub tooltip_description: String, - #[serde(rename = "tooltipShortcut")] pub tooltip_shortcut: Option, @@ -223,7 +202,6 @@ pub struct ColorInput { #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_update: WidgetCallback, - #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_commit: WidgetCallback<()>, @@ -232,17 +210,16 @@ pub struct ColorInput { #[derive(Clone, serde::Serialize, serde::Deserialize, Derivative, Default, WidgetBuilder, specta::Type)] #[derivative(Debug, PartialEq)] pub struct BreadcrumbTrailButtons { + // Content #[widget_builder(constructor)] pub labels: Vec, - pub disabled: bool, + // Tooltips #[serde(rename = "tooltipLabel")] pub tooltip_label: String, - #[serde(rename = "tooltipDescription")] pub tooltip_description: String, - #[serde(rename = "tooltipShortcut")] pub tooltip_shortcut: Option, @@ -250,7 +227,6 @@ pub struct BreadcrumbTrailButtons { #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_update: WidgetCallback, - #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_commit: WidgetCallback<()>, diff --git a/editor/src/messages/layout/utility_types/widgets/input_widgets.rs b/editor/src/messages/layout/utility_types/widgets/input_widgets.rs index 75ae5fafc3..59273cf88c 100644 --- a/editor/src/messages/layout/utility_types/widgets/input_widgets.rs +++ b/editor/src/messages/layout/utility_types/widgets/input_widgets.rs @@ -7,53 +7,34 @@ use graphene_std::transform::ReferencePoint; use graphite_proc_macros::WidgetBuilder; #[derive(Clone, Derivative, serde::Serialize, serde::Deserialize, WidgetBuilder, specta::Type)] -#[derivative(Debug, PartialEq)] +#[derivative(Debug, Default, PartialEq)] pub struct CheckboxInput { + // Content #[widget_builder(constructor)] pub checked: bool, - - pub disabled: bool, - + #[derivative(Default(value = "\"Checkmark\".to_string()"))] pub icon: String, - - #[serde(rename = "tooltipLabel")] - pub tooltip_label: String, - - #[serde(rename = "tooltipDescription")] - pub tooltip_description: String, - - #[serde(rename = "tooltipShortcut")] - pub tooltip_shortcut: Option, - #[serde(rename = "forLabel")] pub for_label: CheckboxId, + pub disabled: bool, + + // Tooltips + #[serde(rename = "tooltipLabel")] + pub tooltip_label: String, + #[serde(rename = "tooltipDescription")] + pub tooltip_description: String, + #[serde(rename = "tooltipShortcut")] + pub tooltip_shortcut: Option, // Callbacks #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_update: WidgetCallback, - #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_commit: WidgetCallback<()>, } -impl Default for CheckboxInput { - fn default() -> Self { - Self { - icon: "Checkmark".into(), - checked: Default::default(), - disabled: Default::default(), - tooltip_label: Default::default(), - tooltip_description: Default::default(), - tooltip_shortcut: Default::default(), - for_label: CheckboxId::new(), - on_update: Default::default(), - on_commit: Default::default(), - } - } -} - #[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, serde::Serialize, serde::Deserialize)] pub struct CheckboxId(pub u64); @@ -77,48 +58,45 @@ impl specta::Type for CheckboxId { #[derive(Clone, serde::Serialize, serde::Deserialize, Derivative, WidgetBuilder, specta::Type)] #[derivative(Debug, PartialEq, Default)] pub struct DropdownInput { + // Content + // This uses `u32` instead of `usize` since it will be serialized as a normal JS number (we can replace this with `usize` if we switch to a Rust-based GUI) + #[serde(rename = "selectedIndex")] + pub selected_index: Option, + #[serde(rename = "drawIcon")] + pub draw_icon: bool, + pub disabled: bool, + + // Children #[widget_builder(constructor)] pub entries: MenuListEntrySections, - #[serde(rename = "entriesHash")] #[widget_builder(skip)] pub entries_hash: u64, - // This uses `u32` instead of `usize` since it will be serialized as a normal JS number (replace this with `usize` after switching to a Rust-based GUI) - #[serde(rename = "selectedIndex")] - pub selected_index: Option, - - #[serde(rename = "drawIcon")] - pub draw_icon: bool, + // Styling + pub narrow: bool, + // Behavior + #[serde(rename = "virtualScrolling")] + pub virtual_scrolling: bool, #[derivative(Default(value = "true"))] pub interactive: bool, - pub disabled: bool, - - pub narrow: bool, - - #[serde(rename = "virtualScrolling")] - pub virtual_scrolling: bool, - - #[serde(rename = "tooltipLabel")] - pub tooltip_label: String, - - #[serde(rename = "tooltipDescription")] - pub tooltip_description: String, - - #[serde(rename = "tooltipShortcut")] - pub tooltip_shortcut: Option, - - // Styling + // Sizing #[serde(rename = "minWidth")] pub min_width: u32, - #[serde(rename = "maxWidth")] pub max_width: u32, + + // Tooltips + #[serde(rename = "tooltipLabel")] + pub tooltip_label: String, + #[serde(rename = "tooltipDescription")] + pub tooltip_description: String, + #[serde(rename = "tooltipShortcut")] + pub tooltip_shortcut: Option, // - // Callbacks - // `on_update` exists on the `MenuListEntry`, not this parent `DropdownInput` + // Callbacks exists on the `MenuListEntry` children, not this parent `DropdownInput` } pub type MenuListEntrySections = Vec>; @@ -127,37 +105,34 @@ pub type MenuListEntrySections = Vec>; #[derivative(Debug, PartialEq)] #[widget_builder(not_widget_instance)] pub struct MenuListEntry { + // Content #[widget_builder(constructor)] pub value: String, - pub label: String, - - pub font: String, - pub icon: String, - pub disabled: bool, - #[serde(rename = "tooltipLabel")] - pub tooltip_label: String, - - #[serde(rename = "tooltipDescription")] - pub tooltip_description: String, - - #[serde(rename = "tooltipShortcut")] - pub tooltip_shortcut: Option, - + // Children pub children: MenuListEntrySections, - #[serde(rename = "childrenHash")] #[widget_builder(skip)] pub children_hash: u64, + // Styling + pub font: String, + + // Tooltips + #[serde(rename = "tooltipLabel")] + pub tooltip_label: String, + #[serde(rename = "tooltipDescription")] + pub tooltip_description: String, + #[serde(rename = "tooltipShortcut")] + pub tooltip_shortcut: Option, + // Callbacks #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_update: WidgetCallback<()>, - #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_commit: WidgetCallback<()>, @@ -175,83 +150,64 @@ impl std::hash::Hash for MenuListEntry { #[derive(Clone, serde::Serialize, serde::Deserialize, Derivative, WidgetBuilder, specta::Type)] #[derivative(Debug, PartialEq, Default)] pub struct NumberInput { - // Label - pub label: String, - - #[serde(rename = "tooltipLabel")] - pub tooltip_label: String, - - #[serde(rename = "tooltipDescription")] - pub tooltip_description: String, - - #[serde(rename = "tooltipShortcut")] - pub tooltip_shortcut: Option, - - // Disabled - pub disabled: bool, - - pub narrow: bool, - - // Value + // Content #[widget_builder(constructor)] pub value: Option, + pub label: String, + pub disabled: bool, + // Styling + pub narrow: bool, + + // Behavior + pub mode: NumberInputMode, #[widget_builder(skip)] pub min: Option, - #[widget_builder(skip)] pub max: Option, - + // TODO: Make this (and range_max) apply to both Range and Increment modes when dragging with the mouse + #[serde(rename = "rangeMin")] + pub range_min: Option, + #[serde(rename = "rangeMax")] + pub range_max: Option, + #[derivative(Default(value = "1."))] + pub step: f64, #[serde(rename = "isInteger")] pub is_integer: bool, - - // Number presentation + #[serde(rename = "incrementBehavior")] + pub increment_behavior: NumberInputIncrementBehavior, #[serde(rename = "displayDecimalPlaces")] #[derivative(Default(value = "2"))] pub display_decimal_places: u32, - pub unit: String, - #[serde(rename = "unitIsHiddenWhenEditing")] #[derivative(Default(value = "true"))] pub unit_is_hidden_when_editing: bool, - // Mode behavior - pub mode: NumberInputMode, - - #[serde(rename = "incrementBehavior")] - pub increment_behavior: NumberInputIncrementBehavior, - - #[derivative(Default(value = "1."))] - pub step: f64, - - // TODO: Make this (and range_max) apply to both Range and Increment modes when dragging with the mouse - #[serde(rename = "rangeMin")] - pub range_min: Option, - - #[serde(rename = "rangeMax")] - pub range_max: Option, - - // Styling + // Sizing #[serde(rename = "minWidth")] pub min_width: u32, - #[serde(rename = "maxWidth")] pub max_width: u32, + // Tooltips + #[serde(rename = "tooltipLabel")] + pub tooltip_label: String, + #[serde(rename = "tooltipDescription")] + pub tooltip_description: String, + #[serde(rename = "tooltipShortcut")] + pub tooltip_shortcut: Option, + // Callbacks #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub increment_callback_increase: WidgetCallback, - #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub increment_callback_decrease: WidgetCallback, - #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_update: WidgetCallback, - #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_commit: WidgetCallback<()>, @@ -307,8 +263,10 @@ pub enum NumberInputMode { #[derive(Clone, serde::Serialize, serde::Deserialize, Derivative, WidgetBuilder, specta::Type)] #[derivative(Debug, PartialEq, Default)] pub struct NodeCatalog { + // Content pub disabled: bool, + // Behavior #[serde(rename = "initialSearchTerm")] pub intial_search: String, @@ -316,7 +274,6 @@ pub struct NodeCatalog { #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_update: WidgetCallback, - #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_commit: WidgetCallback<()>, @@ -325,38 +282,41 @@ pub struct NodeCatalog { #[derive(Clone, Default, Derivative, serde::Serialize, serde::Deserialize, WidgetBuilder, specta::Type)] #[derivative(Debug, PartialEq)] pub struct RadioInput { - #[widget_builder(constructor)] - pub entries: Vec, - - pub disabled: bool, - - pub narrow: bool, - + // Content // This uses `u32` instead of `usize` since it will be serialized as a normal JS number (replace this with `usize` after switching to a Rust-based GUI) #[serde(rename = "selectedIndex")] pub selected_index: Option, + pub disabled: bool, + // Children + #[widget_builder(constructor)] + pub entries: Vec, + + // Styling + pub narrow: bool, + + // Sizing #[serde(rename = "minWidth")] pub min_width: u32, + // + // Callbacks exists on the `RadioEntryData` children, not this parent `RadioInput` } #[derive(Clone, Default, Derivative, serde::Serialize, serde::Deserialize, WidgetBuilder, specta::Type)] #[derivative(Debug, PartialEq)] #[widget_builder(not_widget_instance)] pub struct RadioEntryData { + // Content #[widget_builder(constructor)] pub value: String, - pub label: String, - pub icon: String, + // Tooltips #[serde(rename = "tooltipLabel")] pub tooltip_label: String, - #[serde(rename = "tooltipDescription")] pub tooltip_description: String, - #[serde(rename = "tooltipShortcut")] pub tooltip_shortcut: Option, @@ -364,7 +324,6 @@ pub struct RadioEntryData { #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_update: WidgetCallback<()>, - #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_commit: WidgetCallback<()>, @@ -373,9 +332,9 @@ pub struct RadioEntryData { #[derive(Clone, serde::Serialize, serde::Deserialize, Derivative, WidgetBuilder, specta::Type)] #[derivative(Debug, PartialEq, Default)] pub struct WorkingColorsInput { + // Content #[widget_builder(constructor)] pub primary: Color, - #[widget_builder(constructor)] pub secondary: Color, } @@ -383,19 +342,17 @@ pub struct WorkingColorsInput { #[derive(Clone, serde::Serialize, serde::Deserialize, Derivative, WidgetBuilder, specta::Type)] #[derivative(Debug, PartialEq, Default)] pub struct TextAreaInput { + // Content #[widget_builder(constructor)] pub value: String, - pub label: Option, - pub disabled: bool, + // Tooltips #[serde(rename = "tooltipLabel")] pub tooltip_label: String, - #[serde(rename = "tooltipDescription")] pub tooltip_description: String, - #[serde(rename = "tooltipShortcut")] pub tooltip_shortcut: Option, @@ -403,7 +360,6 @@ pub struct TextAreaInput { #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_update: WidgetCallback, - #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_commit: WidgetCallback<()>, @@ -412,37 +368,35 @@ pub struct TextAreaInput { #[derive(Clone, serde::Serialize, serde::Deserialize, Derivative, WidgetBuilder, specta::Type)] #[derivative(Debug, PartialEq, Default)] pub struct TextInput { + // Content #[widget_builder(constructor)] pub value: String, - pub label: Option, - + pub placeholder: Option, pub disabled: bool, + // Styling pub narrow: bool, - - #[serde(rename = "tooltipLabel")] - pub tooltip_label: String, - - #[serde(rename = "tooltipDescription")] - pub tooltip_description: String, - - #[serde(rename = "tooltipShortcut")] - pub tooltip_shortcut: Option, - pub centered: bool, + // Sizing #[serde(rename = "minWidth")] pub min_width: u32, - #[serde(rename = "maxWidth")] pub max_width: u32, + // Tooltips + #[serde(rename = "tooltipLabel")] + pub tooltip_label: String, + #[serde(rename = "tooltipDescription")] + pub tooltip_description: String, + #[serde(rename = "tooltipShortcut")] + pub tooltip_shortcut: Option, + // Callbacks #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_update: WidgetCallback, - #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_commit: WidgetCallback<()>, @@ -451,17 +405,15 @@ pub struct TextInput { #[derive(Clone, serde::Serialize, serde::Deserialize, Derivative, WidgetBuilder, specta::Type)] #[derivative(Debug, PartialEq, Default)] pub struct CurveInput { + // Content #[widget_builder(constructor)] pub value: Curve, - pub disabled: bool, - + // Tooltips #[serde(rename = "tooltipLabel")] pub tooltip_label: String, - #[serde(rename = "tooltipDescription")] pub tooltip_description: String, - #[serde(rename = "tooltipShortcut")] pub tooltip_shortcut: Option, @@ -469,7 +421,6 @@ pub struct CurveInput { #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_update: WidgetCallback, - #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_commit: WidgetCallback<()>, @@ -478,17 +429,16 @@ pub struct CurveInput { #[derive(Clone, Default, Derivative, serde::Serialize, serde::Deserialize, WidgetBuilder, specta::Type)] #[derivative(Debug, PartialEq)] pub struct ReferencePointInput { + // Content #[widget_builder(constructor)] pub value: ReferencePoint, - pub disabled: bool, + // Tooltips #[serde(rename = "tooltipLabel")] pub tooltip_label: String, - #[serde(rename = "tooltipDescription")] pub tooltip_description: String, - #[serde(rename = "tooltipShortcut")] pub tooltip_shortcut: Option, @@ -496,7 +446,6 @@ pub struct ReferencePointInput { #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_update: WidgetCallback, - #[serde(skip)] #[derivative(Debug = "ignore", PartialEq = "ignore")] pub on_commit: WidgetCallback<()>, diff --git a/editor/src/messages/layout/utility_types/widgets/label_widgets.rs b/editor/src/messages/layout/utility_types/widgets/label_widgets.rs index e91c17c7f4..deea81e0b1 100644 --- a/editor/src/messages/layout/utility_types/widgets/label_widgets.rs +++ b/editor/src/messages/layout/utility_types/widgets/label_widgets.rs @@ -5,28 +5,26 @@ use graphite_proc_macros::WidgetBuilder; #[derive(Clone, serde::Serialize, serde::Deserialize, Derivative, Debug, Default, PartialEq, Eq, WidgetBuilder, specta::Type)] pub struct IconLabel { + // Content #[widget_builder(constructor)] pub icon: String, - pub disabled: bool, + // Tooltips #[serde(rename = "tooltipLabel")] pub tooltip_label: String, - #[serde(rename = "tooltipDescription")] pub tooltip_description: String, - #[serde(rename = "tooltipShortcut")] pub tooltip_shortcut: Option, } #[derive(Debug, Clone, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize, WidgetBuilder, specta::Type)] pub struct Separator { + // Content pub direction: SeparatorDirection, - - #[serde(rename = "type")] #[widget_builder(constructor)] - pub separator_type: SeparatorType, + pub style: SeparatorStyle, } #[derive(Debug, Clone, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize, specta::Type)] @@ -37,7 +35,7 @@ pub enum SeparatorDirection { } #[derive(Debug, Clone, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize, specta::Type)] -pub enum SeparatorType { +pub enum SeparatorStyle { Related, #[default] Unrelated, @@ -47,60 +45,53 @@ pub enum SeparatorType { #[derive(Clone, serde::Serialize, serde::Deserialize, Derivative, Debug, Eq, Default, WidgetBuilder, specta::Type)] #[derivative(PartialEq)] pub struct TextLabel { + // Content + #[widget_builder(constructor)] + pub value: String, pub disabled: bool, - - pub narrow: bool, - - pub bold: bool, - - pub italic: bool, - - pub monospace: bool, - - pub multiline: bool, - - #[serde(rename = "centerAlign")] - pub center_align: bool, - - #[serde(rename = "tableAlign")] - pub table_align: bool, - - #[serde(rename = "minWidth")] - pub min_width: String, - - #[serde(rename = "tooltipLabel")] - pub tooltip_label: String, - - #[serde(rename = "tooltipDescription")] - pub tooltip_description: String, - - #[serde(rename = "tooltipShortcut")] - pub tooltip_shortcut: Option, - #[serde(rename = "forCheckbox")] pub for_checkbox: CheckboxId, - // Body - #[widget_builder(constructor)] - pub value: String, + // Styling + pub narrow: bool, + pub bold: bool, + pub italic: bool, + pub monospace: bool, + pub multiline: bool, + #[serde(rename = "centerAlign")] + pub center_align: bool, + #[serde(rename = "tableAlign")] + pub table_align: bool, + + // Sizing + #[serde(rename = "minWidth")] + pub min_width: u32, + #[serde(rename = "minWidthCharacters")] + pub min_width_characters: u32, + + // Tooltips + #[serde(rename = "tooltipLabel")] + pub tooltip_label: String, + #[serde(rename = "tooltipDescription")] + pub tooltip_description: String, + #[serde(rename = "tooltipShortcut")] + pub tooltip_shortcut: Option, } #[derive(Clone, serde::Serialize, serde::Deserialize, Derivative, Default, WidgetBuilder, specta::Type)] #[derivative(Debug, PartialEq)] pub struct ImageLabel { + // Content #[widget_builder(constructor)] pub url: String, - pub width: Option, - pub height: Option, + // Tooltips #[serde(rename = "tooltipLabel")] pub tooltip_label: String, - #[serde(rename = "tooltipDescription")] pub tooltip_description: String, - #[serde(rename = "tooltipShortcut")] pub tooltip_shortcut: Option, } @@ -108,6 +99,7 @@ pub struct ImageLabel { #[derive(Clone, serde::Serialize, serde::Deserialize, Derivative, Default, WidgetBuilder, specta::Type)] #[derivative(Debug, PartialEq)] pub struct ShortcutLabel { + // Content // This is wrapped in an Option to satisfy the requirement that widgets implement Default #[widget_builder(constructor)] pub shortcut: Option, diff --git a/editor/src/messages/portfolio/document/data_panel/data_panel_message_handler.rs b/editor/src/messages/portfolio/document/data_panel/data_panel_message_handler.rs index 004b3cc485..30a61a9174 100644 --- a/editor/src/messages/portfolio/document/data_panel/data_panel_message_handler.rs +++ b/editor/src/messages/portfolio/document/data_panel/data_panel_message_handler.rs @@ -102,7 +102,7 @@ impl DataPanelMessageHandler { } else { IconLabel::new("Node").tooltip_description("Name of the selected node.").widget_instance() }, - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), TextInput::new(network_interface.display_name(&node_id, &[])) .tooltip_description(if is_layer { "Name of the selected layer." } else { "Name of the selected node." }) .on_update(move |text_input| { @@ -115,7 +115,7 @@ impl DataPanelMessageHandler { }) .max_width(200) .widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), ]); } diff --git a/editor/src/messages/portfolio/document/document_message_handler.rs b/editor/src/messages/portfolio/document/document_message_handler.rs index a0b7332c25..6402f609fd 100644 --- a/editor/src/messages/portfolio/document/document_message_handler.rs +++ b/editor/src/messages/portfolio/document/document_message_handler.rs @@ -2208,7 +2208,7 @@ impl DocumentMessageHandler { .tooltip_shortcut(action_shortcut!(AnimationMessageDiscriminant::ToggleLivePreview)) .on_update(|_| AnimationMessage::ToggleLivePreview.into()) .widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), CheckboxInput::new(self.overlays_visibility_settings.all) .icon("Overlays") .tooltip_label("Overlays") @@ -2457,7 +2457,7 @@ impl DocumentMessageHandler { }, ])) .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), CheckboxInput::new(snapping_state.snapping_enabled) .icon("Snapping") .tooltip_label("Snapping") @@ -2527,7 +2527,7 @@ impl DocumentMessageHandler { .collect(), )) .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), CheckboxInput::new(self.snapping_state.grid_snapping) .icon("Grid") .tooltip_label("Grid") @@ -2538,7 +2538,7 @@ impl DocumentMessageHandler { .popover_layout(Layout(overlay_options(&self.snapping_state.grid))) .popover_min_width(Some(320)) .widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), RadioInput::new(vec![ RadioEntryData::new("Normal") .icon("RenderModeNormal") @@ -2562,7 +2562,7 @@ impl DocumentMessageHandler { .selected_index(Some(self.render_mode as u32)) .narrow(true) .widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), ]; widgets.extend(navigation_controls(&self.document_ptz, &self.navigation_handler, false)); @@ -2570,7 +2570,7 @@ impl DocumentMessageHandler { let tilt_value = self.navigation_handler.snapped_tilt(self.document_ptz.tilt()) / (std::f64::consts::PI / 180.); if tilt_value.abs() > 0.00001 { widgets.extend([ - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), NumberInput::new(Some(tilt_value)) .unit("°") .increment_behavior(NumberInputIncrementBehavior::Callback) @@ -2600,7 +2600,7 @@ impl DocumentMessageHandler { } widgets.extend([ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), TextButton::new("Node Graph") .icon(Some((if self.graph_view_overlay_open { "GraphViewOpen" } else { "GraphViewClosed" }).into())) .hover_icon(Some((if self.graph_view_overlay_open { "GraphViewClosed" } else { "GraphViewOpen" }).into())) @@ -2704,7 +2704,7 @@ impl DocumentMessageHandler { .max_width(100) .tooltip_label("Blend Mode") .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), NumberInput::new(opacity) .label("Opacity") .unit("%") @@ -2726,7 +2726,7 @@ impl DocumentMessageHandler { .max_width(100) .tooltip_label("Opacity") .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), NumberInput::new(fill) .label("Fill") .unit("%") @@ -2824,7 +2824,7 @@ impl DocumentMessageHandler { Layout(vec![LayoutGroup::Row { widgets: vec![node_chooser] }]) }) .widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), IconButton::new("Folder", 24) .tooltip_label("Group Selected") .tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::GroupSelectedLayers)) @@ -3149,7 +3149,7 @@ pub fn navigation_controls(ptz: &PTZ, navigation_handler: &NavigationMessageHand ); } list.extend([ - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), NumberInput::new(Some(navigation_handler.snapped_zoom(ptz.zoom()) * 100.)) .unit("%") .min(0.000001) diff --git a/editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs b/editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs index 16cf2983ae..32c5af432d 100644 --- a/editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs +++ b/editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs @@ -2536,7 +2536,7 @@ fn static_input_properties() -> InputProperties { }; if let Some(&TaggedValue::F64(val)) = input.as_non_exposed_value() { widgets.extend_from_slice(&[ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), NumberInput::new(Some(val)) .unit("°") .mode(NumberInputMode::Range) @@ -2567,7 +2567,7 @@ fn static_input_properties() -> InputProperties { }; if let Some(&TaggedValue::DVec2(val)) = input.as_non_exposed_value() { widgets.extend_from_slice(&[ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), NumberInput::new(Some(val.x)) .label("X") .unit("°") @@ -2580,7 +2580,7 @@ fn static_input_properties() -> InputProperties { )) .on_commit(node_properties::commit_value) .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), NumberInput::new(Some(val.y)) .label("Y") .unit("°") diff --git a/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs b/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs index 940fef7a13..c491b3cba0 100644 --- a/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs +++ b/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs @@ -2180,7 +2180,7 @@ impl NodeGraphMessageHandler { }) .widget_instance(), // - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), // IconButton::new("Folder", 24) .tooltip_label("Group Selected") @@ -2203,7 +2203,7 @@ impl NodeGraphMessageHandler { .disabled(!has_selection) .widget_instance(), // - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), // IconButton::new(if selection_all_locked { "PadlockLocked" } else { "PadlockUnlocked" }, 24) .hover_icon(Some((if selection_all_locked { "PadlockUnlocked" } else { "PadlockLocked" }).into())) @@ -2244,7 +2244,7 @@ impl NodeGraphMessageHandler { .tooltip_description("Restore preview to the graph output.") .on_update(move |_| NodeGraphMessage::TogglePreview { node_id }.into()) .widget_instance(); - widgets.extend([Separator::new(SeparatorType::Unrelated).widget_instance(), button]); + widgets.extend([Separator::new(SeparatorStyle::Unrelated).widget_instance(), button]); } else if let Some(&node_id) = selection { let selection_is_not_already_the_output = !network .exports @@ -2258,14 +2258,14 @@ impl NodeGraphMessageHandler { .tooltip_shortcut(action_shortcut_manual!(Key::Alt, Key::MouseLeft)) .on_update(move |_| NodeGraphMessage::TogglePreview { node_id }.into()) .widget_instance(); - widgets.extend([Separator::new(SeparatorType::Unrelated).widget_instance(), button]); + widgets.extend([Separator::new(SeparatorStyle::Unrelated).widget_instance(), button]); } } let subgraph_path_names_length = subgraph_path_names.len(); if subgraph_path_names_length >= 2 { widgets.extend([ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), BreadcrumbTrailButtons::new(subgraph_path_names) .on_update(move |index| { DocumentMessage::ExitNestedNetwork { @@ -2305,11 +2305,11 @@ impl NodeGraphMessageHandler { .into() }) .widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), ]; widgets.extend(navigation_controls(node_graph_ptz, navigation_handler, true)); widgets.extend([ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), TextButton::new("Node Graph") .icon(Some("GraphViewOpen".into())) .hover_icon(Some("GraphViewClosed".into())) @@ -2363,9 +2363,9 @@ impl NodeGraphMessageHandler { if let [node_id] = *nodes.as_slice() { properties.push(LayoutGroup::Row { widgets: vec![ - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), IconLabel::new("Node").tooltip_description("Name of the selected node.").widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), TextInput::new(context.network_interface.display_name(&node_id, context.selection_network_path)) .tooltip_description("Name of the selected node.") .on_update(move |text_input| { @@ -2377,7 +2377,7 @@ impl NodeGraphMessageHandler { .into() }) .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), ], }); } @@ -2391,14 +2391,14 @@ impl NodeGraphMessageHandler { // This may require store a separate path for the properties panel let mut properties = vec![LayoutGroup::Row { widgets: vec![ - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), IconLabel::new("File").tooltip_description("Name of the current document.").widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), TextInput::new(context.document_name) .tooltip_description("Name of the current document.") .on_update(|text_input| DocumentMessage::RenameDocument { new_name: text_input.value.clone() }.into()) .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), ], }]; @@ -2438,9 +2438,9 @@ impl NodeGraphMessageHandler { let mut layer_properties = vec![LayoutGroup::Row { widgets: vec![ - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), IconLabel::new("Layer").tooltip_description("Name of the selected layer.").widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), TextInput::new(context.network_interface.display_name(&layer, context.selection_network_path)) .tooltip_description("Name of the selected layer.") .on_update(move |text_input| { @@ -2452,7 +2452,7 @@ impl NodeGraphMessageHandler { .into() }) .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), PopoverButton::new() .icon(Some("Node".to_string())) .tooltip_description("Add an operation to the end of this layer's chain of nodes.") @@ -2477,7 +2477,7 @@ impl NodeGraphMessageHandler { Layout(vec![LayoutGroup::Row { widgets: vec![node_chooser] }]) }) .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), ], }]; diff --git a/editor/src/messages/portfolio/document/node_graph/node_properties.rs b/editor/src/messages/portfolio/document/node_graph/node_properties.rs index 2369dc7847..e05145f30f 100644 --- a/editor/src/messages/portfolio/document/node_graph/node_properties.rs +++ b/editor/src/messages/portfolio/document/node_graph/node_properties.rs @@ -71,9 +71,9 @@ pub fn expose_widget(node_id: NodeId, index: usize, data_type: FrontendGraphData pub fn add_blank_assist(widgets: &mut Vec) { widgets.extend_from_slice(&[ // Custom CSS specific to the Properties panel converts this Section separator into the width of an assist (24px). - Separator::new(SeparatorType::Section).widget_instance(), + Separator::new(SeparatorStyle::Section).widget_instance(), // This last one is the separator after the 24px assist. - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), ]); } @@ -231,7 +231,7 @@ pub(crate) fn property_from_type( _ => { let mut widgets = start_widgets(default_info); widgets.extend_from_slice(&[ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), TextLabel::new("-") .tooltip_label(format!( "Data Type: {}", @@ -273,7 +273,7 @@ pub fn text_widget(parameter_widgets_info: ParameterWidgetsInfo) -> Vec Vec { widgets.extend_from_slice(&[ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), NumberInput::new(Some(dvec2.x)) .label(x) .unit(unit) @@ -654,7 +654,7 @@ pub fn vec2_widget(parameter_widgets_info: ParameterWidgetsInfo, x: &str, y: &st .on_update(update_value(move |input: &NumberInput| TaggedValue::DVec2(DVec2::new(input.value.unwrap(), dvec2.y)), node_id, index)) .on_commit(commit_value) .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), NumberInput::new(Some(dvec2.y)) .label(y) .unit(unit) @@ -668,7 +668,7 @@ pub fn vec2_widget(parameter_widgets_info: ParameterWidgetsInfo, x: &str, y: &st } Some(&TaggedValue::F64(value)) => { widgets.extend_from_slice(&[ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), NumberInput::new(Some(value)) .label(x) .unit(unit) @@ -678,7 +678,7 @@ pub fn vec2_widget(parameter_widgets_info: ParameterWidgetsInfo, x: &str, y: &st .on_update(update_value(move |input: &NumberInput| TaggedValue::DVec2(DVec2::new(input.value.unwrap(), value)), node_id, index)) .on_commit(commit_value) .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), NumberInput::new(Some(value)) .label(y) .unit(unit) @@ -718,7 +718,7 @@ pub fn array_of_number_widget(parameter_widgets_info: ParameterWidgetsInfo, text }; if let Some(TaggedValue::VecF64(x)) = &input.as_non_exposed_value() { widgets.extend_from_slice(&[ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), text_input .value(x.iter().map(|v| v.to_string()).collect::>().join(", ")) .on_update(optionally_update_value(move |x: &TextInput| from_string(&x.value), node_id, index)) @@ -750,7 +750,7 @@ pub fn array_of_vec2_widget(parameter_widgets_info: ParameterWidgetsInfo, text_p }; if let Some(TaggedValue::VecDVec2(x)) = &input.as_non_exposed_value() { widgets.extend_from_slice(&[ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), text_props .value(x.iter().map(|v| format!("({}, {})", v.x, v.y)).collect::>().join(", ")) .on_update(optionally_update_value(move |x: &TextInput| from_string(&x.value), node_id, index)) @@ -780,7 +780,7 @@ pub fn font_inputs(parameter_widgets_info: ParameterWidgetsInfo) -> (Vec (Vec widgets.extend_from_slice(&[ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), number_props .value(Some(x)) .on_update(update_value(move |x: &NumberInput| TaggedValue::F64(x.value.unwrap()), node_id, index)) @@ -966,7 +966,7 @@ pub fn number_widget(parameter_widgets_info: ParameterWidgetsInfo, number_props: .widget_instance(), ]), Some(&TaggedValue::F32(x)) => widgets.extend_from_slice(&[ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), number_props .value(Some(x as f64)) .on_update(update_value(move |x: &NumberInput| TaggedValue::F32(x.value.unwrap() as f32), node_id, index)) @@ -974,7 +974,7 @@ pub fn number_widget(parameter_widgets_info: ParameterWidgetsInfo, number_props: .widget_instance(), ]), Some(&TaggedValue::U32(x)) => widgets.extend_from_slice(&[ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), number_props .value(Some(x as f64)) .on_update(update_value(move |x: &NumberInput| TaggedValue::U32((x.value.unwrap()) as u32), node_id, index)) @@ -982,7 +982,7 @@ pub fn number_widget(parameter_widgets_info: ParameterWidgetsInfo, number_props: .widget_instance(), ]), Some(&TaggedValue::U64(x)) => widgets.extend_from_slice(&[ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), number_props .value(Some(x as f64)) .on_update(update_value(move |x: &NumberInput| TaggedValue::U64((x.value.unwrap()) as u64), node_id, index)) @@ -993,15 +993,15 @@ pub fn number_widget(parameter_widgets_info: ParameterWidgetsInfo, number_props: // TODO: Don't wipe out the previously set value (setting it back to the default of 100) when reenabling this checkbox back to Some from None let toggle_enabled = move |checkbox_input: &CheckboxInput| TaggedValue::OptionalF64(if checkbox_input.checked { Some(100.) } else { None }); widgets.extend_from_slice(&[ - Separator::new(SeparatorType::Unrelated).widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), // The checkbox toggles if the value is Some or None CheckboxInput::new(x.is_some()) .on_update(update_value(toggle_enabled, node_id, index)) .on_commit(commit_value) .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), number_props .value(x) .on_update(update_value(move |x: &NumberInput| TaggedValue::OptionalF64(x.value), node_id, index)) @@ -1011,7 +1011,7 @@ pub fn number_widget(parameter_widgets_info: ParameterWidgetsInfo, number_props: ]); } Some(&TaggedValue::DVec2(dvec2)) => widgets.extend_from_slice(&[ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), number_props // We use an arbitrary `y` instead of an arbitrary `x` here because the "Grid" node's "Spacing" value's height should be used from rectangular mode when transferred to "Y Spacing" in isometric mode .value(Some(dvec2.y)) @@ -1020,7 +1020,7 @@ pub fn number_widget(parameter_widgets_info: ParameterWidgetsInfo, number_props: .widget_instance(), ]), Some(&TaggedValue::FVec2(vec2)) => widgets.extend_from_slice(&[ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), number_props // We use an arbitrary `y` instead of an arbitrary `x` here because the "Grid" node's "Spacing" value's height should be used from rectangular mode when transferred to "Y Spacing" in isometric mode .value(Some(vec2.y as f64)) @@ -1061,7 +1061,7 @@ pub fn blend_mode_widget(parameter_widgets_info: ParameterWidgetsInfo) -> Layout .collect(); widgets.extend_from_slice(&[ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), DropdownInput::new(entries) .selected_index(blend_mode.index_in_list_svg_subset().map(|index| index as u32)) .widget_instance(), @@ -1082,7 +1082,7 @@ pub fn color_widget(parameter_widgets_info: ParameterWidgetsInfo, color_button: }; // Add a separator - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); // Add the color input match &**tagged_value { @@ -1164,7 +1164,7 @@ pub fn curve_widget(parameter_widgets_info: ParameterWidgetsInfo) -> LayoutGroup }; if let Some(TaggedValue::Curve(curve)) = &input.as_non_exposed_value() { widgets.extend_from_slice(&[ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), CurveInput::new(curve.clone()) .on_update(update_value(|x: &CurveInput| TaggedValue::Curve(x.value.clone()), node_id, index)) .on_commit(commit_value) @@ -1574,9 +1574,9 @@ pub(crate) fn rectangle_properties(node_id: NodeId, context: &mut NodeProperties // Corner Radius let mut corner_radius_row_1 = start_widgets(ParameterWidgetsInfo::new(node_id, CornerRadiusInput::::INDEX, true, context)); - corner_radius_row_1.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + corner_radius_row_1.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); - let mut corner_radius_row_2 = vec![Separator::new(SeparatorType::Unrelated).widget_instance()]; + let mut corner_radius_row_2 = vec![Separator::new(SeparatorStyle::Unrelated).widget_instance()]; corner_radius_row_2.push(TextLabel::new("").widget_instance()); add_blank_assist(&mut corner_radius_row_2); @@ -1837,7 +1837,7 @@ pub(crate) fn fill_properties(node_id: NodeId, context: &mut NodePropertiesConte let backup_color_fill: Fill = backup_color.clone().into(); let backup_gradient_fill: Fill = backup_gradient.clone().into(); - widgets_first_row.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets_first_row.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); widgets_first_row.push( ColorInput::default() .value(fill.clone().into()) @@ -1896,7 +1896,7 @@ pub(crate) fn fill_properties(node_id: NodeId, context: &mut NodePropertiesConte FillInput::::INDEX, )) .widget_instance(); - row.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + row.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); row.push(reverse_button); } } @@ -1913,7 +1913,7 @@ pub(crate) fn fill_properties(node_id: NodeId, context: &mut NodePropertiesConte ]; row.extend_from_slice(&[ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), RadioInput::new(entries).selected_index(Some(if fill.as_gradient().is_some() { 1 } else { 0 })).widget_instance(), ]); @@ -1946,7 +1946,7 @@ pub(crate) fn fill_properties(node_id: NodeId, context: &mut NodePropertiesConte FillInput::::INDEX, )) .widget_instance(); - row.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + row.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); row.push(reverse_radial_gradient_button); } } @@ -1982,7 +1982,7 @@ pub(crate) fn fill_properties(node_id: NodeId, context: &mut NodePropertiesConte ]; row.extend_from_slice(&[ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), RadioInput::new(entries).selected_index(Some(gradient.gradient_type as u32)).widget_instance(), ]); @@ -2103,7 +2103,7 @@ pub fn math_properties(node_id: NodeId, context: &mut NodePropertiesContext) -> }; if let Some(TaggedValue::String(x)) = &input.as_non_exposed_value() { widgets.extend_from_slice(&[ - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), TextInput::new(x.clone()) .centered(true) .on_update(update_value( @@ -2331,7 +2331,7 @@ pub mod choice { let committer = || super::commit_value; let updater = || super::update_value(move |v: &W::Value| TaggedValue::from(v.clone()), node_id, index); let widget = self.widget_factory.build(current, updater, committer); - widgets.extend_from_slice(&[Separator::new(SeparatorType::Unrelated).widget_instance(), widget]); + widgets.extend_from_slice(&[Separator::new(SeparatorStyle::Unrelated).widget_instance(), widget]); } let mut row = LayoutGroup::Row { widgets }; diff --git a/editor/src/messages/portfolio/document/overlays/grid_overlays.rs b/editor/src/messages/portfolio/document/overlays/grid_overlays.rs index 6faeb0c06d..c961f9052a 100644 --- a/editor/src/messages/portfolio/document/overlays/grid_overlays.rs +++ b/editor/src/messages/portfolio/document/overlays/grid_overlays.rs @@ -242,7 +242,7 @@ pub fn overlay_options(grid: &GridSnapping) -> Vec { widgets.push(LayoutGroup::Row { widgets: vec![ TextLabel::new("Type").table_align(true).widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), RadioInput::new(vec![ RadioEntryData::new("rectangular").label("Rectangular").on_update(update_val(grid, |grid, _| { if let GridType::Isometric { y_axis_spacing, angle_a, angle_b } = grid.grid_type { @@ -274,7 +274,7 @@ pub fn overlay_options(grid: &GridSnapping) -> Vec { let mut color_widgets = vec![ TextLabel::new("Display").table_align(true).widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), ]; color_widgets.extend([ CheckboxInput::new(grid.dot_display) @@ -282,7 +282,7 @@ pub fn overlay_options(grid: &GridSnapping) -> Vec { .tooltip_label("Display as Dotted Grid") .on_update(update_display(grid, |grid| Some(&mut grid.dot_display))) .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), ]); color_widgets.push( ColorInput::new(FillChoice::Solid(grid.grid_color.to_gamma_srgb())) @@ -296,14 +296,14 @@ pub fn overlay_options(grid: &GridSnapping) -> Vec { widgets.push(LayoutGroup::Row { widgets: vec![ TextLabel::new("Origin").table_align(true).widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), NumberInput::new(Some(grid.origin.x)) .label("X") .unit(" px") .min_width(98) .on_update(update_origin(grid, |grid| Some(&mut grid.origin.x))) .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), NumberInput::new(Some(grid.origin.y)) .label("Y") .unit(" px") @@ -317,7 +317,7 @@ pub fn overlay_options(grid: &GridSnapping) -> Vec { GridType::Rectangular { spacing } => widgets.push(LayoutGroup::Row { widgets: vec![ TextLabel::new("Spacing").table_align(true).widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), NumberInput::new(Some(spacing.x)) .label("X") .unit(" px") @@ -325,7 +325,7 @@ pub fn overlay_options(grid: &GridSnapping) -> Vec { .min_width(98) .on_update(update_origin(grid, |grid| grid.grid_type.rectangular_spacing().map(|spacing| &mut spacing.x))) .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), NumberInput::new(Some(spacing.y)) .label("Y") .unit(" px") @@ -339,7 +339,7 @@ pub fn overlay_options(grid: &GridSnapping) -> Vec { widgets.push(LayoutGroup::Row { widgets: vec![ TextLabel::new("Y Spacing").table_align(true).widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), NumberInput::new(Some(y_axis_spacing)) .unit(" px") .min(0.) @@ -351,13 +351,13 @@ pub fn overlay_options(grid: &GridSnapping) -> Vec { widgets.push(LayoutGroup::Row { widgets: vec![ TextLabel::new("Angles").table_align(true).widget_instance(), - Separator::new(SeparatorType::Unrelated).widget_instance(), + Separator::new(SeparatorStyle::Unrelated).widget_instance(), NumberInput::new(Some(angle_a)) .unit("°") .min_width(98) .on_update(update_origin(grid, |grid| grid.grid_type.angle_a())) .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), NumberInput::new(Some(angle_b)) .unit("°") .min_width(98) diff --git a/editor/src/messages/tool/common_functionality/color_selector.rs b/editor/src/messages/tool/common_functionality/color_selector.rs index 6a06d877ae..5b65c8c3a6 100644 --- a/editor/src/messages/tool/common_functionality/color_selector.rs +++ b/editor/src/messages/tool/common_functionality/color_selector.rs @@ -83,16 +83,16 @@ impl ToolColorOptions { let mut widgets = vec![TextLabel::new(label_text).widget_instance()]; if !color_allow_none { - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); } else { let reset = IconButton::new("CloseX", 12) .disabled(self.custom_color.is_none() && self.color_type == ToolColorType::Custom) .tooltip_label("Clear Color") .on_update(reset_callback); - widgets.push(Separator::new(SeparatorType::Related).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Related).widget_instance()); widgets.push(reset.widget_instance()); - widgets.push(Separator::new(SeparatorType::Related).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Related).widget_instance()); }; let entries = vec![ @@ -109,7 +109,7 @@ impl ToolColorOptions { .collect(); let radio = RadioInput::new(entries).selected_index(Some(self.color_type.clone() as u32)).widget_instance(); widgets.push(radio); - widgets.push(Separator::new(SeparatorType::Related).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Related).widget_instance()); let fill_choice = match self.active_color() { Some(color) => FillChoice::Solid(color.to_gamma_srgb()), diff --git a/editor/src/messages/tool/common_functionality/pivot.rs b/editor/src/messages/tool/common_functionality/pivot.rs index 0e61fd9a8a..20013bf678 100644 --- a/editor/src/messages/tool/common_functionality/pivot.rs +++ b/editor/src/messages/tool/common_functionality/pivot.rs @@ -83,7 +83,7 @@ pub fn pivot_gizmo_type_widget(state: PivotGizmoState, source: PivotToolSource) .into(), }) .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), DropdownInput::new(vec![gizmo_type_entries]) .selected_index(Some(match state.gizmo_type { PivotGizmoType::Pivot => 0, diff --git a/editor/src/messages/tool/tool_messages/brush_tool.rs b/editor/src/messages/tool/tool_messages/brush_tool.rs index 17da7b23a1..ba344fcc59 100644 --- a/editor/src/messages/tool/tool_messages/brush_tool.rs +++ b/editor/src/messages/tool/tool_messages/brush_tool.rs @@ -108,7 +108,7 @@ impl LayoutHolder for BrushTool { .unit(" px") .on_update(|number_input: &NumberInput| BrushToolMessage::UpdateOptions { options: BrushToolMessageOptionsUpdate::Diameter(number_input.value.unwrap()) }.into()) .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), NumberInput::new(Some(self.options.hardness)) .label("Hardness") .min(0.) @@ -122,7 +122,7 @@ impl LayoutHolder for BrushTool { .into() }) .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), NumberInput::new(Some(self.options.flow)) .label("Flow") .min(1.) @@ -136,7 +136,7 @@ impl LayoutHolder for BrushTool { .into() }) .widget_instance(), - Separator::new(SeparatorType::Related).widget_instance(), + Separator::new(SeparatorStyle::Related).widget_instance(), NumberInput::new(Some(self.options.spacing)) .label("Spacing") .min(1.) @@ -152,7 +152,7 @@ impl LayoutHolder for BrushTool { .widget_instance(), ]; - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); let draw_mode_entries: Vec<_> = [DrawMode::Draw, DrawMode::Erase, DrawMode::Restore] .into_iter() @@ -167,7 +167,7 @@ impl LayoutHolder for BrushTool { .collect(); widgets.push(RadioInput::new(draw_mode_entries).selected_index(Some(self.options.draw_mode as u32)).widget_instance()); - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); widgets.append(&mut self.options.color.create_widgets( "Color", @@ -194,7 +194,7 @@ impl LayoutHolder for BrushTool { }, )); - widgets.push(Separator::new(SeparatorType::Related).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Related).widget_instance()); let blend_mode_entries: Vec> = BlendMode::list() .iter() diff --git a/editor/src/messages/tool/tool_messages/freehand_tool.rs b/editor/src/messages/tool/tool_messages/freehand_tool.rs index 305abb5afa..9412577b48 100644 --- a/editor/src/messages/tool/tool_messages/freehand_tool.rs +++ b/editor/src/messages/tool/tool_messages/freehand_tool.rs @@ -122,7 +122,7 @@ impl LayoutHolder for FreehandTool { }, ); - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); widgets.append(&mut self.options.stroke.create_widgets( "Stroke", @@ -148,7 +148,7 @@ impl LayoutHolder for FreehandTool { .into() }, )); - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); widgets.push(create_weight_widget(self.options.line_weight)); Layout(vec![LayoutGroup::Row { widgets }]) diff --git a/editor/src/messages/tool/tool_messages/path_tool.rs b/editor/src/messages/tool/tool_messages/path_tool.rs index 7de9e0b7e6..35fd18e940 100644 --- a/editor/src/messages/tool/tool_messages/path_tool.rs +++ b/editor/src/messages/tool/tool_messages/path_tool.rs @@ -234,8 +234,8 @@ impl LayoutHolder for PathTool { }) .widget_instance(); - let related_seperator = Separator::new(SeparatorType::Related).widget_instance(); - let unrelated_seperator = Separator::new(SeparatorType::Unrelated).widget_instance(); + let related_seperator = Separator::new(SeparatorStyle::Related).widget_instance(); + let unrelated_seperator = Separator::new(SeparatorStyle::Unrelated).widget_instance(); let colinear_handles_description = "Keep both handles unbent, each 180° apart, when moving either."; let colinear_handles_state = manipulator_angle.and_then(|angle| match angle { diff --git a/editor/src/messages/tool/tool_messages/pen_tool.rs b/editor/src/messages/tool/tool_messages/pen_tool.rs index 2562f69630..ec379844c6 100644 --- a/editor/src/messages/tool/tool_messages/pen_tool.rs +++ b/editor/src/messages/tool/tool_messages/pen_tool.rs @@ -178,7 +178,7 @@ impl LayoutHolder for PenTool { }, ); - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); widgets.append(&mut self.options.stroke.create_widgets( "Stroke", @@ -205,11 +205,11 @@ impl LayoutHolder for PenTool { }, )); - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); widgets.push(create_weight_widget(self.options.line_weight)); - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); widgets.push( RadioInput::new(vec![ diff --git a/editor/src/messages/tool/tool_messages/select_tool.rs b/editor/src/messages/tool/tool_messages/select_tool.rs index 28ecbdfcb6..717903ab10 100644 --- a/editor/src/messages/tool/tool_messages/select_tool.rs +++ b/editor/src/messages/tool/tool_messages/select_tool.rs @@ -223,12 +223,12 @@ impl LayoutHolder for SelectTool { widgets.push(self.deep_selection_widget()); // Pivot gizmo type (checkbox + dropdown for pivot/origin) - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); widgets.extend(pivot_gizmo_type_widget(self.tool_data.pivot_gizmo.state, PivotToolSource::Select)); if self.tool_data.pivot_gizmo.state.is_pivot_type() { // Nine-position reference point widget - widgets.push(Separator::new(SeparatorType::Related).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Related).widget_instance()); widgets.push(pivot_reference_point_widget( self.tool_data.selected_layers_count == 0 || !self.tool_data.pivot_gizmo.state.is_pivot(), self.tool_data.pivot_gizmo.pivot.to_pivot_position(), @@ -236,7 +236,7 @@ impl LayoutHolder for SelectTool { )); // Pivot pin button - widgets.push(Separator::new(SeparatorType::Related).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Related).widget_instance()); let pin_active = self.tool_data.pivot_gizmo.pin_active(); let pin_enabled = self.tool_data.pivot_gizmo.pivot.old_pivot_position == ReferencePoint::None && !self.tool_data.pivot_gizmo.state.disabled; @@ -248,20 +248,20 @@ impl LayoutHolder for SelectTool { // Align let disabled = self.tool_data.selected_layers_count < 2; - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); widgets.extend(self.alignment_widgets(disabled)); // Flip let disabled = self.tool_data.selected_layers_count == 0; - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); widgets.extend(self.flip_widgets(disabled)); // Turn - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); widgets.extend(self.turn_widgets(disabled)); // Boolean - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); widgets.extend(self.boolean_widgets(self.tool_data.selected_layers_count)); Layout(vec![LayoutGroup::Row { widgets }]) diff --git a/editor/src/messages/tool/tool_messages/shape_tool.rs b/editor/src/messages/tool/tool_messages/shape_tool.rs index 24798333e7..ead0e1e1ce 100644 --- a/editor/src/messages/tool/tool_messages/shape_tool.rs +++ b/editor/src/messages/tool/tool_messages/shape_tool.rs @@ -253,30 +253,30 @@ impl LayoutHolder for ShapeTool { if !self.tool_data.hide_shape_option_widget { widgets.push(create_shape_option_widget(self.options.shape_type)); - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); if self.options.shape_type == ShapeType::Polygon || self.options.shape_type == ShapeType::Star { widgets.push(create_sides_widget(self.options.vertices)); - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); } if self.options.shape_type == ShapeType::Arc { widgets.push(create_arc_type_widget(self.options.arc_type)); - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); } } if self.options.shape_type == ShapeType::Spiral { widgets.push(create_spiral_type_widget(self.options.spiral_type)); - widgets.push(Separator::new(SeparatorType::Related).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Related).widget_instance()); widgets.push(create_turns_widget(self.options.turns)); - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); } if self.options.shape_type == ShapeType::Grid { widgets.push(create_grid_type_widget(self.options.grid_type)); - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); } if self.options.shape_type != ShapeType::Line { @@ -305,7 +305,7 @@ impl LayoutHolder for ShapeTool { }, )); - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); } widgets.append(&mut self.options.stroke.create_widgets( @@ -332,7 +332,7 @@ impl LayoutHolder for ShapeTool { .into() }, )); - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); widgets.push(create_weight_widget(self.options.line_weight)); Layout(vec![LayoutGroup::Row { widgets }]) diff --git a/editor/src/messages/tool/tool_messages/spline_tool.rs b/editor/src/messages/tool/tool_messages/spline_tool.rs index 18428d6fab..9aa7fcb5e0 100644 --- a/editor/src/messages/tool/tool_messages/spline_tool.rs +++ b/editor/src/messages/tool/tool_messages/spline_tool.rs @@ -129,7 +129,7 @@ impl LayoutHolder for SplineTool { }, ); - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); widgets.append(&mut self.options.stroke.create_widgets( "Stroke", @@ -155,7 +155,7 @@ impl LayoutHolder for SplineTool { .into() }, )); - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); widgets.push(create_weight_widget(self.options.line_weight)); Layout(vec![LayoutGroup::Row { widgets }]) diff --git a/editor/src/messages/tool/tool_messages/text_tool.rs b/editor/src/messages/tool/tool_messages/text_tool.rs index 4bc39f2082..fdd2678aef 100644 --- a/editor/src/messages/tool/tool_messages/text_tool.rs +++ b/editor/src/messages/tool/tool_messages/text_tool.rs @@ -215,13 +215,13 @@ fn create_text_widgets(tool: &TextTool, font_catalog: &FontCatalog) -> Vec Layout { let mut widgets = create_text_widgets(self, font_catalog); - widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance()); widgets.append(&mut self.options.fill.create_widgets( "Fill", diff --git a/editor/src/messages/tool/utility_types.rs b/editor/src/messages/tool/utility_types.rs index d5af8492eb..ead8c52214 100644 --- a/editor/src/messages/tool/utility_types.rs +++ b/editor/src/messages/tool/utility_types.rs @@ -278,11 +278,11 @@ impl ToolData { ) .filter(|group| !group.is_empty()) .flat_map(|group| { - let separator = std::iter::once(Separator::new(SeparatorType::Section).direction(SeparatorDirection::Vertical).widget_instance()); + let separator = std::iter::once(Separator::new(SeparatorStyle::Section).direction(SeparatorDirection::Vertical).widget_instance()); let buttons = group.into_iter().map(|ToolEntry { tooltip_label, tooltip_description, tooltip_shortcut, tool_type, icon_name }| { IconButton::new(icon_name, 32) .disabled(false) - .active(match tool_type { + .emphasized(match tool_type { ToolType::Line | ToolType::Ellipse | ToolType::Rectangle => { self.active_shape_type.is_some() && active_tool == tool_type } _ => active_tool == tool_type, }) @@ -533,7 +533,7 @@ impl HintData { for (index, hint_group) in self.0.iter().enumerate() { if index > 0 { - widgets.push(Separator::new(SeparatorType::Section).widget_instance()); + widgets.push(Separator::new(SeparatorStyle::Section).widget_instance()); } for hint in &hint_group.0 { if hint.plus { diff --git a/frontend/src/components/floating-menus/ColorPicker.svelte b/frontend/src/components/floating-menus/ColorPicker.svelte index a1566d1d97..ec88888848 100644 --- a/frontend/src/components/floating-menus/ColorPicker.svelte +++ b/frontend/src/components/floating-menus/ColorPicker.svelte @@ -529,7 +529,7 @@ {@const hexDescription = "Color code in hexadecimal format. 6 digits if opaque, 8 with alpha. Accepts input of CSS color values including named colors."} Hex - + RGB - + {#each rgbChannels as [channel, strength], index} {#if index > 0} - + {/if} HSV - + {#each hsvChannels as [channel, strength], index} {#if index > 0} - + {/if} {@const alphaDescription = "The level of translucency, from transparent (0%) to opaque (100%)."} Alpha - + - + {/if} - + - +