Skip to content

Commit 797e56b

Browse files
committed
bug
1 parent 445d99f commit 797e56b

File tree

3 files changed

+55
-52
lines changed

3 files changed

+55
-52
lines changed

dist/index.cjs.js

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -647,15 +647,17 @@ function wrapShape(WrappedComponent) {
647647
event.stopPropagation();
648648
var angle = this.calculateAngle(event);
649649
var onChange = this.props.onChange;
650-
var _this$state = this.state,
651-
dragStartCoordinates = _this$state.dragStartCoordinates,
652-
dragCurrentCoordinates = _this$state.dragCurrentCoordinates;
653-
var nextRect = getRectFromCornerCoordinates(dragStartCoordinates, dragCurrentCoordinates, this.state.rotation);
654650
this.setState({
655651
isRotating: false,
656652
rotationStartAngle: angle
657653
}, function () {
658-
onChange(nextRect, _this2.props);
654+
onChange({
655+
rotation: _this2.state.rotation,
656+
x: _this2.props.x,
657+
y: _this2.props.y,
658+
width: _this2.props.width,
659+
height: _this2.props.height
660+
}, _this2.props);
659661
});
660662
document.removeEventListener('mousemove', this.handleRotationMove);
661663
document.removeEventListener('mouseup', this.handleRotationEnd);
@@ -664,9 +666,9 @@ function wrapShape(WrappedComponent) {
664666
key: "handleRotationMove",
665667
value: function handleRotationMove(event) {
666668
if (!this.state.isRotating) return;
667-
var _this$state2 = this.state,
668-
rotation = _this$state2.rotation,
669-
rotationStartAngle = _this$state2.rotationStartAngle;
669+
var _this$state = this.state,
670+
rotation = _this$state.rotation,
671+
rotationStartAngle = _this$state.rotationStartAngle;
670672
var currentAngle = this.calculateAngle(event);
671673
var deltaAngle = currentAngle - rotationStartAngle;
672674
var rotationSpeed = this.props.rotationSpeed || 1;
@@ -750,10 +752,10 @@ function wrapShape(WrappedComponent) {
750752
}
751753

752754
var onChange = this.props.onChange;
753-
var _this$state3 = this.state,
754-
dragStartCoordinates = _this$state3.dragStartCoordinates,
755-
dragCurrentCoordinates = _this$state3.dragCurrentCoordinates,
756-
isDragToMove = _this$state3.isDragToMove;
755+
var _this$state2 = this.state,
756+
dragStartCoordinates = _this$state2.dragStartCoordinates,
757+
dragCurrentCoordinates = _this$state2.dragCurrentCoordinates,
758+
isDragToMove = _this$state2.isDragToMove;
757759

758760
if (isDragToMove) {
759761
var nextX = dragCurrentCoordinates.x,
@@ -824,9 +826,9 @@ function wrapShape(WrappedComponent) {
824826
width = _this$props3.width,
825827
height = _this$props3.height,
826828
getPlaneCoordinatesFromEvent = _this$props3.getPlaneCoordinatesFromEvent;
827-
var _this$state4 = this.state,
828-
dragCurrentCoordinates = _this$state4.dragCurrentCoordinates,
829-
dragInnerOffset = _this$state4.dragInnerOffset;
829+
var _this$state3 = this.state,
830+
dragCurrentCoordinates = _this$state3.dragCurrentCoordinates,
831+
dragInnerOffset = _this$state3.dragInnerOffset;
830832

831833
var _getPlaneCoordinatesF = getPlaneCoordinatesFromEvent(event, dragInnerOffset),
832834
rawX = _getPlaneCoordinatesF.x,
@@ -994,12 +996,12 @@ function wrapShape(WrappedComponent) {
994996
isInSelectionGroup = _this$props8.isInSelectionGroup,
995997
scale = _this$props8.scale,
996998
shapeId = _this$props8.shapeId;
997-
var _this$state5 = this.state,
998-
nativeActive = _this$state5.nativeActive,
999-
isMouseDown = _this$state5.isMouseDown,
1000-
dragStartCoordinates = _this$state5.dragStartCoordinates,
1001-
dragCurrentCoordinates = _this$state5.dragCurrentCoordinates,
1002-
rotation = _this$state5.rotation;
999+
var _this$state4 = this.state,
1000+
nativeActive = _this$state4.nativeActive,
1001+
isMouseDown = _this$state4.isMouseDown,
1002+
dragStartCoordinates = _this$state4.dragStartCoordinates,
1003+
dragCurrentCoordinates = _this$state4.dragCurrentCoordinates,
1004+
rotation = _this$state4.rotation;
10031005
var active = artificialActive !== null ? artificialActive : nativeActive;
10041006
var sides = !isMouseDown ? {
10051007
left: this.props.x,

dist/index.esm.js

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -640,15 +640,17 @@ function wrapShape(WrappedComponent) {
640640
event.stopPropagation();
641641
var angle = this.calculateAngle(event);
642642
var onChange = this.props.onChange;
643-
var _this$state = this.state,
644-
dragStartCoordinates = _this$state.dragStartCoordinates,
645-
dragCurrentCoordinates = _this$state.dragCurrentCoordinates;
646-
var nextRect = getRectFromCornerCoordinates(dragStartCoordinates, dragCurrentCoordinates, this.state.rotation);
647643
this.setState({
648644
isRotating: false,
649645
rotationStartAngle: angle
650646
}, function () {
651-
onChange(nextRect, _this2.props);
647+
onChange({
648+
rotation: _this2.state.rotation,
649+
x: _this2.props.x,
650+
y: _this2.props.y,
651+
width: _this2.props.width,
652+
height: _this2.props.height
653+
}, _this2.props);
652654
});
653655
document.removeEventListener('mousemove', this.handleRotationMove);
654656
document.removeEventListener('mouseup', this.handleRotationEnd);
@@ -657,9 +659,9 @@ function wrapShape(WrappedComponent) {
657659
key: "handleRotationMove",
658660
value: function handleRotationMove(event) {
659661
if (!this.state.isRotating) return;
660-
var _this$state2 = this.state,
661-
rotation = _this$state2.rotation,
662-
rotationStartAngle = _this$state2.rotationStartAngle;
662+
var _this$state = this.state,
663+
rotation = _this$state.rotation,
664+
rotationStartAngle = _this$state.rotationStartAngle;
663665
var currentAngle = this.calculateAngle(event);
664666
var deltaAngle = currentAngle - rotationStartAngle;
665667
var rotationSpeed = this.props.rotationSpeed || 1;
@@ -743,10 +745,10 @@ function wrapShape(WrappedComponent) {
743745
}
744746

745747
var onChange = this.props.onChange;
746-
var _this$state3 = this.state,
747-
dragStartCoordinates = _this$state3.dragStartCoordinates,
748-
dragCurrentCoordinates = _this$state3.dragCurrentCoordinates,
749-
isDragToMove = _this$state3.isDragToMove;
748+
var _this$state2 = this.state,
749+
dragStartCoordinates = _this$state2.dragStartCoordinates,
750+
dragCurrentCoordinates = _this$state2.dragCurrentCoordinates,
751+
isDragToMove = _this$state2.isDragToMove;
750752

751753
if (isDragToMove) {
752754
var nextX = dragCurrentCoordinates.x,
@@ -817,9 +819,9 @@ function wrapShape(WrappedComponent) {
817819
width = _this$props3.width,
818820
height = _this$props3.height,
819821
getPlaneCoordinatesFromEvent = _this$props3.getPlaneCoordinatesFromEvent;
820-
var _this$state4 = this.state,
821-
dragCurrentCoordinates = _this$state4.dragCurrentCoordinates,
822-
dragInnerOffset = _this$state4.dragInnerOffset;
822+
var _this$state3 = this.state,
823+
dragCurrentCoordinates = _this$state3.dragCurrentCoordinates,
824+
dragInnerOffset = _this$state3.dragInnerOffset;
823825

824826
var _getPlaneCoordinatesF = getPlaneCoordinatesFromEvent(event, dragInnerOffset),
825827
rawX = _getPlaneCoordinatesF.x,
@@ -987,12 +989,12 @@ function wrapShape(WrappedComponent) {
987989
isInSelectionGroup = _this$props8.isInSelectionGroup,
988990
scale = _this$props8.scale,
989991
shapeId = _this$props8.shapeId;
990-
var _this$state5 = this.state,
991-
nativeActive = _this$state5.nativeActive,
992-
isMouseDown = _this$state5.isMouseDown,
993-
dragStartCoordinates = _this$state5.dragStartCoordinates,
994-
dragCurrentCoordinates = _this$state5.dragCurrentCoordinates,
995-
rotation = _this$state5.rotation;
992+
var _this$state4 = this.state,
993+
nativeActive = _this$state4.nativeActive,
994+
isMouseDown = _this$state4.isMouseDown,
995+
dragStartCoordinates = _this$state4.dragStartCoordinates,
996+
dragCurrentCoordinates = _this$state4.dragCurrentCoordinates,
997+
rotation = _this$state4.rotation;
996998
var active = artificialActive !== null ? artificialActive : nativeActive;
997999
var sides = !isMouseDown ? {
9981000
left: this.props.x,

src/wrapShape.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,18 @@ function wrapShape(WrappedComponent) {
108108
const angle = this.calculateAngle(event);
109109

110110
const { onChange } = this.props;
111-
const { dragStartCoordinates, dragCurrentCoordinates } = this.state;
112-
113-
const nextRect = getRectFromCornerCoordinates(
114-
dragStartCoordinates,
115-
dragCurrentCoordinates,
116-
this.state.rotation
117-
);
118111

119112
this.setState({
120-
isRotating: false,
121-
rotationStartAngle: angle,
113+
isRotating: false,
114+
rotationStartAngle: angle,
122115
}, () => {
123-
onChange(nextRect, this.props);
116+
onChange({
117+
rotation: this.state.rotation,
118+
x: this.props.x,
119+
y: this.props.y,
120+
width: this.props.width,
121+
height: this.props.height
122+
}, this.props);
124123
});
125124

126125
document.removeEventListener('mousemove', this.handleRotationMove);

0 commit comments

Comments
 (0)