diff --git a/editor/src/messages/portfolio/document/document_message_handler.rs b/editor/src/messages/portfolio/document/document_message_handler.rs index 10b11790..99f4ab12 100644 --- a/editor/src/messages/portfolio/document/document_message_handler.rs +++ b/editor/src/messages/portfolio/document/document_message_handler.rs @@ -702,6 +702,9 @@ impl MessageHandler> 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 },