mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Add a workaround to prevent nudge resizing from giving lines a NaN scale (#2331)
* fix nudging the transform of 0 scaled object to `Nan` value by avoid division by zero vec2 * Update editor/src/messages/portfolio/document/document_message_handler.rs --------- Co-authored-by: indierusty <priyaayadav@gmail.com> Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
@@ -702,6 +702,9 @@ impl MessageHandler<DocumentMessage, DocumentMessageData<'_>> for DocumentMessag
|
||||
};
|
||||
|
||||
let size = existing_bottom_right - existing_top_left;
|
||||
// TODO: This is a hacky band-aid. It still results in the shape becoming zero-sized. Properly fix this using the correct math.
|
||||
// If size is zero we clamp it to minimun value to avoid dividing by zero vector to calculate enlargement.
|
||||
let size = size.max(DVec2::ONE);
|
||||
let enlargement = DVec2::new(
|
||||
if resize_opposite_corner != opposite_x { -delta_x } else { delta_x },
|
||||
if resize_opposite_corner != opposite_y { -delta_y } else { delta_y },
|
||||
|
||||
Reference in New Issue
Block a user