33 VERTICAL_DIRECTIONS ,
44 ALL_DIRECTIONS ,
55} from './constants' ;
6+
67import { MoveEvent } from './events' ;
78
89
@@ -30,6 +31,7 @@ function fitConditions({ directions: oldDirections, coordinates, restrictions, p
3031 let currentWidth = getCurrentWidth ( coordinates , directions ) ;
3132 let currentHeight = getCurrentHeight ( coordinates , directions ) ;
3233
34+ // Prevent strange resizes when the width or height of stencil becomes smaller than 0
3335 if ( currentWidth < 0 ) {
3436 if ( directions . left < 0 && directions . right < 0 ) {
3537 directions . left = - ( coordinates . width - restrictions . minWidth ) / ( directions . left / directions . right ) ;
@@ -40,7 +42,6 @@ function fitConditions({ directions: oldDirections, coordinates, restrictions, p
4042 directions . right = - ( coordinates . width - restrictions . minWidth ) ;
4143 }
4244 }
43-
4445 if ( currentHeight < 0 ) {
4546 if ( directions . top < 0 && directions . bottom < 0 ) {
4647 directions . top = - ( coordinates . height - restrictions . minHeight ) / ( directions . top / directions . bottom ) ;
@@ -52,9 +53,9 @@ function fitConditions({ directions: oldDirections, coordinates, restrictions, p
5253 }
5354 }
5455
56+ // Prevent breaking limits
5557 let breaks = getBrokenLimits ( coordinates , directions , allowedArea ) ;
5658
57-
5859 if ( mode === 'move' ) {
5960 if ( breaks . left > 0 && breaks . right === 0 ) {
6061 directions . right += breaks . left ;
@@ -88,8 +89,6 @@ function fitConditions({ directions: oldDirections, coordinates, restrictions, p
8889 }
8990 } ) ;
9091
91-
92-
9392 if ( preserveAspectRatio ) {
9493 const multiplier = Math . min ( ...ALL_DIRECTIONS . map ( direction => maxResize [ direction ] ) ) ;
9594 if ( multiplier !== Infinity ) {
0 commit comments