Rename WidgetHolder to WidgetInstance

This commit is contained in:
Keavon Chambers
2025-12-04 01:10:22 -08:00
parent 810ce40e9b
commit 4581689d9c
36 changed files with 647 additions and 644 deletions
@@ -107,8 +107,8 @@ impl LayoutHolder for BrushTool {
.max(BRUSH_MAX_SIZE) /* Anything bigger would cause the application to be unresponsive and eventually die */
.unit(" px")
.on_update(|number_input: &NumberInput| BrushToolMessage::UpdateOptions { options: BrushToolMessageOptionsUpdate::Diameter(number_input.value.unwrap()) }.into())
.widget_holder(),
Separator::new(SeparatorType::Related).widget_holder(),
.widget_instance(),
Separator::new(SeparatorType::Related).widget_instance(),
NumberInput::new(Some(self.options.hardness))
.label("Hardness")
.min(0.)
@@ -121,8 +121,8 @@ impl LayoutHolder for BrushTool {
}
.into()
})
.widget_holder(),
Separator::new(SeparatorType::Related).widget_holder(),
.widget_instance(),
Separator::new(SeparatorType::Related).widget_instance(),
NumberInput::new(Some(self.options.flow))
.label("Flow")
.min(1.)
@@ -135,8 +135,8 @@ impl LayoutHolder for BrushTool {
}
.into()
})
.widget_holder(),
Separator::new(SeparatorType::Related).widget_holder(),
.widget_instance(),
Separator::new(SeparatorType::Related).widget_instance(),
NumberInput::new(Some(self.options.spacing))
.label("Spacing")
.min(1.)
@@ -149,10 +149,10 @@ impl LayoutHolder for BrushTool {
}
.into()
})
.widget_holder(),
.widget_instance(),
];
widgets.push(Separator::new(SeparatorType::Unrelated).widget_holder());
widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance());
let draw_mode_entries: Vec<_> = [DrawMode::Draw, DrawMode::Erase, DrawMode::Restore]
.into_iter()
@@ -165,9 +165,9 @@ impl LayoutHolder for BrushTool {
})
})
.collect();
widgets.push(RadioInput::new(draw_mode_entries).selected_index(Some(self.options.draw_mode as u32)).widget_holder());
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_holder());
widgets.push(Separator::new(SeparatorType::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_holder());
widgets.push(Separator::new(SeparatorType::Related).widget_instance());
let blend_mode_entries: Vec<Vec<_>> = BlendMode::list()
.iter()
@@ -217,7 +217,7 @@ impl LayoutHolder for BrushTool {
.selected_index(self.options.blend_mode.index_in_list().map(|index| index as u32))
.tooltip_description("The blend mode used with the background when performing a brush stroke. Only used in draw mode.")
.disabled(self.options.draw_mode != DrawMode::Draw)
.widget_holder(),
.widget_instance(),
);
Layout::WidgetLayout(WidgetLayout::new(vec![LayoutGroup::Row { widgets }]))
@@ -80,7 +80,7 @@ impl ToolMetadata for FreehandTool {
}
}
fn create_weight_widget(line_weight: f64) -> WidgetHolder {
fn create_weight_widget(line_weight: f64) -> WidgetInstance {
NumberInput::new(Some(line_weight))
.unit(" px")
.label("Weight")
@@ -92,7 +92,7 @@ fn create_weight_widget(line_weight: f64) -> WidgetHolder {
}
.into()
})
.widget_holder()
.widget_instance()
}
impl LayoutHolder for FreehandTool {
@@ -122,7 +122,7 @@ impl LayoutHolder for FreehandTool {
},
);
widgets.push(Separator::new(SeparatorType::Unrelated).widget_holder());
widgets.push(Separator::new(SeparatorType::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_holder());
widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance());
widgets.push(create_weight_widget(self.options.line_weight));
Layout::WidgetLayout(WidgetLayout::new(vec![LayoutGroup::Row { widgets }]))
@@ -105,7 +105,7 @@ impl LayoutHolder for GradientTool {
}),
])
.selected_index(Some((self.selected_gradient().unwrap_or(self.options.gradient_type) == GradientType::Radial) as u32))
.widget_holder();
.widget_instance();
Layout::WidgetLayout(WidgetLayout::new(vec![LayoutGroup::Row { widgets: vec![gradient_type] }]))
}
@@ -215,7 +215,7 @@ impl LayoutHolder for PathTool {
Message::NoOp
}
})
.widget_holder();
.widget_instance();
let y_location = NumberInput::new(y)
.unit(" px")
@@ -231,10 +231,10 @@ impl LayoutHolder for PathTool {
Message::NoOp
}
})
.widget_holder();
.widget_instance();
let related_seperator = Separator::new(SeparatorType::Related).widget_holder();
let unrelated_seperator = Separator::new(SeparatorType::Unrelated).widget_holder();
let related_seperator = Separator::new(SeparatorType::Related).widget_instance();
let unrelated_seperator = Separator::new(SeparatorType::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 {
@@ -257,13 +257,13 @@ impl LayoutHolder for PathTool {
.tooltip_label("Colinear Handles")
.tooltip_description(colinear_handles_description)
.for_label(checkbox_id)
.widget_holder();
.widget_instance();
let colinear_handles_label = TextLabel::new("Colinear Handles")
.disabled(!self.tool_data.can_toggle_colinearity)
.tooltip_label("Colinear Handles")
.tooltip_description(colinear_handles_description)
.for_checkbox(checkbox_id)
.widget_holder();
.widget_instance();
let point_editing_mode = CheckboxInput::new(self.options.path_editing_mode.point_editing_mode)
// TODO(Keavon): Replace with a real icon
@@ -272,7 +272,7 @@ impl LayoutHolder for PathTool {
.tooltip_description("To multi-select modes, perform the shortcut shown.")
.tooltip_shortcut(action_shortcut_manual!(Key::Shift, Key::MouseLeft))
.on_update(|_| PathToolMessage::TogglePointEditing.into())
.widget_holder();
.widget_instance();
let segment_editing_mode = CheckboxInput::new(self.options.path_editing_mode.segment_editing_mode)
// TODO(Keavon): Replace with a real icon
.icon("Remove")
@@ -280,7 +280,7 @@ impl LayoutHolder for PathTool {
.tooltip_description("To multi-select modes, perform the shortcut shown.")
.tooltip_shortcut(action_shortcut_manual!(Key::Shift, Key::MouseLeft))
.on_update(|_| PathToolMessage::ToggleSegmentEditing.into())
.widget_holder();
.widget_instance();
let path_overlay_mode_widget = RadioInput::new(vec![
RadioEntryData::new("all")
@@ -315,7 +315,7 @@ impl LayoutHolder for PathTool {
}),
])
.selected_index(Some(self.options.path_overlay_mode as u32))
.widget_holder();
.widget_instance();
// Works only if a single layer is selected and its type is Vector
let path_node_button = TextButton::new("Make Path Editable")
@@ -326,7 +326,7 @@ impl LayoutHolder for PathTool {
)
.on_update(|_| NodeGraphMessage::AddPathNode.into())
.disabled(!self.tool_data.make_path_editable_is_allowed)
.widget_holder();
.widget_instance();
let [_checkbox, _dropdown] = {
let pivot_gizmo_type_widget = pivot_gizmo_type_widget(self.tool_data.pivot_gizmo.state, PivotToolSource::Path);
@@ -136,7 +136,7 @@ impl ToolMetadata for PenTool {
}
}
fn create_weight_widget(line_weight: f64) -> WidgetHolder {
fn create_weight_widget(line_weight: f64) -> WidgetInstance {
NumberInput::new(Some(line_weight))
.unit(" px")
.label("Weight")
@@ -148,7 +148,7 @@ fn create_weight_widget(line_weight: f64) -> WidgetHolder {
}
.into()
})
.widget_holder()
.widget_instance()
}
impl LayoutHolder for PenTool {
@@ -178,7 +178,7 @@ impl LayoutHolder for PenTool {
},
);
widgets.push(Separator::new(SeparatorType::Unrelated).widget_holder());
widgets.push(Separator::new(SeparatorType::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_holder());
widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance());
widgets.push(create_weight_widget(self.options.line_weight));
widgets.push(Separator::new(SeparatorType::Unrelated).widget_holder());
widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance());
widgets.push(
RadioInput::new(vec![
@@ -235,7 +235,7 @@ impl LayoutHolder for PenTool {
}),
])
.selected_index(Some(self.options.pen_overlay_mode as u32))
.widget_holder(),
.widget_instance(),
);
Layout::WidgetLayout(WidgetLayout::new(vec![LayoutGroup::Row { widgets }]))
@@ -131,7 +131,7 @@ impl ToolMetadata for SelectTool {
}
impl SelectTool {
fn deep_selection_widget(&self) -> WidgetHolder {
fn deep_selection_widget(&self) -> WidgetInstance {
let layer_selection_behavior_entries = [NestedSelectionBehavior::Shallowest, NestedSelectionBehavior::Deepest]
.iter()
.map(|mode| {
@@ -151,10 +151,10 @@ impl SelectTool {
"Shallow Select: clicks initially select the least-nested layers and double clicks drill deeper into the folder hierarchy.\n\
Deep Select: clicks directly select the most-nested layers in the folder hierarchy.",
)
.widget_holder()
.widget_instance()
}
fn alignment_widgets(&self, disabled: bool) -> impl Iterator<Item = WidgetHolder> + use<> {
fn alignment_widgets(&self, disabled: bool) -> impl Iterator<Item = WidgetInstance> + use<> {
[AlignAxis::X, AlignAxis::Y]
.into_iter()
.flat_map(|axis| [(axis, AlignAggregate::Min), (axis, AlignAggregate::Center), (axis, AlignAggregate::Max)])
@@ -171,11 +171,11 @@ impl SelectTool {
.tooltip_label(label)
.on_update(move |_| DocumentMessage::AlignSelectedLayers { axis, aggregate }.into())
.disabled(disabled)
.widget_holder()
.widget_instance()
})
}
fn flip_widgets(&self, disabled: bool) -> impl Iterator<Item = WidgetHolder> + use<> {
fn flip_widgets(&self, disabled: bool) -> impl Iterator<Item = WidgetInstance> + use<> {
[(FlipAxis::X, "FlipHorizontal", "Flip Horizontal"), (FlipAxis::Y, "FlipVertical", "Flip Vertical")]
.into_iter()
.map(move |(flip_axis, icon, label)| {
@@ -183,11 +183,11 @@ impl SelectTool {
.tooltip_label(label)
.on_update(move |_| DocumentMessage::FlipSelectedLayers { flip_axis }.into())
.disabled(disabled)
.widget_holder()
.widget_instance()
})
}
fn turn_widgets(&self, disabled: bool) -> impl Iterator<Item = WidgetHolder> + use<> {
fn turn_widgets(&self, disabled: bool) -> impl Iterator<Item = WidgetInstance> + use<> {
[(-90., "TurnNegative90", "Turn -90°"), (90., "TurnPositive90", "Turn 90°")]
.into_iter()
.map(move |(degrees, icon, label)| {
@@ -195,11 +195,11 @@ impl SelectTool {
.tooltip_label(label)
.on_update(move |_| DocumentMessage::RotateSelectedLayers { degrees }.into())
.disabled(disabled)
.widget_holder()
.widget_instance()
})
}
fn boolean_widgets(&self, selected_count: usize) -> impl Iterator<Item = WidgetHolder> + use<> {
fn boolean_widgets(&self, selected_count: usize) -> impl Iterator<Item = WidgetInstance> + use<> {
let list = <BooleanOperation as graphene_std::choice_type::ChoiceTypeStatic>::list();
list.iter().flat_map(|i| i.iter()).map(move |(operation, info)| {
IconButton::new(info.icon.unwrap(), 24)
@@ -210,7 +210,7 @@ impl SelectTool {
let group_folder_type = GroupFolderType::BooleanOperation(*operation);
DocumentMessage::GroupSelectedLayers { group_folder_type }.into()
})
.widget_holder()
.widget_instance()
})
}
}
@@ -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_holder());
widgets.push(Separator::new(SeparatorType::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_holder());
widgets.push(Separator::new(SeparatorType::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_holder());
widgets.push(Separator::new(SeparatorType::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,33 +248,33 @@ impl LayoutHolder for SelectTool {
// Align
let disabled = self.tool_data.selected_layers_count < 2;
widgets.push(Separator::new(SeparatorType::Unrelated).widget_holder());
widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance());
widgets.extend(self.alignment_widgets(disabled));
// widgets.push(
// PopoverButton::new()
// .popover_layout(vec![
// LayoutGroup::Row {
// widgets: vec![TextLabel::new("Align").bold(true).widget_holder()],
// widgets: vec![TextLabel::new("Align").bold(true).widget_instance()],
// },
// LayoutGroup::Row {
// widgets: vec![TextLabel::new("Coming soon").widget_holder()],
// widgets: vec![TextLabel::new("Coming soon").widget_instance()],
// },
// ])
// .disabled(disabled)
// .widget_holder(),
// .widget_instance(),
// );
// Flip
let disabled = self.tool_data.selected_layers_count == 0;
widgets.push(Separator::new(SeparatorType::Unrelated).widget_holder());
widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance());
widgets.extend(self.flip_widgets(disabled));
// Turn
widgets.push(Separator::new(SeparatorType::Unrelated).widget_holder());
widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance());
widgets.extend(self.turn_widgets(disabled));
// Boolean
widgets.push(Separator::new(SeparatorType::Unrelated).widget_holder());
widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance());
widgets.extend(self.boolean_widgets(self.tool_data.selected_layers_count));
Layout::WidgetLayout(WidgetLayout::new(vec![LayoutGroup::Row { widgets }]))
@@ -100,7 +100,7 @@ pub enum ShapeToolMessage {
NudgeSelectedLayers { delta_x: f64, delta_y: f64, resize: Key, resize_opposite_corner: Key },
}
fn create_sides_widget(vertices: u32) -> WidgetHolder {
fn create_sides_widget(vertices: u32) -> WidgetInstance {
NumberInput::new(Some(vertices as f64))
.label("Sides")
.int()
@@ -113,10 +113,10 @@ fn create_sides_widget(vertices: u32) -> WidgetHolder {
}
.into()
})
.widget_holder()
.widget_instance()
}
fn create_turns_widget(turns: f64) -> WidgetHolder {
fn create_turns_widget(turns: f64) -> WidgetInstance {
NumberInput::new(Some(turns))
.label("Turns")
.min(0.5)
@@ -127,10 +127,10 @@ fn create_turns_widget(turns: f64) -> WidgetHolder {
}
.into()
})
.widget_holder()
.widget_instance()
}
fn create_shape_option_widget(shape_type: ShapeType) -> WidgetHolder {
fn create_shape_option_widget(shape_type: ShapeType) -> WidgetInstance {
let entries = vec![vec![
MenuListEntry::new("Polygon").label("Polygon").on_commit(move |_| {
ShapeToolMessage::UpdateOptions {
@@ -169,10 +169,10 @@ fn create_shape_option_widget(shape_type: ShapeType) -> WidgetHolder {
.into()
}),
]];
DropdownInput::new(entries).selected_index(Some(shape_type as u32)).widget_holder()
DropdownInput::new(entries).selected_index(Some(shape_type as u32)).widget_instance()
}
fn create_arc_type_widget(arc_type: ArcType) -> WidgetHolder {
fn create_arc_type_widget(arc_type: ArcType) -> WidgetInstance {
let entries = vec![
RadioEntryData::new("Open").label("Open").on_update(move |_| {
ShapeToolMessage::UpdateOptions {
@@ -193,10 +193,10 @@ fn create_arc_type_widget(arc_type: ArcType) -> WidgetHolder {
.into()
}),
];
RadioInput::new(entries).selected_index(Some(arc_type as u32)).widget_holder()
RadioInput::new(entries).selected_index(Some(arc_type as u32)).widget_instance()
}
fn create_weight_widget(line_weight: f64) -> WidgetHolder {
fn create_weight_widget(line_weight: f64) -> WidgetInstance {
NumberInput::new(Some(line_weight))
.unit(" px")
.label("Weight")
@@ -208,10 +208,10 @@ fn create_weight_widget(line_weight: f64) -> WidgetHolder {
}
.into()
})
.widget_holder()
.widget_instance()
}
fn create_spiral_type_widget(spiral_type: SpiralType) -> WidgetHolder {
fn create_spiral_type_widget(spiral_type: SpiralType) -> WidgetInstance {
let entries = vec![vec![
MenuListEntry::new("Archimedean").label("Archimedean").on_commit(move |_| {
ShapeToolMessage::UpdateOptions {
@@ -226,10 +226,10 @@ fn create_spiral_type_widget(spiral_type: SpiralType) -> WidgetHolder {
.into()
}),
]];
DropdownInput::new(entries).selected_index(Some(spiral_type as u32)).widget_holder()
DropdownInput::new(entries).selected_index(Some(spiral_type as u32)).widget_instance()
}
fn create_grid_type_widget(grid_type: GridType) -> WidgetHolder {
fn create_grid_type_widget(grid_type: GridType) -> WidgetInstance {
let entries = vec![
RadioEntryData::new("Rectangular").label("Rectangular").on_update(move |_| {
ShapeToolMessage::UpdateOptions {
@@ -244,7 +244,7 @@ fn create_grid_type_widget(grid_type: GridType) -> WidgetHolder {
.into()
}),
];
RadioInput::new(entries).selected_index(Some(grid_type as u32)).widget_holder()
RadioInput::new(entries).selected_index(Some(grid_type as u32)).widget_instance()
}
impl LayoutHolder for ShapeTool {
@@ -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_holder());
widgets.push(Separator::new(SeparatorType::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_holder());
widgets.push(Separator::new(SeparatorType::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_holder());
widgets.push(Separator::new(SeparatorType::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_holder());
widgets.push(Separator::new(SeparatorType::Related).widget_instance());
widgets.push(create_turns_widget(self.options.turns));
widgets.push(Separator::new(SeparatorType::Unrelated).widget_holder());
widgets.push(Separator::new(SeparatorType::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_holder());
widgets.push(Separator::new(SeparatorType::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_holder());
widgets.push(Separator::new(SeparatorType::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_holder());
widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance());
widgets.push(create_weight_widget(self.options.line_weight));
Layout::WidgetLayout(WidgetLayout::new(vec![LayoutGroup::Row { widgets }]))
@@ -87,7 +87,7 @@ impl ToolMetadata for SplineTool {
}
}
fn create_weight_widget(line_weight: f64) -> WidgetHolder {
fn create_weight_widget(line_weight: f64) -> WidgetInstance {
NumberInput::new(Some(line_weight))
.unit(" px")
.label("Weight")
@@ -99,7 +99,7 @@ fn create_weight_widget(line_weight: f64) -> WidgetHolder {
}
.into()
})
.widget_holder()
.widget_instance()
}
impl LayoutHolder for SplineTool {
@@ -129,7 +129,7 @@ impl LayoutHolder for SplineTool {
},
);
widgets.push(Separator::new(SeparatorType::Unrelated).widget_holder());
widgets.push(Separator::new(SeparatorType::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_holder());
widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance());
widgets.push(create_weight_widget(self.options.line_weight));
Layout::WidgetLayout(WidgetLayout::new(vec![LayoutGroup::Row { widgets }]))
@@ -96,7 +96,7 @@ impl ToolMetadata for TextTool {
}
}
fn create_text_widgets(tool: &TextTool) -> Vec<WidgetHolder> {
fn create_text_widgets(tool: &TextTool) -> Vec<WidgetInstance> {
let font = FontInput::new(&tool.options.font_name, &tool.options.font_style)
.is_style_picker(false)
.on_update(|font_input: &FontInput| {
@@ -108,7 +108,7 @@ fn create_text_widgets(tool: &TextTool) -> Vec<WidgetHolder> {
}
.into()
})
.widget_holder();
.widget_instance();
let style = FontInput::new(&tool.options.font_name, &tool.options.font_style)
.is_style_picker(true)
.on_update(|font_input: &FontInput| {
@@ -120,7 +120,7 @@ fn create_text_widgets(tool: &TextTool) -> Vec<WidgetHolder> {
}
.into()
})
.widget_holder();
.widget_instance();
let size = NumberInput::new(Some(tool.options.font_size))
.unit(" px")
.label("Size")
@@ -133,7 +133,7 @@ fn create_text_widgets(tool: &TextTool) -> Vec<WidgetHolder> {
}
.into()
})
.widget_holder();
.widget_instance();
let line_height_ratio = NumberInput::new(Some(tool.options.line_height_ratio))
.label("Line Height")
.int()
@@ -146,7 +146,7 @@ fn create_text_widgets(tool: &TextTool) -> Vec<WidgetHolder> {
}
.into()
})
.widget_holder();
.widget_instance();
let align_entries: Vec<_> = [TextAlign::Left, TextAlign::Center, TextAlign::Right, TextAlign::JustifyLeft]
.into_iter()
.map(|align| {
@@ -158,16 +158,16 @@ fn create_text_widgets(tool: &TextTool) -> Vec<WidgetHolder> {
})
})
.collect();
let align = RadioInput::new(align_entries).selected_index(Some(tool.options.align as u32)).widget_holder();
let align = RadioInput::new(align_entries).selected_index(Some(tool.options.align as u32)).widget_instance();
vec![
font,
Separator::new(SeparatorType::Related).widget_holder(),
Separator::new(SeparatorType::Related).widget_instance(),
style,
Separator::new(SeparatorType::Related).widget_holder(),
Separator::new(SeparatorType::Related).widget_instance(),
size,
Separator::new(SeparatorType::Related).widget_holder(),
Separator::new(SeparatorType::Related).widget_instance(),
line_height_ratio,
Separator::new(SeparatorType::Related).widget_holder(),
Separator::new(SeparatorType::Related).widget_instance(),
align,
]
}
@@ -176,7 +176,7 @@ impl LayoutHolder for TextTool {
fn layout(&self) -> Layout {
let mut widgets = create_text_widgets(self);
widgets.push(Separator::new(SeparatorType::Unrelated).widget_holder());
widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance());
widgets.append(&mut self.options.fill.create_widgets(
"Fill",