mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-28 08:38:11 +08:00
Disallow zero-area artboards (#794)
* Fix zero-area artboard
* Add artboard only when user starts dragging
* Rename variables for clarity
* Revert regression caused by commit a11c9ef6ef
* Fix zero-area artboard properly
This commit is contained in:
committed by
Keavon Chambers
parent
7b4c43ff8d
commit
b10d7a93b6
@@ -94,7 +94,14 @@ impl MessageHandler<ArtboardMessage, &FontCache> for ArtboardMessageHandler {
|
||||
);
|
||||
}
|
||||
}
|
||||
ResizeArtboard { artboard, position, size } => {
|
||||
ResizeArtboard { artboard, position, mut size } => {
|
||||
if size.0.abs() == 0. {
|
||||
size.0 = size.0.signum();
|
||||
}
|
||||
if size.1.abs() == 0. {
|
||||
size.1 = size.1.signum();
|
||||
}
|
||||
|
||||
responses.push_back(
|
||||
ArtboardMessage::DispatchOperation(Box::new(DocumentOperation::SetLayerTransform {
|
||||
path: vec![artboard],
|
||||
|
||||
@@ -147,6 +147,8 @@ pub fn register_artboard_layer_properties(layer: &Layer, responses: &mut VecDequ
|
||||
value: Some(layer.bounding_transform(&persistent_data.font_cache).scale_x()),
|
||||
label: "W".into(),
|
||||
unit: " px".into(),
|
||||
is_integer: true,
|
||||
min: Some(1.),
|
||||
on_update: WidgetCallback::new(|number_input: &NumberInput| {
|
||||
PropertiesPanelMessage::ModifyTransform {
|
||||
value: number_input.value.unwrap(),
|
||||
@@ -164,6 +166,8 @@ pub fn register_artboard_layer_properties(layer: &Layer, responses: &mut VecDequ
|
||||
value: Some(layer.bounding_transform(&persistent_data.font_cache).scale_y()),
|
||||
label: "H".into(),
|
||||
unit: " px".into(),
|
||||
is_integer: true,
|
||||
min: Some(1.),
|
||||
on_update: WidgetCallback::new(|number_input: &NumberInput| {
|
||||
PropertiesPanelMessage::ModifyTransform {
|
||||
value: number_input.value.unwrap(),
|
||||
|
||||
Reference in New Issue
Block a user