diff --git a/core/editor/src/tools/rectangle.rs b/core/editor/src/tools/rectangle.rs index 3bc4e2612..3be9b3b28 100644 --- a/core/editor/src/tools/rectangle.rs +++ b/core/editor/src/tools/rectangle.rs @@ -143,7 +143,14 @@ fn make_operation(data: &RectangleToolData, tool_data: &DocumentToolData) -> Ope (x0, y0, x0 + max_dist * x_dir, y0 + max_dist * y_dir) } } else { - let (x0, y0) = if data.center_around_cursor { (x0 - 2.0 * (x1 - x0), y0 - 2.0 * (y1 - y0)) } else { (x0, y0) }; + let (x0, y0) = if data.center_around_cursor { + let delta_x = x1 - x0; + let delta_y = y1 - y0; + + (x0 - delta_x, y0 - delta_y) + } else { + (x0, y0) + }; (x0, y0, x1, y1) }; diff --git a/core/editor/src/tools/shape.rs b/core/editor/src/tools/shape.rs index dddfb09ec..4f6d232bb 100644 --- a/core/editor/src/tools/shape.rs +++ b/core/editor/src/tools/shape.rs @@ -145,7 +145,14 @@ fn make_operation(data: &ShapeToolData, tool_data: &DocumentToolData) -> Operati (x0, y0, x0 + max_dist * x_dir, y0 + max_dist * y_dir) } } else { - let (x0, y0) = if data.center_around_cursor { (x0 - 2.0 * (x1 - x0), y0 - 2.0 * (y1 - y0)) } else { (x0, y0) }; + let (x0, y0) = if data.center_around_cursor { + let delta_x = x1 - x0; + let delta_y = y1 - y0; + + (x0 - delta_x, y0 - delta_y) + } else { + (x0, y0) + }; (x0, y0, x1, y1) };