@visualli/react 0.1.1 → 0.1.3

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/index.js CHANGED
@@ -2149,11 +2149,6 @@ function VisualliCanvas(props) {
2149
2149
  return { flatNodes: [], connections: [], containers: [] };
2150
2150
  }
2151
2151
  }, [doc, currentLayerId]);
2152
- const setNodes = useNodeStore((s) => s.setNodes);
2153
- const nodes = useNodeStore((s) => s.nodes);
2154
- const updateNodePosition = useNodeStore((s) => s.updateNodePosition);
2155
- const setCenter = useViewportStore((s) => s.setCenter);
2156
- const setZoom = useViewportStore((s) => s.setZoom);
2157
2152
  const viewport = useViewportStore((s) => ({
2158
2153
  centerX: s.centerX,
2159
2154
  centerY: s.centerY,
@@ -2161,6 +2156,11 @@ function VisualliCanvas(props) {
2161
2156
  canvasWidth: s.canvasWidth,
2162
2157
  canvasHeight: s.canvasHeight
2163
2158
  }));
2159
+ const setCenter = useViewportStore((s) => s.setCenter);
2160
+ const setZoom = useViewportStore((s) => s.setZoom);
2161
+ const nodes = useNodeStore((s) => s.nodes);
2162
+ const setNodes = useNodeStore((s) => s.setNodes);
2163
+ const updateNodePosition = useNodeStore((s) => s.updateNodePosition);
2164
2164
  const clearSel = useSelectionStore((s) => s.clear);
2165
2165
  const select = useSelectionStore((s) => s.select);
2166
2166
  useEffect6(() => {
@@ -2702,7 +2702,10 @@ function VisualliCanvas(props) {
2702
2702
  setCanvasContextMenu(null);
2703
2703
  return;
2704
2704
  }
2705
- setCanvasContextMenu({ x: e.evt.clientX, y: e.evt.clientY });
2705
+ const rect = containerRef.current?.getBoundingClientRect();
2706
+ const localX = rect ? e.evt.clientX - rect.left : e.evt.clientX;
2707
+ const localY = rect ? e.evt.clientY - rect.top : e.evt.clientY;
2708
+ setCanvasContextMenu({ x: localX, y: localY });
2706
2709
  }, [navStack.length]);
2707
2710
  const handleStageTouchStart = useCallback4((e) => handleStageMouseDown(e), [handleStageMouseDown]);
2708
2711
  const handleStageTouchMove = useCallback4((e) => handleStageMouseMove(e), [handleStageMouseMove]);
@@ -2858,7 +2861,7 @@ function VisualliCanvas(props) {
2858
2861
  role: "menu",
2859
2862
  "aria-label": "Canvas options",
2860
2863
  style: {
2861
- position: "fixed",
2864
+ position: "absolute",
2862
2865
  zIndex: 60,
2863
2866
  pointerEvents: "auto",
2864
2867
  left: `${Math.min(canvasContextMenu.x, Math.max(8, (canvasSizeRef.current.width || 800) - 152))}px`,
@@ -2907,7 +2910,7 @@ function VisualliCanvas(props) {
2907
2910
  {
2908
2911
  "data-node-tooltip": "true",
2909
2912
  style: {
2910
- position: "fixed",
2913
+ position: "absolute",
2911
2914
  zIndex: 50,
2912
2915
  left: safeLeft,
2913
2916
  top: safeTop,