diff --git a/packages/react-moveable/src/react-moveable/gesto/getAbleGesto.ts b/packages/react-moveable/src/react-moveable/gesto/getAbleGesto.ts index a38166246..4638d8052 100644 --- a/packages/react-moveable/src/react-moveable/gesto/getAbleGesto.ts +++ b/packages/react-moveable/src/react-moveable/gesto/getAbleGesto.ts @@ -51,7 +51,7 @@ export function triggerAble( ables.push(...moveable.props.ables!.filter(able => able.name === requestAble)); } } - if (!ables.length) { + if (!ables.length || ables.every(able => able.dragRelation)) { return false; } const eventAbles: Able[] = [BeforeRenderable, ...ables, Renderable].filter((able: any) => able[eventName]); @@ -115,9 +115,6 @@ export function triggerAble( if (nextDatas.isEventStart) { if (able.dragRelation === "strong") { - // cancel drag - nextDatas.isEventStart = false; - return false; } // start drag @@ -125,7 +122,7 @@ export function triggerAble( } // cancel event return false; - }).length === 0; + }).length as any; } if (isEnd || isForceEnd) { moveable.state.gestos = {}; diff --git a/packages/react-moveable/src/react-moveable/types.ts b/packages/react-moveable/src/react-moveable/types.ts index 59e4395be..b0f0939f0 100644 --- a/packages/react-moveable/src/react-moveable/types.ts +++ b/packages/react-moveable/src/react-moveable/types.ts @@ -422,6 +422,9 @@ export interface Able = IObject, Events extends updateRect?: boolean; canPinch?: boolean; css?: string[]; + /** + * Check how related to drag + */ dragRelation?: "strong" | "weak" | undefined | null | false, /** * Fired when the event is cleared