File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
editor/src/messages/tool/common_functionality Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -212,16 +212,15 @@ impl SelectedEdges {
212212 let original_from_pivot = updated - pivot; // The original vector from the point to the pivot
213213 let mut scale_factor = new_from_pivot / original_from_pivot;
214214
215- // Constrain should always scale by the same factor in x and y
215+ // Constrain should always scale by the same factor in x and y.
216+ // When one axis of `original_from_pivot` is near zero (e.g. for a line's degenerate bounding box),
217+ // the scale factor for that axis is numerically unstable, so we copy from the more stable axis.
216218 if constrain {
217- // When the point is on the pivot, we simply copy the other axis.
218- if original_from_pivot. x . abs ( ) < 1e-5 {
219+ if original_from_pivot. x . abs ( ) < original_from_pivot. y . abs ( ) {
219220 scale_factor. x = scale_factor. y ;
220- } else if original_from_pivot . y . abs ( ) < 1e-5 {
221+ } else {
221222 scale_factor. y = scale_factor. x ;
222223 }
223-
224- debug_assert ! ( ( scale_factor. x - scale_factor. y) . abs( ) < 1e-5 ) ;
225224 }
226225
227226 if !( self . left || self . right || constrain) {
You can’t perform that action at this time.
0 commit comments