@pixldocs/canvas-renderer 0.5.424 → 0.5.426

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.
@@ -10708,6 +10708,8 @@ const SELECTION_PRIMARY = "hsl(217, 91%, 60%)";
10708
10708
  const SELECTION_BORDER_SCALE = 2;
10709
10709
  let ensureCanvaControlRenders = () => {
10710
10710
  };
10711
+ let ensureCanvaEdgeHitArea = () => {
10712
+ };
10711
10713
  try {
10712
10714
  const InteractiveBase = fabric.InteractiveFabricObject ?? fabric.Object;
10713
10715
  if ((InteractiveBase == null ? void 0 : InteractiveBase.prototype) && !InteractiveBase.prototype.__pixldocsCenteredSelectionBorder) {
@@ -12486,6 +12488,7 @@ const PageCanvas = forwardRef(
12486
12488
  installCanvaMaskControls(group);
12487
12489
  applyControlSizeForZoom(group.canvas ?? fabricRef.current, group);
12488
12490
  ensureCanvaControlRenders(group);
12491
+ ensureCanvaEdgeHitArea(group);
12489
12492
  }, [calculateScaleSnapGuidesCallback, canvasHeight, canvasWidth, getLogicalGroupSnapBoundsCallback, getResizeExcludeIdsCallback, snapDuringScaleCallback]);
12490
12493
  const isTransforming = useCallback((canvas2) => {
12491
12494
  if (!canvas2) return false;
@@ -12732,14 +12735,16 @@ const PageCanvas = forwardRef(
12732
12735
  const EDGE_HIT_ALONG_MIN = 44;
12733
12736
  const CORNER_BUFFER = 24;
12734
12737
  const syncEdgeHitSizes = (obj) => {
12735
- var _a2;
12738
+ var _a2, _b2, _c2;
12736
12739
  if (!obj || !obj.controls) return;
12737
12740
  try {
12738
- const zoom3 = fabricCanvas.getZoom() || 1;
12741
+ ensureCanvaControlRenders(obj);
12742
+ const canvasForObj = obj.canvas ?? fabricCanvas;
12743
+ const zoom3 = ((_a2 = canvasForObj.getZoom) == null ? void 0 : _a2.call(canvasForObj)) || 1;
12739
12744
  let scaleX = obj.scaleX ?? 1;
12740
12745
  let scaleY = obj.scaleY ?? 1;
12741
12746
  try {
12742
- const m = (_a2 = obj.calcTransformMatrix) == null ? void 0 : _a2.call(obj);
12747
+ const m = (_b2 = obj.calcTransformMatrix) == null ? void 0 : _b2.call(obj);
12743
12748
  if (m) {
12744
12749
  const dec = fabric.util.qrDecompose(m);
12745
12750
  scaleX = Math.abs(dec.scaleX ?? scaleX);
@@ -12751,24 +12756,32 @@ const PageCanvas = forwardRef(
12751
12756
  const screenH = (obj.height ?? 0) * scaleY * zoom3;
12752
12757
  const alongW = Math.max(EDGE_HIT_ALONG_MIN, screenW - CORNER_BUFFER);
12753
12758
  const alongH = Math.max(EDGE_HIT_ALONG_MIN, screenH - CORNER_BUFFER);
12759
+ let changed = false;
12754
12760
  for (const k of ["ml", "mr"]) {
12755
12761
  const c = obj.controls[k];
12756
12762
  if (!c) continue;
12763
+ if (c.sizeY !== alongH || c.touchSizeY !== alongH) changed = true;
12757
12764
  c.sizeY = alongH;
12758
12765
  c.touchSizeY = alongH;
12759
12766
  }
12760
12767
  for (const k of ["mt", "mb"]) {
12761
12768
  const c = obj.controls[k];
12762
12769
  if (!c) continue;
12770
+ if (c.sizeX !== alongW || c.touchSizeX !== alongW) changed = true;
12763
12771
  c.sizeX = alongW;
12764
12772
  c.touchSizeX = alongW;
12765
12773
  }
12774
+ if (changed) (_c2 = obj.setCoords) == null ? void 0 : _c2.call(obj);
12766
12775
  } catch {
12767
12776
  }
12768
12777
  };
12778
+ ensureCanvaEdgeHitArea = syncEdgeHitSizes;
12769
12779
  const syncActive = () => {
12770
12780
  const obj = fabricCanvas.getActiveObject();
12771
- if (obj) syncEdgeHitSizes(obj);
12781
+ if (obj) {
12782
+ syncEdgeHitSizes(obj);
12783
+ requestAnimationFrame(() => syncEdgeHitSizes(obj));
12784
+ }
12772
12785
  };
12773
12786
  fabricCanvas.on("selection:created", syncActive);
12774
12787
  fabricCanvas.on("selection:updated", syncActive);
@@ -13277,9 +13290,11 @@ const PageCanvas = forwardRef(
13277
13290
  if (activeObj instanceof fabric.ActiveSelection) applyWarpAwareSelectionBorders(activeObj);
13278
13291
  if (activeObj) applyControlSizeForZoom(fabricCanvas, activeObj);
13279
13292
  if (activeObj) ensureCanvaControlRenders(activeObj);
13293
+ if (activeObj) ensureCanvaEdgeHitArea(activeObj);
13280
13294
  if (activeObj && !(activeObj instanceof fabric.ActiveSelection) && (((_a2 = activeObj._ct) == null ? void 0 : _a2.isCropGroup) || activeObj.__cropGroup)) {
13281
13295
  installImageResizeControlsWithSnap(activeObj);
13282
13296
  ensureCanvaControlRenders(activeObj);
13297
+ ensureCanvaEdgeHitArea(activeObj);
13283
13298
  }
13284
13299
  });
13285
13300
  fabricCanvas.on("selection:updated", () => {
@@ -13293,9 +13308,11 @@ const PageCanvas = forwardRef(
13293
13308
  if (activeObj instanceof fabric.ActiveSelection) applyWarpAwareSelectionBorders(activeObj);
13294
13309
  if (activeObj) applyControlSizeForZoom(fabricCanvas, activeObj);
13295
13310
  if (activeObj) ensureCanvaControlRenders(activeObj);
13311
+ if (activeObj) ensureCanvaEdgeHitArea(activeObj);
13296
13312
  if (activeObj && !(activeObj instanceof fabric.ActiveSelection) && (((_a2 = activeObj._ct) == null ? void 0 : _a2.isCropGroup) || activeObj.__cropGroup)) {
13297
13313
  installImageResizeControlsWithSnap(activeObj);
13298
13314
  ensureCanvaControlRenders(activeObj);
13315
+ ensureCanvaEdgeHitArea(activeObj);
13299
13316
  }
13300
13317
  });
13301
13318
  fabricCanvas.on("mouse:dblclick", (opt) => {
@@ -14324,6 +14341,10 @@ const PageCanvas = forwardRef(
14324
14341
  if (activeObj.__cornerResizeStart) {
14325
14342
  delete activeObj.__cornerResizeStart;
14326
14343
  }
14344
+ installImageResizeControlsWithSnap(activeObj);
14345
+ ensureCanvaControlRenders(activeObj);
14346
+ ensureCanvaEdgeHitArea(activeObj);
14347
+ activeObj.setCoords();
14327
14348
  }
14328
14349
  if (!didTransformRef.current) {
14329
14350
  editLockRef.current = false;
@@ -16768,7 +16789,10 @@ const PageCanvas = forwardRef(
16768
16789
  fc.setViewportTransform([zoom2, 0, 0, zoom2, 0, 0]);
16769
16790
  fc.getObjects().forEach((obj) => applyControlSizeForZoom(fc, obj));
16770
16791
  const active = fc.getActiveObject();
16771
- if (active && active instanceof fabric.ActiveSelection) applyControlSizeForZoom(fc, active);
16792
+ if (active) {
16793
+ if (active instanceof fabric.ActiveSelection) applyControlSizeForZoom(fc, active);
16794
+ ensureCanvaEdgeHitArea(active);
16795
+ }
16772
16796
  fc.requestRenderAll();
16773
16797
  }, [workspaceZoom, canvasWidth, canvasHeight]);
16774
16798
  useEffect(() => {
@@ -25616,9 +25640,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25616
25640
  }
25617
25641
  return svgString;
25618
25642
  }
25619
- const resolvedPackageVersion = "0.5.424";
25643
+ const resolvedPackageVersion = "0.5.426";
25620
25644
  const PACKAGE_VERSION = resolvedPackageVersion;
25621
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.424";
25645
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.426";
25622
25646
  const roundParityValue = (value) => {
25623
25647
  if (typeof value !== "number") return value;
25624
25648
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26432,7 +26456,7 @@ class PixldocsRenderer {
26432
26456
  await this.waitForCanvasScene(container, cloned, i);
26433
26457
  }
26434
26458
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26435
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Bm9r1fXg.js");
26459
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Bu0JJXZS.js");
26436
26460
  const prepared = preparePagesForExport(
26437
26461
  cloned.pages,
26438
26462
  canvasWidth,
@@ -28752,7 +28776,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28752
28776
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28753
28777
  sanitizeSvgTreeForPdf(svgToDraw);
28754
28778
  try {
28755
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Bm9r1fXg.js");
28779
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Bu0JJXZS.js");
28756
28780
  try {
28757
28781
  await logTextMeasurementDiagnostic(svgToDraw);
28758
28782
  } catch {
@@ -29152,4 +29176,4 @@ export {
29152
29176
  buildTeaserBlurFlatKeys as y,
29153
29177
  collectFontDescriptorsFromConfig as z
29154
29178
  };
29155
- //# sourceMappingURL=index-C7ab3jgT.js.map
29179
+ //# sourceMappingURL=index--hMXhxT-.js.map