Skip to content

Commit 5a860b2

Browse files
author
Pavel Klimov
committed
fixed click on touch
1 parent 1b16329 commit 5a860b2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/components/canvas/layers/graphLayer/GraphLayer.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@ export type TGraphLayerContext = LayerContext & {
2525
graph: Graph;
2626
};
2727

28-
const rootBubblingEventTypes = new Set(["pointerdown", "pointerup", "click", "dblclick", "contextmenu"]);
28+
const rootBubblingEventTypes = new Set([
29+
"pointerdown",
30+
"pointerup",
31+
"click",
32+
"dblclick",
33+
"contextmenu",
34+
"pointercancel",
35+
]);
2936
const rootCapturingEventTypes = new Set(["pointerdown", "pointerup"]);
3037

3138
export type GraphPointerEvent = CustomEvent<{
@@ -323,8 +330,7 @@ export class GraphLayer extends Layer<TGraphLayerProps, TGraphLayerContext> {
323330
}
324331

325332
if (
326-
this.pointerStartEvent &&
327-
getEventDelta(this.pointerStartEvent, event) < 3 &&
333+
(this.canEmulateClick || event.pointerType === "touch") &&
328334
(event.type === "click" || event.type === "dblclick")
329335
) {
330336
this.applyEventToTargetComponent(new PointerEvent(event.type, event), target);

0 commit comments

Comments
 (0)