Skip to content

Commit 9ce76da

Browse files
authored
Merge pull request #619 from bokuweb/fix-#618
fix:#618
2 parents 32e6e49 + 5c8ed50 commit 9ce76da

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/index.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export type HandleComponent = {
113113
bottomRight?: React.ReactElement<any>;
114114
bottomLeft?: React.ReactElement<any>;
115115
topLeft?: React.ReactElement<any>;
116-
}
116+
};
117117

118118
export interface Props {
119119
dragGrid?: Grid;
@@ -363,8 +363,11 @@ export class Rnd extends React.PureComponent<Props, State> {
363363
this.resizing = true;
364364

365365
const scale = this.props.scale as number;
366+
const offset = this.getOffsetFromParent();
367+
const pos = this.getDraggablePosition();
368+
this.resizingPosition = { x: pos.x + offset.left, y: pos.y + offset.top };
366369
this.setState({
367-
original: this.getDraggablePosition(),
370+
original: pos,
368371
});
369372
if (this.props.bounds) {
370373
const parent = this.getParent();
@@ -587,7 +590,7 @@ export class Rnd extends React.PureComponent<Props, State> {
587590
};
588591
}
589592
// INFO: Make uncontorolled component when resizing to control position by setPostion.
590-
const pos = this.resizing ? undefined : draggablePosition
593+
const pos = this.resizing ? undefined : draggablePosition;
591594
return (
592595
<Draggable
593596
ref={this.refDraggable}

0 commit comments

Comments
 (0)