Ver Fonte

Internal: simplified resizing logic.

Marek Lewandowski há 6 anos atrás
pai
commit
584ebe714a
1 ficheiros alterados com 4 adições e 19 exclusões
  1. 4 19
      packages/ckeditor5-widget/src/resizecontext.js

+ 4 - 19
packages/ckeditor5-widget/src/resizecontext.js

@@ -171,26 +171,11 @@ export default class ResizeContext {
 		const yDistance = this.referenceCoordinates.y - currentCoordinates.y;
 
 		if ( this.referenceHandlerPosition.includes( 'bottom-' ) ) {
-			if ( yDistance < 0 ) {
-				// enlarging
-				this.domResizeShadow.style.bottom = `${ yDistance }px`;
-				this.domResizeShadow.style.right = `${ yDistance * this.aspectRatio }px`;
-			} else {
-				// shrinking
-				this.domResizeShadow.style.bottom = `${ yDistance }px`;
-				this.domResizeShadow.style.right = `${ yDistance * this.aspectRatio }px`;
-			}
+			this.domResizeShadow.style.bottom = `${ yDistance }px`;
+			this.domResizeShadow.style.right = `${ yDistance * this.aspectRatio }px`;
 		} else {
-			// default handler: top-left.
-			if ( yDistance > 0 ) {
-				// enlarging
-				this.domResizeShadow.style.top = ( yDistance * -1 ) + 'px';
-				this.domResizeShadow.style.left = ( yDistance * this.aspectRatio * -1 ) + 'px';
-			} else {
-				// shrinking
-				this.domResizeShadow.style.top = ( yDistance * -1 ) + 'px';
-				this.domResizeShadow.style.left = ( yDistance * this.aspectRatio * -1 ) + 'px';
-			}
+			this.domResizeShadow.style.top = ( yDistance * -1 ) + 'px';
+			this.domResizeShadow.style.left = ( yDistance * this.aspectRatio * -1 ) + 'px';
 		}
 	}