@mhamz.01/easyflow-whiteboard 2.81.0 → 2.83.0
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/components/node/custom-node-overlay-fix.d.ts.map +1 -1
- package/dist/components/node/custom-node-overlay-fix.js +0 -6
- package/dist/components/node/hooks/useNodeDrag.js +1 -1
- package/dist/components/node/hooks/useWheelZoom.d.ts +1 -5
- package/dist/components/node/hooks/useWheelZoom.d.ts.map +1 -1
- package/dist/components/node/hooks/useWheelZoom.js +1 -21
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-node-overlay-fix.d.ts","sourceRoot":"","sources":["../../../src/components/node/custom-node-overlay-fix.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAkB,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAQhF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,KAAK,EACL,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,UAAc,EACd,cAA+B,EAC/B,YAAmB,EACnB,qBAA0B,EAC1B,YAAY,GACb,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"custom-node-overlay-fix.d.ts","sourceRoot":"","sources":["../../../src/components/node/custom-node-overlay-fix.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAkB,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAQhF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,KAAK,EACL,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,UAAc,EACd,cAA+B,EAC/B,YAAmB,EACnB,qBAA0B,EAC1B,YAAY,GACb,EAAE,uBAAuB,2CAmSzB"}
|
|
@@ -11,8 +11,6 @@ import { useCanvasReady } from "./hooks/useCanvasReady";
|
|
|
11
11
|
import { useNodeSync } from "./hooks/useNodeSync";
|
|
12
12
|
export default function CanvasOverlayLayer({ tasks, documents, onTasksUpdate, onDocumentsUpdate, canvasZoom = 1, canvasViewport = { x: 0, y: 0 }, selectionBox = null, selectedCanvasObjects = [], fabricCanvas, }) {
|
|
13
13
|
// ─── State Management ──────────────────────────────────────────────────
|
|
14
|
-
const [liveViewport, setLiveViewport] = useState(canvasViewport);
|
|
15
|
-
const [liveZoom, setLiveZoom] = useState(canvasZoom);
|
|
16
14
|
const [localTasks, setLocalTasks] = useState(tasks);
|
|
17
15
|
const [localDocuments, setLocalDocuments] = useState(documents);
|
|
18
16
|
const [selectedIds, setSelectedIds] = useState(new Set());
|
|
@@ -26,10 +24,6 @@ export default function CanvasOverlayLayer({ tasks, documents, onTasksUpdate, on
|
|
|
26
24
|
fabricCanvas,
|
|
27
25
|
canvasZoom,
|
|
28
26
|
canvasReady,
|
|
29
|
-
onViewportChange: useCallback((viewport, zoom) => {
|
|
30
|
-
setLiveViewport(viewport);
|
|
31
|
-
setLiveZoom(zoom);
|
|
32
|
-
}, []),
|
|
33
27
|
});
|
|
34
28
|
const { dragStateRef: dragRef, rafIdRef, getPointerEvent, getViewportTransform, handleDragStart: handleDragStartHook, handleDragMove: handleDragMoveHook, handleDragEnd: handleDragEndHook, } = useNodeDrag({
|
|
35
29
|
selectedIds,
|
|
@@ -78,7 +78,7 @@ export function useNodeDrag({ selectedIds, fabricCanvas, selectedCanvasObjects,
|
|
|
78
78
|
if (rafIdRef.current !== null)
|
|
79
79
|
cancelAnimationFrame(rafIdRef.current);
|
|
80
80
|
rafIdRef.current = requestAnimationFrame(() => {
|
|
81
|
-
const {
|
|
81
|
+
const { canvasObjectsStartPos, offsetX, offsetY } = dragStateRef.current;
|
|
82
82
|
const canvas = fabricCanvas?.current;
|
|
83
83
|
if (!canvas)
|
|
84
84
|
return;
|
|
@@ -4,12 +4,8 @@ interface UseWheelZoomProps {
|
|
|
4
4
|
fabricCanvas?: React.RefObject<Canvas | null>;
|
|
5
5
|
canvasZoom?: number;
|
|
6
6
|
canvasReady?: boolean;
|
|
7
|
-
onViewportChange: (viewport: {
|
|
8
|
-
x: number;
|
|
9
|
-
y: number;
|
|
10
|
-
}, zoom: number) => void;
|
|
11
7
|
}
|
|
12
|
-
export declare function useWheelZoom({ overlayRef, fabricCanvas, canvasZoom, canvasReady,
|
|
8
|
+
export declare function useWheelZoom({ overlayRef, fabricCanvas, canvasZoom, canvasReady, }: UseWheelZoomProps): {
|
|
13
9
|
handleOverlayWheel: (e: React.WheelEvent) => void;
|
|
14
10
|
};
|
|
15
11
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWheelZoom.d.ts","sourceRoot":"","sources":["../../../../src/components/node/hooks/useWheelZoom.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,UAAU,iBAAiB;IACvB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACrD,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useWheelZoom.d.ts","sourceRoot":"","sources":["../../../../src/components/node/hooks/useWheelZoom.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,UAAU,iBAAiB;IACvB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACrD,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,YAAY,CAAC,EAC3B,UAAU,EACV,YAAY,EACZ,UAAc,EACd,WAAmB,GACpB,EAAE,iBAAiB;4BAEa,KAAK,CAAC,UAAU;EA6DhD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
|
-
export function useWheelZoom({ overlayRef, fabricCanvas, canvasZoom = 1, canvasReady = false,
|
|
2
|
+
export function useWheelZoom({ overlayRef, fabricCanvas, canvasZoom = 1, canvasReady = false, }) {
|
|
3
3
|
// React event handler for overlay wheel
|
|
4
4
|
const handleOverlayWheel = (e) => {
|
|
5
5
|
if (e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
@@ -22,26 +22,6 @@ export function useWheelZoom({ overlayRef, fabricCanvas, canvasZoom = 1, canvasR
|
|
|
22
22
|
e.stopPropagation();
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
const canvas = fabricCanvas?.current;
|
|
27
|
-
if (!canvas || !canvasReady)
|
|
28
|
-
return;
|
|
29
|
-
// THE FIX: Listen to Fabric's internal render loop
|
|
30
|
-
// This fires immediately after Fabric moves, reducing the lag time
|
|
31
|
-
const syncViewport = () => {
|
|
32
|
-
const vpt = canvas.viewportTransform;
|
|
33
|
-
if (vpt) {
|
|
34
|
-
onViewportChange({ x: vpt[4], y: vpt[5] }, // Pan position
|
|
35
|
-
canvas.getZoom() // Zoom level
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
// Use 'after:render' for the tightest possible sync
|
|
40
|
-
canvas.on("after:render", syncViewport);
|
|
41
|
-
return () => {
|
|
42
|
-
canvas.off("after:render", syncViewport);
|
|
43
|
-
};
|
|
44
|
-
}, [fabricCanvas, canvasReady, onViewportChange]);
|
|
45
25
|
// Global wheel event for hovering over nodes
|
|
46
26
|
useEffect(() => {
|
|
47
27
|
const overlayEl = overlayRef.current;
|