|
@@ -4,6 +4,7 @@ import {
|
|
|
|
|
|
|
|
import ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin';
|
|
import ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin';
|
|
|
import mix from '@ckeditor/ckeditor5-utils/src/mix';
|
|
import mix from '@ckeditor/ckeditor5-utils/src/mix';
|
|
|
|
|
+import global from '@ckeditor/ckeditor5-utils/src/dom/global';
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
*
|
|
*
|
|
@@ -74,26 +75,38 @@ export default class ResizerCentral {
|
|
|
drawnSize.x = drawnSize.y * context.aspectRatio;
|
|
drawnSize.x = drawnSize.y * context.aspectRatio;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Reset shadow bounding.
|
|
|
|
|
- context.domResizeShadow.style.top = 'auto';
|
|
|
|
|
- context.domResizeShadow.style.left = 'auto';
|
|
|
|
|
- context.domResizeShadow.style.bottom = 'auto';
|
|
|
|
|
- context.domResizeShadow.style.right = 'auto';
|
|
|
|
|
|
|
+ const resizeUsingImage = global.window.pocResizeUsingImage !== false;
|
|
|
|
|
+ let shadowBoundValue = '0px';
|
|
|
|
|
|
|
|
- const invertedPosition = this.context._invertPosition( context.referenceHandlerPosition );
|
|
|
|
|
|
|
+ if ( !resizeUsingImage ) {
|
|
|
|
|
+ shadowBoundValue = 'auto';
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- const diff2 = {
|
|
|
|
|
- x: parseFloat( originalSize.x ) - drawnSize.x,
|
|
|
|
|
- y: parseFloat( originalSize.y ) - drawnSize.y
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ // 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`;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const invertedPosition = this.context._invertPosition( context.referenceHandlerPosition );
|
|
|
|
|
+
|
|
|
|
|
+ const diff2 = {
|
|
|
|
|
+ x: parseFloat( originalSize.x ) - drawnSize.x,
|
|
|
|
|
+ y: parseFloat( originalSize.y ) - drawnSize.y
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
- // context.domResizeShadow.style[ invertedPosition.split( '-' )[ 0 ] ] = `${ diff2.y / 2 }px`;
|
|
|
|
|
- context.domResizeShadow.style[ invertedPosition.split( '-' )[ 0 ] ] = '0px';
|
|
|
|
|
- context.domResizeShadow.style[ invertedPosition.split( '-' )[ 1 ] ] = `${ diff2.x / 2 }px`;
|
|
|
|
|
|
|
+ context.domResizeShadow.style[ invertedPosition.split( '-' )[ 0 ] ] = `${ diff2.y / 2 }px`;
|
|
|
|
|
+ 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`;
|
|
|
|
|
|
|
+ // Apply the actual shadow dimensions.
|
|
|
|
|
+ context.domResizeShadow.style.width = `${ drawnSize.x }px`;
|
|
|
|
|
+ context.domResizeShadow.style.height = `${ drawnSize.y }px`;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return drawnSize; // @todo decide what size should actually be returned.
|
|
return drawnSize; // @todo decide what size should actually be returned.
|
|
|
}
|
|
}
|