mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-28 10:48:12 +08:00
Dialog redesign and content revamp (#1409)
* Revamp the content and design of dialogs * Add the Licenses dialog
This commit is contained in:
@@ -80,39 +80,40 @@ impl ToolMetadata for PathTool {
|
||||
|
||||
impl LayoutHolder for PathTool {
|
||||
fn layout(&self) -> Layout {
|
||||
if let Some(SingleSelectedPoint { coordinates: DVec2 { x, y }, .. }) = self.tool_data.single_selected_point {
|
||||
let x_location = NumberInput::new(Some(x))
|
||||
.unit(" px")
|
||||
.label("X")
|
||||
.min_width(120)
|
||||
.min(-((1u64 << std::f64::MANTISSA_DIGITS) as f64))
|
||||
.max((1u64 << std::f64::MANTISSA_DIGITS) as f64)
|
||||
.on_update(move |number_input: &NumberInput| {
|
||||
let new_x = number_input.value.unwrap_or(x);
|
||||
PathToolMessage::SelectedPointXChanged { new_x }.into()
|
||||
})
|
||||
.widget_holder();
|
||||
let coordinates = self.tool_data.single_selected_point.as_ref().map(|point| point.coordinates);
|
||||
let (x, y) = coordinates.map(|point| (Some(point.x), Some(point.y))).unwrap_or((None, None));
|
||||
|
||||
let y_location = NumberInput::new(Some(y))
|
||||
.unit(" px")
|
||||
.label("Y")
|
||||
.min_width(120)
|
||||
.min(-((1u64 << std::f64::MANTISSA_DIGITS) as f64))
|
||||
.max((1u64 << std::f64::MANTISSA_DIGITS) as f64)
|
||||
.on_update(move |number_input: &NumberInput| {
|
||||
let new_y = number_input.value.unwrap_or(y);
|
||||
PathToolMessage::SelectedPointYChanged { new_y }.into()
|
||||
})
|
||||
.widget_holder();
|
||||
let x_location = NumberInput::new(x)
|
||||
.unit(" px")
|
||||
.label("X")
|
||||
.min_width(120)
|
||||
.disabled(x.is_none())
|
||||
.min(-((1u64 << std::f64::MANTISSA_DIGITS) as f64))
|
||||
.max((1u64 << std::f64::MANTISSA_DIGITS) as f64)
|
||||
.on_update(move |number_input: &NumberInput| {
|
||||
let new_x = number_input.value.unwrap_or(x.unwrap());
|
||||
PathToolMessage::SelectedPointXChanged { new_x }.into()
|
||||
})
|
||||
.widget_holder();
|
||||
|
||||
let seperator = Separator::new(SeparatorType::Unrelated).widget_holder();
|
||||
let y_location = NumberInput::new(y)
|
||||
.unit(" px")
|
||||
.label("Y")
|
||||
.min_width(120)
|
||||
.disabled(y.is_none())
|
||||
.min(-((1u64 << std::f64::MANTISSA_DIGITS) as f64))
|
||||
.max((1u64 << std::f64::MANTISSA_DIGITS) as f64)
|
||||
.on_update(move |number_input: &NumberInput| {
|
||||
let new_y = number_input.value.unwrap_or(y.unwrap());
|
||||
PathToolMessage::SelectedPointYChanged { new_y }.into()
|
||||
})
|
||||
.widget_holder();
|
||||
|
||||
Layout::WidgetLayout(WidgetLayout::new(vec![LayoutGroup::Row {
|
||||
widgets: vec![x_location, seperator, y_location],
|
||||
}]))
|
||||
} else {
|
||||
Layout::WidgetLayout(WidgetLayout::default())
|
||||
}
|
||||
let seperator = Separator::new(SeparatorType::Related).widget_holder();
|
||||
|
||||
Layout::WidgetLayout(WidgetLayout::new(vec![LayoutGroup::Row {
|
||||
widgets: vec![x_location, seperator, y_location],
|
||||
}]))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -124,6 +124,8 @@ impl LayoutHolder for SelectTool {
|
||||
|
||||
let selected_layers_count = self.tool_data.selected_layers_count;
|
||||
let deactivate_alignment = selected_layers_count < 2;
|
||||
let deactivate_boolean_ops = selected_layers_count < 2;
|
||||
let deactivate_flip = selected_layers_count < 1;
|
||||
let deactivate_pivot = selected_layers_count < 1;
|
||||
|
||||
Layout::WidgetLayout(WidgetLayout::new(vec![LayoutGroup::Row {
|
||||
@@ -207,41 +209,48 @@ impl LayoutHolder for SelectTool {
|
||||
})
|
||||
.widget_holder(),
|
||||
Separator::new(SeparatorType::Related).widget_holder(),
|
||||
PopoverButton::new("Align", "Coming soon").widget_holder(),
|
||||
PopoverButton::new("Align", "Coming soon").disabled(deactivate_alignment).widget_holder(),
|
||||
Separator::new(SeparatorType::Section).widget_holder(),
|
||||
IconButton::new("FlipHorizontal", 24)
|
||||
.tooltip("Flip Horizontal")
|
||||
.disabled(deactivate_flip)
|
||||
.on_update(|_| SelectToolMessage::FlipHorizontal.into())
|
||||
.widget_holder(),
|
||||
IconButton::new("FlipVertical", 24)
|
||||
.tooltip("Flip Vertical")
|
||||
.disabled(deactivate_flip)
|
||||
.on_update(|_| SelectToolMessage::FlipVertical.into())
|
||||
.widget_holder(),
|
||||
Separator::new(SeparatorType::Related).widget_holder(),
|
||||
PopoverButton::new("Flip", "Coming soon").widget_holder(),
|
||||
PopoverButton::new("Flip", "Coming soon").disabled(deactivate_flip).widget_holder(),
|
||||
Separator::new(SeparatorType::Section).widget_holder(),
|
||||
IconButton::new("BooleanUnion", 24)
|
||||
.tooltip("Boolean Union (coming soon)")
|
||||
.tooltip("Coming Soon: Boolean Union")
|
||||
.disabled(deactivate_boolean_ops)
|
||||
.on_update(|_| DialogMessage::RequestComingSoonDialog { issue: Some(1091) }.into())
|
||||
.widget_holder(),
|
||||
IconButton::new("BooleanSubtractFront", 24)
|
||||
.tooltip("Boolean Subtract Front (coming soon)")
|
||||
.tooltip("Coming Soon: Boolean Subtract Front")
|
||||
.disabled(deactivate_boolean_ops)
|
||||
.on_update(|_| DialogMessage::RequestComingSoonDialog { issue: Some(1091) }.into())
|
||||
.widget_holder(),
|
||||
IconButton::new("BooleanSubtractBack", 24)
|
||||
.tooltip("Boolean Subtract Back (coming soon)")
|
||||
.tooltip("Coming Soon: Boolean Subtract Back")
|
||||
.disabled(deactivate_boolean_ops)
|
||||
.on_update(|_| DialogMessage::RequestComingSoonDialog { issue: Some(1091) }.into())
|
||||
.widget_holder(),
|
||||
IconButton::new("BooleanIntersect", 24)
|
||||
.tooltip("Boolean Intersect (coming soon)")
|
||||
.tooltip("Coming Soon: Boolean Intersect")
|
||||
.disabled(deactivate_boolean_ops)
|
||||
.on_update(|_| DialogMessage::RequestComingSoonDialog { issue: Some(1091) }.into())
|
||||
.widget_holder(),
|
||||
IconButton::new("BooleanDifference", 24)
|
||||
.tooltip("Boolean Difference (coming soon)")
|
||||
.tooltip("Coming Soon: Boolean Difference")
|
||||
.disabled(deactivate_boolean_ops)
|
||||
.on_update(|_| DialogMessage::RequestComingSoonDialog { issue: Some(1091) }.into())
|
||||
.widget_holder(),
|
||||
Separator::new(SeparatorType::Related).widget_holder(),
|
||||
PopoverButton::new("Boolean", "Coming soon").widget_holder(),
|
||||
PopoverButton::new("Boolean Operations", "Coming soon").disabled(deactivate_boolean_ops).widget_holder(),
|
||||
],
|
||||
}]))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user