@visualli/react 0.1.1 → 0.1.2

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
@@ -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,