|
1 | 1 | use crate::messages::layout::utility_types::widget_prelude::*;
|
| 2 | +use crate::messages::portfolio::document::node_graph::utility_types::GraphWireStyle; |
2 | 3 | use crate::messages::preferences::SelectionMode;
|
3 | 4 | use crate::messages::prelude::*;
|
4 | 5 |
|
@@ -32,6 +33,29 @@ impl PreferencesDialogMessageHandler {
|
32 | 33 | const TITLE: &'static str = "Editor Preferences";
|
33 | 34 |
|
34 | 35 | fn layout(&self, preferences: &PreferencesMessageHandler) -> Layout {
|
| 36 | + // ===== |
| 37 | + // INPUT |
| 38 | + // ===== |
| 39 | + |
| 40 | + let zoom_with_scroll_tooltip = "Use the scroll wheel for zooming instead of vertically panning (not recommended for trackpads)"; |
| 41 | + let input_section = vec![TextLabel::new("Input").italic(true).widget_holder()]; |
| 42 | + let zoom_with_scroll = vec![ |
| 43 | + CheckboxInput::new(preferences.zoom_with_scroll) |
| 44 | + .tooltip(zoom_with_scroll_tooltip) |
| 45 | + .on_update(|checkbox_input: &CheckboxInput| { |
| 46 | + PreferencesMessage::ModifyLayout { |
| 47 | + zoom_with_scroll: checkbox_input.checked, |
| 48 | + } |
| 49 | + .into() |
| 50 | + }) |
| 51 | + .widget_holder(), |
| 52 | + TextLabel::new("Zoom with Scroll").table_align(true).tooltip(zoom_with_scroll_tooltip).widget_holder(), |
| 53 | + ]; |
| 54 | + |
| 55 | + // ========= |
| 56 | + // SELECTION |
| 57 | + // ========= |
| 58 | + |
35 | 59 | let selection_section = vec![TextLabel::new("Selection").italic(true).widget_holder()];
|
36 | 60 | let selection_mode = RadioInput::new(vec![
|
37 | 61 | RadioEntryData::new(SelectionMode::Touched.to_string())
|
@@ -65,20 +89,28 @@ impl PreferencesDialogMessageHandler {
|
65 | 89 | .selected_index(Some(preferences.selection_mode as u32))
|
66 | 90 | .widget_holder();
|
67 | 91 |
|
68 |
| - let zoom_with_scroll_tooltip = "Use the scroll wheel for zooming instead of vertically panning (not recommended for trackpads)"; |
69 |
| - let input_section = vec![TextLabel::new("Input").italic(true).widget_holder()]; |
70 |
| - let zoom_with_scroll = vec![ |
71 |
| - CheckboxInput::new(preferences.zoom_with_scroll) |
72 |
| - .tooltip(zoom_with_scroll_tooltip) |
73 |
| - .on_update(|checkbox_input: &CheckboxInput| { |
74 |
| - PreferencesMessage::ModifyLayout { |
75 |
| - zoom_with_scroll: checkbox_input.checked, |
76 |
| - } |
77 |
| - .into() |
78 |
| - }) |
79 |
| - .widget_holder(), |
80 |
| - TextLabel::new("Zoom with Scroll").table_align(true).tooltip(zoom_with_scroll_tooltip).widget_holder(), |
81 |
| - ]; |
| 92 | + // ================ |
| 93 | + // NODE GRAPH WIRES |
| 94 | + // ================ |
| 95 | + |
| 96 | + let node_graph_section_tooltip = "Appearance of the wires running between node connections in the graph"; |
| 97 | + let node_graph_section = vec![TextLabel::new("Node Graph Wires").tooltip(node_graph_section_tooltip).italic(true).widget_holder()]; |
| 98 | + let graph_wire_style = RadioInput::new(vec![ |
| 99 | + RadioEntryData::new(GraphWireStyle::GridAligned.to_string()) |
| 100 | + .label(GraphWireStyle::GridAligned.to_string()) |
| 101 | + .tooltip(GraphWireStyle::GridAligned.tooltip_description()) |
| 102 | + .on_update(move |_| PreferencesMessage::GraphWireStyle { style: GraphWireStyle::GridAligned }.into()), |
| 103 | + RadioEntryData::new(GraphWireStyle::Direct.to_string()) |
| 104 | + .label(GraphWireStyle::Direct.to_string()) |
| 105 | + .tooltip(GraphWireStyle::Direct.tooltip_description()) |
| 106 | + .on_update(move |_| PreferencesMessage::GraphWireStyle { style: GraphWireStyle::Direct }.into()), |
| 107 | + ]) |
| 108 | + .selected_index(Some(preferences.graph_wire_style as u32)) |
| 109 | + .widget_holder(); |
| 110 | + |
| 111 | + // ============ |
| 112 | + // EXPERIMENTAL |
| 113 | + // ============ |
82 | 114 |
|
83 | 115 | let vello_tooltip = "Use the experimental Vello renderer (your browser must support WebGPU)";
|
84 | 116 | let renderer_section = vec![TextLabel::new("Experimental").italic(true).widget_holder()];
|
@@ -126,10 +158,12 @@ impl PreferencesDialogMessageHandler {
|
126 | 158 | // ];
|
127 | 159 |
|
128 | 160 | Layout::WidgetLayout(WidgetLayout::new(vec![
|
129 |
| - LayoutGroup::Row { widgets: selection_section }, |
130 |
| - LayoutGroup::Row { widgets: vec![selection_mode] }, |
131 | 161 | LayoutGroup::Row { widgets: input_section },
|
132 | 162 | LayoutGroup::Row { widgets: zoom_with_scroll },
|
| 163 | + LayoutGroup::Row { widgets: selection_section }, |
| 164 | + LayoutGroup::Row { widgets: vec![selection_mode] }, |
| 165 | + LayoutGroup::Row { widgets: node_graph_section }, |
| 166 | + LayoutGroup::Row { widgets: vec![graph_wire_style] }, |
133 | 167 | LayoutGroup::Row { widgets: renderer_section },
|
134 | 168 | LayoutGroup::Row { widgets: use_vello },
|
135 | 169 | LayoutGroup::Row { widgets: vector_meshes },
|
|
0 commit comments