Get clicked handle element from event.currentTarget
This commit is contained in:
@@ -120,6 +120,7 @@ function HandleComponent(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleElement = event.currentTarget
|
||||||
const isMouseTriggered = isMouseEvent(event.nativeEvent);
|
const isMouseTriggered = isMouseEvent(event.nativeEvent);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -128,7 +129,7 @@ function HandleComponent(
|
|||||||
) {
|
) {
|
||||||
const currentStore = store.getState();
|
const currentStore = store.getState();
|
||||||
|
|
||||||
XYHandle.onPointerDown(event.nativeEvent, {
|
XYHandle.onPointerDown(event.nativeEvent, handleElement, {
|
||||||
autoPanOnConnect: currentStore.autoPanOnConnect,
|
autoPanOnConnect: currentStore.autoPanOnConnect,
|
||||||
connectionMode: currentStore.connectionMode,
|
connectionMode: currentStore.connectionMode,
|
||||||
connectionRadius: currentStore.connectionRadius,
|
connectionRadius: currentStore.connectionRadius,
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ const alwaysValid = () => true;
|
|||||||
|
|
||||||
function onPointerDown(
|
function onPointerDown(
|
||||||
event: MouseEvent | TouchEvent,
|
event: MouseEvent | TouchEvent,
|
||||||
|
handleElement: Element,
|
||||||
{
|
{
|
||||||
connectionMode,
|
connectionMode,
|
||||||
connectionRadius,
|
connectionRadius,
|
||||||
@@ -54,8 +55,7 @@ function onPointerDown(
|
|||||||
let closestHandle: Handle | null;
|
let closestHandle: Handle | null;
|
||||||
|
|
||||||
const { x, y } = getEventPosition(event);
|
const { x, y } = getEventPosition(event);
|
||||||
const clickedHandle = doc?.elementFromPoint(x, y);
|
const handleType = getHandleType(edgeUpdaterType, handleElement);
|
||||||
const handleType = getHandleType(edgeUpdaterType, clickedHandle);
|
|
||||||
const containerBounds = domNode?.getBoundingClientRect();
|
const containerBounds = domNode?.getBoundingClientRect();
|
||||||
let connectionStarted = false;
|
let connectionStarted = false;
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export type IsValidParams = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type XYHandleInstance = {
|
export type XYHandleInstance = {
|
||||||
onPointerDown: (event: MouseEvent | TouchEvent, params: OnPointerDownParams) => void;
|
onPointerDown: (event: MouseEvent | TouchEvent, handleElement: Element, params: OnPointerDownParams) => void;
|
||||||
isValid: (event: MouseEvent | TouchEvent, params: IsValidParams) => Result;
|
isValid: (event: MouseEvent | TouchEvent, params: IsValidParams) => Result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user