system-canvas-standalone 0.2.42 → 0.2.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/system-canvas.js
CHANGED
|
@@ -15845,6 +15845,7 @@ var SystemCanvas = (() => {
|
|
|
15845
15845
|
const [selectedIds, setSelectedIds] = (0, import_react7.useState)(() => /* @__PURE__ */ new Set());
|
|
15846
15846
|
const [marqueeRect, setMarqueeRect] = (0, import_react7.useState)(null);
|
|
15847
15847
|
const marqueeActiveRef = (0, import_react7.useRef)(activationKey === "none");
|
|
15848
|
+
const isPendingRef = (0, import_react7.useRef)(false);
|
|
15848
15849
|
const isDrawingRef = (0, import_react7.useRef)(false);
|
|
15849
15850
|
const startScreenRef = (0, import_react7.useRef)(null);
|
|
15850
15851
|
const pointerIdRef = (0, import_react7.useRef)(null);
|
|
@@ -15915,7 +15916,8 @@ var SystemCanvas = (() => {
|
|
|
15915
15916
|
if (!matchesKey(e))
|
|
15916
15917
|
return;
|
|
15917
15918
|
marqueeActiveRef.current = false;
|
|
15918
|
-
if (isDrawingRef.current) {
|
|
15919
|
+
if (isDrawingRef.current || isPendingRef.current) {
|
|
15920
|
+
isPendingRef.current = false;
|
|
15919
15921
|
isDrawingRef.current = false;
|
|
15920
15922
|
startScreenRef.current = null;
|
|
15921
15923
|
pointerIdRef.current = null;
|
|
@@ -15965,6 +15967,8 @@ var SystemCanvas = (() => {
|
|
|
15965
15967
|
if (target && typeof target.closest === "function") {
|
|
15966
15968
|
if (target.closest(".system-canvas-node"))
|
|
15967
15969
|
return;
|
|
15970
|
+
if (target.closest(".system-canvas-edge"))
|
|
15971
|
+
return;
|
|
15968
15972
|
if (target.closest(".system-canvas-resize-handles"))
|
|
15969
15973
|
return;
|
|
15970
15974
|
if (target.closest(".system-canvas-connection-handles"))
|
|
@@ -15977,21 +15981,16 @@ var SystemCanvas = (() => {
|
|
|
15977
15981
|
const x = e.clientX - rect.left;
|
|
15978
15982
|
const y = e.clientY - rect.top;
|
|
15979
15983
|
startScreenRef.current = { x, y };
|
|
15980
|
-
|
|
15984
|
+
isPendingRef.current = true;
|
|
15985
|
+
isDrawingRef.current = false;
|
|
15981
15986
|
pointerIdRef.current = e.pointerId;
|
|
15982
|
-
setMarqueeRect({ x1: x, y1: y, x2: x, y2: y });
|
|
15983
|
-
try {
|
|
15984
|
-
container.setPointerCapture(e.pointerId);
|
|
15985
|
-
} catch {
|
|
15986
|
-
}
|
|
15987
|
-
e.preventDefault();
|
|
15988
|
-
e.stopPropagation();
|
|
15989
15987
|
};
|
|
15988
|
+
const MARQUEE_DRAG_THRESHOLD = 4;
|
|
15990
15989
|
const onPointerMove = (e) => {
|
|
15991
|
-
if (!isDrawingRef.current)
|
|
15992
|
-
return;
|
|
15993
15990
|
if (e.pointerId !== pointerIdRef.current)
|
|
15994
15991
|
return;
|
|
15992
|
+
if (!isPendingRef.current && !isDrawingRef.current)
|
|
15993
|
+
return;
|
|
15995
15994
|
const svg = svgRef.current;
|
|
15996
15995
|
if (!svg)
|
|
15997
15996
|
return;
|
|
@@ -15999,13 +15998,32 @@ var SystemCanvas = (() => {
|
|
|
15999
15998
|
const x = e.clientX - rect.left;
|
|
16000
15999
|
const y = e.clientY - rect.top;
|
|
16001
16000
|
const start2 = startScreenRef.current;
|
|
16001
|
+
if (isPendingRef.current && !isDrawingRef.current) {
|
|
16002
|
+
const dx = x - start2.x;
|
|
16003
|
+
const dy = y - start2.y;
|
|
16004
|
+
if (Math.hypot(dx, dy) < MARQUEE_DRAG_THRESHOLD)
|
|
16005
|
+
return;
|
|
16006
|
+
isPendingRef.current = false;
|
|
16007
|
+
isDrawingRef.current = true;
|
|
16008
|
+
try {
|
|
16009
|
+
container.setPointerCapture(e.pointerId);
|
|
16010
|
+
} catch {
|
|
16011
|
+
}
|
|
16012
|
+
}
|
|
16013
|
+
e.preventDefault();
|
|
16002
16014
|
setMarqueeRect({ x1: start2.x, y1: start2.y, x2: x, y2: y });
|
|
16003
16015
|
};
|
|
16004
16016
|
const onPointerUp = (e) => {
|
|
16005
|
-
if (!isDrawingRef.current)
|
|
16006
|
-
return;
|
|
16007
16017
|
if (e.pointerId !== pointerIdRef.current)
|
|
16008
16018
|
return;
|
|
16019
|
+
if (isPendingRef.current && !isDrawingRef.current) {
|
|
16020
|
+
isPendingRef.current = false;
|
|
16021
|
+
startScreenRef.current = null;
|
|
16022
|
+
pointerIdRef.current = null;
|
|
16023
|
+
return;
|
|
16024
|
+
}
|
|
16025
|
+
if (!isDrawingRef.current)
|
|
16026
|
+
return;
|
|
16009
16027
|
const svg = svgRef.current;
|
|
16010
16028
|
if (!svg)
|
|
16011
16029
|
return;
|
|
@@ -16031,6 +16049,7 @@ var SystemCanvas = (() => {
|
|
|
16031
16049
|
}
|
|
16032
16050
|
setSelectedIds(matched);
|
|
16033
16051
|
setMarqueeRect(null);
|
|
16052
|
+
isPendingRef.current = false;
|
|
16034
16053
|
isDrawingRef.current = false;
|
|
16035
16054
|
startScreenRef.current = null;
|
|
16036
16055
|
pointerIdRef.current = null;
|