|
|
@@ -38,16 +38,9 @@ export default class ResizerCentral {
|
|
|
y: ( currentCoordinates.y - this.closestReferencePoint.y ) * 2
|
|
|
};
|
|
|
|
|
|
- // const resizeHost = this.context._getResizeHost();
|
|
|
-
|
|
|
- // const initialSize = {
|
|
|
- // x: resizeHost.width,
|
|
|
- // y: resizeHost.height
|
|
|
- // };
|
|
|
+ const originalSize = this.context.originalSize;
|
|
|
|
|
|
const proposedSize = {
|
|
|
- // x: Math.abs( currentCoordinates.x - context.referenceCoordinates.x ),
|
|
|
- // y: Math.abs( currentCoordinates.y - context.referenceCoordinates.y )
|
|
|
x: Math.abs( this.closestReferencePoint.x - context.referenceCoordinates.x + enlargement.x ),
|
|
|
y: Math.abs( this.closestReferencePoint.y - context.referenceCoordinates.y + enlargement.y )
|
|
|
};
|
|
|
@@ -67,29 +60,22 @@ export default class ResizerCentral {
|
|
|
drawnSize.x = drawnSize.y * context.aspectRatio;
|
|
|
}
|
|
|
|
|
|
- // console.log( 'initial', initialSize, 'drawn', drawnSize );
|
|
|
-
|
|
|
// Reset shadow bounding.
|
|
|
context.domResizeShadow.style.top = 'auto';
|
|
|
context.domResizeShadow.style.left = 'auto';
|
|
|
context.domResizeShadow.style.bottom = 'auto';
|
|
|
context.domResizeShadow.style.right = 'auto';
|
|
|
|
|
|
- // context.domResizeShadow.style[ context.referenceHandlerPosition.split( '-' )[ 0 ] ] = 'auto';
|
|
|
- // context.domResizeShadow.style[ context.referenceHandlerPosition.split( '-' )[ 1 ] ] = 'auto';
|
|
|
-
|
|
|
- // const invertedPosition = this.context._invertPosition( context.referenceHandlerPosition );
|
|
|
+ const invertedPosition = this.context._invertPosition( context.referenceHandlerPosition );
|
|
|
|
|
|
- // context.domResizeShadow.style[ invertedPosition.split( '-' )[ 0 ] ] = `${ ( drawnSize.x - initialSize.x ) / 2 * -1 }px`;
|
|
|
- // context.domResizeShadow.style[ invertedPosition.split( '-' )[ 1 ] ] = `${ ( drawnSize.y - initialSize.y ) / 2 * -1 }px`;
|
|
|
- // context.domResizeShadow.style[ invertedPosition.split( '-' )[ 0 ] ] = `${ enlargement.x / 2 * -1 }px`;
|
|
|
- // context.domResizeShadow.style[ invertedPosition.split( '-' )[ 1 ] ] = `${ enlargement.y / 2 * -1 }px`;
|
|
|
+ context.domResizeShadow.style[ invertedPosition.split( '-' )[ 0 ] ] = `${ ( originalSize.y - drawnSize.y ) / 2 }px`;
|
|
|
+ context.domResizeShadow.style[ invertedPosition.split( '-' )[ 1 ] ] = `${ ( originalSize.x - drawnSize.x ) / 2 }px`;
|
|
|
|
|
|
// Apply the actual shadow dimensions.
|
|
|
context.domResizeShadow.style.width = `${ drawnSize.x }px`;
|
|
|
context.domResizeShadow.style.height = `${ drawnSize.y }px`;
|
|
|
|
|
|
- return proposedSize;
|
|
|
+ return drawnSize; // @todo decide what size should actually be returned, drawn or intended.
|
|
|
}
|
|
|
|
|
|
redraw() {}
|