Skip to content

Commit

Permalink
fix: fix drag undefined on Rotate Group #710
Browse files Browse the repository at this point in the history
  • Loading branch information
daybrush committed Aug 1, 2022
1 parent 3ce54e0 commit db80e7d
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions packages/react-moveable/src/react-moveable/ables/Rotatable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
import { DirectionControlInfo, renderAroundControls, renderDirectionControlsByInfos } from "../renderDirections";
import { DIRECTIONS, DIRECTION_REGION_TO_DIRECTION } from "../consts";
import Resizable from "./Resizable";
import Draggable from "./Draggable";

/**
* @namespace Rotatable
Expand Down Expand Up @@ -539,23 +540,19 @@ export default {
const resolveAble = datas.resolveAble;

if (resolveAble === "resizable") {
const resizable = moveable.getAble<typeof Resizable>("resizable");

resizeStart = resizable ? resizable.dragControlStart(moveable, {
resizeStart = Resizable.dragControlStart(moveable, {
...(new CustomGesto("resizable").dragStart([0, 0], e)),
parentDirection: datas.controlDirection,
parentFixedDirection: datas.fixedDirection,
}) : false;
});
}
}

if (!resizeStart) {
const draggable = moveable.getAble("draggable");

dragStart = draggable ? draggable.dragStart!(
dragStart = Draggable.dragStart!(
moveable,
new CustomGesto().dragStart([0, 0], e),
) : false;
);
}

setFixedDirection(getOriginDirection(moveable));
Expand Down Expand Up @@ -697,6 +694,7 @@ export default {
isPinch,
e,
);

let transformEvent: TransformObject = dragEvent;
const parentDistance = getDist(
[nextClientX, nextClientY],
Expand All @@ -706,7 +704,7 @@ export default {
let resize: OnResize | undefined = undefined;

if (datas.resolveAble === "resizable") {
const resizeEvent = moveable.getAble<typeof Resizable>("resizable")!.dragControl(
const resizeEvent = Resizable.dragControl(
moveable,
{
...setCustomDrag(e, moveable.state, [e.deltaX, e.deltaY], !!isPinch, false, "resizable"),
Expand Down

0 comments on commit db80e7d

Please sign in to comment.