|
|
@@ -4,7 +4,6 @@ import {
|
|
|
|
|
|
import ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin';
|
|
|
import mix from '@ckeditor/ckeditor5-utils/src/mix';
|
|
|
-import global from '@ckeditor/ckeditor5-utils/src/dom/global';
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
@@ -92,13 +91,6 @@ export default class ResizerTopBound {
|
|
|
}
|
|
|
|
|
|
const resizeHost = this.context._getResizeHost();
|
|
|
- const clientRect = resizeHost.getBoundingClientRect();
|
|
|
-
|
|
|
- // The size of currently visible resize host.
|
|
|
- const currentSize = {
|
|
|
- x: clientRect.width,
|
|
|
- y: clientRect.height
|
|
|
- };
|
|
|
|
|
|
const proposedSize = {
|
|
|
x: Math.abs( initialSize.width + enlargement.x ),
|
|
|
@@ -120,44 +112,15 @@ export default class ResizerTopBound {
|
|
|
drawnSize.x = drawnSize.y * context.aspectRatio;
|
|
|
}
|
|
|
|
|
|
- const resizeUsingImage = global.window.pocResizeUsingImage !== false;
|
|
|
- let shadowBoundValue = '0px';
|
|
|
-
|
|
|
- if ( !resizeUsingImage ) {
|
|
|
- shadowBoundValue = 'auto';
|
|
|
- }
|
|
|
-
|
|
|
- // Reset shadow bounding.
|
|
|
- context.domResizeShadow.style.top = shadowBoundValue;
|
|
|
- context.domResizeShadow.style.left = shadowBoundValue;
|
|
|
- context.domResizeShadow.style.bottom = shadowBoundValue;
|
|
|
- context.domResizeShadow.style.right = shadowBoundValue;
|
|
|
-
|
|
|
- if ( resizeUsingImage ) {
|
|
|
- resizeHost.style.width = `${ drawnSize.x }px`;
|
|
|
- // resizeHost.style.height = `${ drawnSize.y }px`;
|
|
|
+ resizeHost.style.width = `${ drawnSize.x }px`;
|
|
|
+ // resizeHost.style.height = `${ drawnSize.y }px`;
|
|
|
|
|
|
- const latestRect = resizeHost.getBoundingClientRect();
|
|
|
+ // Refresh values based on real image. Real image might be limited by max-width, and thus fetching it
|
|
|
+ // here will reflect this limitation on resizer shadow later on.
|
|
|
+ const latestRect = resizeHost.getBoundingClientRect();
|
|
|
|
|
|
- // Refresh values based on real image. Real image might be limited by max-width, and thus fetching it
|
|
|
- // here will reflect this limitation on resizer shadow later on.
|
|
|
- drawnSize.x = latestRect.width;
|
|
|
- drawnSize.y = latestRect.height;
|
|
|
- } else {
|
|
|
- const invertedPosition = this.context._invertPosition( context.referenceHandlerPosition );
|
|
|
-
|
|
|
- const diff2 = {
|
|
|
- x: parseFloat( currentSize.x ) - drawnSize.x,
|
|
|
- y: parseFloat( currentSize.y ) - drawnSize.y
|
|
|
- };
|
|
|
-
|
|
|
- context.domResizeShadow.style[ invertedPosition.split( '-' )[ 0 ] ] = '0px';
|
|
|
- context.domResizeShadow.style[ invertedPosition.split( '-' )[ 1 ] ] = `${ diff2.x / 2 }px`;
|
|
|
-
|
|
|
- // Apply the actual shadow dimensions.
|
|
|
- context.domResizeShadow.style.width = `${ drawnSize.x }px`;
|
|
|
- context.domResizeShadow.style.height = `${ drawnSize.y }px`;
|
|
|
- }
|
|
|
+ drawnSize.x = latestRect.width;
|
|
|
+ drawnSize.y = latestRect.height;
|
|
|
|
|
|
return drawnSize;
|
|
|
}
|