@pixldocs/canvas-renderer 0.5.424 → 0.5.425

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) {
@@ -12732,14 +12734,16 @@ const PageCanvas = forwardRef(
12732
12734
  const EDGE_HIT_ALONG_MIN = 44;
12733
12735
  const CORNER_BUFFER = 24;
12734
12736
  const syncEdgeHitSizes = (obj) => {
12735
- var _a2;
12737
+ var _a2, _b2, _c2;
12736
12738
  if (!obj || !obj.controls) return;
12737
12739
  try {
12738
- const zoom3 = fabricCanvas.getZoom() || 1;
12740
+ ensureCanvaControlRenders(obj);
12741
+ const canvasForObj = obj.canvas ?? fabricCanvas;
12742
+ const zoom3 = ((_a2 = canvasForObj.getZoom) == null ? void 0 : _a2.call(canvasForObj)) || 1;
12739
12743
  let scaleX = obj.scaleX ?? 1;
12740
12744
  let scaleY = obj.scaleY ?? 1;
12741
12745
  try {
12742
- const m = (_a2 = obj.calcTransformMatrix) == null ? void 0 : _a2.call(obj);
12746
+ const m = (_b2 = obj.calcTransformMatrix) == null ? void 0 : _b2.call(obj);
12743
12747
  if (m) {
12744
12748
  const dec = fabric.util.qrDecompose(m);
12745
12749
  scaleX = Math.abs(dec.scaleX ?? scaleX);
@@ -12751,24 +12755,32 @@ const PageCanvas = forwardRef(
12751
12755
  const screenH = (obj.height ?? 0) * scaleY * zoom3;
12752
12756
  const alongW = Math.max(EDGE_HIT_ALONG_MIN, screenW - CORNER_BUFFER);
12753
12757
  const alongH = Math.max(EDGE_HIT_ALONG_MIN, screenH - CORNER_BUFFER);
12758
+ let changed = false;
12754
12759
  for (const k of ["ml", "mr"]) {
12755
12760
  const c = obj.controls[k];
12756
12761
  if (!c) continue;
12762
+ if (c.sizeY !== alongH || c.touchSizeY !== alongH) changed = true;
12757
12763
  c.sizeY = alongH;
12758
12764
  c.touchSizeY = alongH;
12759
12765
  }
12760
12766
  for (const k of ["mt", "mb"]) {
12761
12767
  const c = obj.controls[k];
12762
12768
  if (!c) continue;
12769
+ if (c.sizeX !== alongW || c.touchSizeX !== alongW) changed = true;
12763
12770
  c.sizeX = alongW;
12764
12771
  c.touchSizeX = alongW;
12765
12772
  }
12773
+ if (changed) (_c2 = obj.setCoords) == null ? void 0 : _c2.call(obj);
12766
12774
  } catch {
12767
12775
  }
12768
12776
  };
12777
+ ensureCanvaEdgeHitArea = syncEdgeHitSizes;
12769
12778
  const syncActive = () => {
12770
12779
  const obj = fabricCanvas.getActiveObject();
12771
- if (obj) syncEdgeHitSizes(obj);
12780
+ if (obj) {
12781
+ syncEdgeHitSizes(obj);
12782
+ requestAnimationFrame(() => syncEdgeHitSizes(obj));
12783
+ }
12772
12784
  };
12773
12785
  fabricCanvas.on("selection:created", syncActive);
12774
12786
  fabricCanvas.on("selection:updated", syncActive);
@@ -13277,9 +13289,11 @@ const PageCanvas = forwardRef(
13277
13289
  if (activeObj instanceof fabric.ActiveSelection) applyWarpAwareSelectionBorders(activeObj);
13278
13290
  if (activeObj) applyControlSizeForZoom(fabricCanvas, activeObj);
13279
13291
  if (activeObj) ensureCanvaControlRenders(activeObj);
13292
+ if (activeObj) ensureCanvaEdgeHitArea(activeObj);
13280
13293
  if (activeObj && !(activeObj instanceof fabric.ActiveSelection) && (((_a2 = activeObj._ct) == null ? void 0 : _a2.isCropGroup) || activeObj.__cropGroup)) {
13281
13294
  installImageResizeControlsWithSnap(activeObj);
13282
13295
  ensureCanvaControlRenders(activeObj);
13296
+ ensureCanvaEdgeHitArea(activeObj);
13283
13297
  }
13284
13298
  });
13285
13299
  fabricCanvas.on("selection:updated", () => {
@@ -13293,9 +13307,11 @@ const PageCanvas = forwardRef(
13293
13307
  if (activeObj instanceof fabric.ActiveSelection) applyWarpAwareSelectionBorders(activeObj);
13294
13308
  if (activeObj) applyControlSizeForZoom(fabricCanvas, activeObj);
13295
13309
  if (activeObj) ensureCanvaControlRenders(activeObj);
13310
+ if (activeObj) ensureCanvaEdgeHitArea(activeObj);
13296
13311
  if (activeObj && !(activeObj instanceof fabric.ActiveSelection) && (((_a2 = activeObj._ct) == null ? void 0 : _a2.isCropGroup) || activeObj.__cropGroup)) {
13297
13312
  installImageResizeControlsWithSnap(activeObj);
13298
13313
  ensureCanvaControlRenders(activeObj);
13314
+ ensureCanvaEdgeHitArea(activeObj);
13299
13315
  }
13300
13316
  });
13301
13317
  fabricCanvas.on("mouse:dblclick", (opt) => {
@@ -16768,7 +16784,10 @@ const PageCanvas = forwardRef(
16768
16784
  fc.setViewportTransform([zoom2, 0, 0, zoom2, 0, 0]);
16769
16785
  fc.getObjects().forEach((obj) => applyControlSizeForZoom(fc, obj));
16770
16786
  const active = fc.getActiveObject();
16771
- if (active && active instanceof fabric.ActiveSelection) applyControlSizeForZoom(fc, active);
16787
+ if (active) {
16788
+ if (active instanceof fabric.ActiveSelection) applyControlSizeForZoom(fc, active);
16789
+ ensureCanvaEdgeHitArea(active);
16790
+ }
16772
16791
  fc.requestRenderAll();
16773
16792
  }, [workspaceZoom, canvasWidth, canvasHeight]);
16774
16793
  useEffect(() => {
@@ -25616,9 +25635,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25616
25635
  }
25617
25636
  return svgString;
25618
25637
  }
25619
- const resolvedPackageVersion = "0.5.424";
25638
+ const resolvedPackageVersion = "0.5.425";
25620
25639
  const PACKAGE_VERSION = resolvedPackageVersion;
25621
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.424";
25640
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.425";
25622
25641
  const roundParityValue = (value) => {
25623
25642
  if (typeof value !== "number") return value;
25624
25643
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26432,7 +26451,7 @@ class PixldocsRenderer {
26432
26451
  await this.waitForCanvasScene(container, cloned, i);
26433
26452
  }
26434
26453
  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");
26454
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DR3TOj0C.js");
26436
26455
  const prepared = preparePagesForExport(
26437
26456
  cloned.pages,
26438
26457
  canvasWidth,
@@ -28752,7 +28771,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28752
28771
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28753
28772
  sanitizeSvgTreeForPdf(svgToDraw);
28754
28773
  try {
28755
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Bm9r1fXg.js");
28774
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DR3TOj0C.js");
28756
28775
  try {
28757
28776
  await logTextMeasurementDiagnostic(svgToDraw);
28758
28777
  } catch {
@@ -29152,4 +29171,4 @@ export {
29152
29171
  buildTeaserBlurFlatKeys as y,
29153
29172
  collectFontDescriptorsFromConfig as z
29154
29173
  };
29155
- //# sourceMappingURL=index-C7ab3jgT.js.map
29174
+ //# sourceMappingURL=index-C3izL-t6.js.map