From 5c8ed502cdcb0020e288f4a5a2a94de12cc8920e Mon Sep 17 00:00:00 2001 From: bokuweb Date: Thu, 12 Dec 2019 10:22:14 +0900 Subject: [PATCH] fix:#618 --- src/index.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index e73661c6..725e65de 100755 --- a/src/index.tsx +++ b/src/index.tsx @@ -113,7 +113,7 @@ export type HandleComponent = { bottomRight?: React.ReactElement; bottomLeft?: React.ReactElement; topLeft?: React.ReactElement; -} +}; export interface Props { dragGrid?: Grid; @@ -363,8 +363,11 @@ export class Rnd extends React.PureComponent { this.resizing = true; const scale = this.props.scale as number; + const offset = this.getOffsetFromParent(); + const pos = this.getDraggablePosition(); + this.resizingPosition = { x: pos.x + offset.left, y: pos.y + offset.top }; this.setState({ - original: this.getDraggablePosition(), + original: pos, }); if (this.props.bounds) { const parent = this.getParent(); @@ -587,7 +590,7 @@ export class Rnd extends React.PureComponent { }; } // INFO: Make uncontorolled component when resizing to control position by setPostion. - const pos = this.resizing ? undefined : draggablePosition + const pos = this.resizing ? undefined : draggablePosition; return (