@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.
@@ -10726,6 +10726,8 @@ const SELECTION_PRIMARY = "hsl(217, 91%, 60%)";
10726
10726
  const SELECTION_BORDER_SCALE = 2;
10727
10727
  let ensureCanvaControlRenders = () => {
10728
10728
  };
10729
+ let ensureCanvaEdgeHitArea = () => {
10730
+ };
10729
10731
  try {
10730
10732
  const InteractiveBase = fabric__namespace.InteractiveFabricObject ?? fabric__namespace.Object;
10731
10733
  if ((InteractiveBase == null ? void 0 : InteractiveBase.prototype) && !InteractiveBase.prototype.__pixldocsCenteredSelectionBorder) {
@@ -12504,6 +12506,7 @@ const PageCanvas = react.forwardRef(
12504
12506
  installCanvaMaskControls(group);
12505
12507
  applyControlSizeForZoom(group.canvas ?? fabricRef.current, group);
12506
12508
  ensureCanvaControlRenders(group);
12509
+ ensureCanvaEdgeHitArea(group);
12507
12510
  }, [calculateScaleSnapGuidesCallback, canvasHeight, canvasWidth, getLogicalGroupSnapBoundsCallback, getResizeExcludeIdsCallback, snapDuringScaleCallback]);
12508
12511
  const isTransforming = react.useCallback((canvas2) => {
12509
12512
  if (!canvas2) return false;
@@ -12750,14 +12753,16 @@ const PageCanvas = react.forwardRef(
12750
12753
  const EDGE_HIT_ALONG_MIN = 44;
12751
12754
  const CORNER_BUFFER = 24;
12752
12755
  const syncEdgeHitSizes = (obj) => {
12753
- var _a2;
12756
+ var _a2, _b2, _c2;
12754
12757
  if (!obj || !obj.controls) return;
12755
12758
  try {
12756
- const zoom3 = fabricCanvas.getZoom() || 1;
12759
+ ensureCanvaControlRenders(obj);
12760
+ const canvasForObj = obj.canvas ?? fabricCanvas;
12761
+ const zoom3 = ((_a2 = canvasForObj.getZoom) == null ? void 0 : _a2.call(canvasForObj)) || 1;
12757
12762
  let scaleX = obj.scaleX ?? 1;
12758
12763
  let scaleY = obj.scaleY ?? 1;
12759
12764
  try {
12760
- const m = (_a2 = obj.calcTransformMatrix) == null ? void 0 : _a2.call(obj);
12765
+ const m = (_b2 = obj.calcTransformMatrix) == null ? void 0 : _b2.call(obj);
12761
12766
  if (m) {
12762
12767
  const dec = fabric__namespace.util.qrDecompose(m);
12763
12768
  scaleX = Math.abs(dec.scaleX ?? scaleX);
@@ -12769,24 +12774,32 @@ const PageCanvas = react.forwardRef(
12769
12774
  const screenH = (obj.height ?? 0) * scaleY * zoom3;
12770
12775
  const alongW = Math.max(EDGE_HIT_ALONG_MIN, screenW - CORNER_BUFFER);
12771
12776
  const alongH = Math.max(EDGE_HIT_ALONG_MIN, screenH - CORNER_BUFFER);
12777
+ let changed = false;
12772
12778
  for (const k of ["ml", "mr"]) {
12773
12779
  const c = obj.controls[k];
12774
12780
  if (!c) continue;
12781
+ if (c.sizeY !== alongH || c.touchSizeY !== alongH) changed = true;
12775
12782
  c.sizeY = alongH;
12776
12783
  c.touchSizeY = alongH;
12777
12784
  }
12778
12785
  for (const k of ["mt", "mb"]) {
12779
12786
  const c = obj.controls[k];
12780
12787
  if (!c) continue;
12788
+ if (c.sizeX !== alongW || c.touchSizeX !== alongW) changed = true;
12781
12789
  c.sizeX = alongW;
12782
12790
  c.touchSizeX = alongW;
12783
12791
  }
12792
+ if (changed) (_c2 = obj.setCoords) == null ? void 0 : _c2.call(obj);
12784
12793
  } catch {
12785
12794
  }
12786
12795
  };
12796
+ ensureCanvaEdgeHitArea = syncEdgeHitSizes;
12787
12797
  const syncActive = () => {
12788
12798
  const obj = fabricCanvas.getActiveObject();
12789
- if (obj) syncEdgeHitSizes(obj);
12799
+ if (obj) {
12800
+ syncEdgeHitSizes(obj);
12801
+ requestAnimationFrame(() => syncEdgeHitSizes(obj));
12802
+ }
12790
12803
  };
12791
12804
  fabricCanvas.on("selection:created", syncActive);
12792
12805
  fabricCanvas.on("selection:updated", syncActive);
@@ -13295,9 +13308,11 @@ const PageCanvas = react.forwardRef(
13295
13308
  if (activeObj instanceof fabric__namespace.ActiveSelection) applyWarpAwareSelectionBorders(activeObj);
13296
13309
  if (activeObj) applyControlSizeForZoom(fabricCanvas, activeObj);
13297
13310
  if (activeObj) ensureCanvaControlRenders(activeObj);
13311
+ if (activeObj) ensureCanvaEdgeHitArea(activeObj);
13298
13312
  if (activeObj && !(activeObj instanceof fabric__namespace.ActiveSelection) && (((_a2 = activeObj._ct) == null ? void 0 : _a2.isCropGroup) || activeObj.__cropGroup)) {
13299
13313
  installImageResizeControlsWithSnap(activeObj);
13300
13314
  ensureCanvaControlRenders(activeObj);
13315
+ ensureCanvaEdgeHitArea(activeObj);
13301
13316
  }
13302
13317
  });
13303
13318
  fabricCanvas.on("selection:updated", () => {
@@ -13311,9 +13326,11 @@ const PageCanvas = react.forwardRef(
13311
13326
  if (activeObj instanceof fabric__namespace.ActiveSelection) applyWarpAwareSelectionBorders(activeObj);
13312
13327
  if (activeObj) applyControlSizeForZoom(fabricCanvas, activeObj);
13313
13328
  if (activeObj) ensureCanvaControlRenders(activeObj);
13329
+ if (activeObj) ensureCanvaEdgeHitArea(activeObj);
13314
13330
  if (activeObj && !(activeObj instanceof fabric__namespace.ActiveSelection) && (((_a2 = activeObj._ct) == null ? void 0 : _a2.isCropGroup) || activeObj.__cropGroup)) {
13315
13331
  installImageResizeControlsWithSnap(activeObj);
13316
13332
  ensureCanvaControlRenders(activeObj);
13333
+ ensureCanvaEdgeHitArea(activeObj);
13317
13334
  }
13318
13335
  });
13319
13336
  fabricCanvas.on("mouse:dblclick", (opt) => {
@@ -14342,6 +14359,10 @@ const PageCanvas = react.forwardRef(
14342
14359
  if (activeObj.__cornerResizeStart) {
14343
14360
  delete activeObj.__cornerResizeStart;
14344
14361
  }
14362
+ installImageResizeControlsWithSnap(activeObj);
14363
+ ensureCanvaControlRenders(activeObj);
14364
+ ensureCanvaEdgeHitArea(activeObj);
14365
+ activeObj.setCoords();
14345
14366
  }
14346
14367
  if (!didTransformRef.current) {
14347
14368
  editLockRef.current = false;
@@ -16786,7 +16807,10 @@ const PageCanvas = react.forwardRef(
16786
16807
  fc.setViewportTransform([zoom2, 0, 0, zoom2, 0, 0]);
16787
16808
  fc.getObjects().forEach((obj) => applyControlSizeForZoom(fc, obj));
16788
16809
  const active = fc.getActiveObject();
16789
- if (active && active instanceof fabric__namespace.ActiveSelection) applyControlSizeForZoom(fc, active);
16810
+ if (active) {
16811
+ if (active instanceof fabric__namespace.ActiveSelection) applyControlSizeForZoom(fc, active);
16812
+ ensureCanvaEdgeHitArea(active);
16813
+ }
16790
16814
  fc.requestRenderAll();
16791
16815
  }, [workspaceZoom, canvasWidth, canvasHeight]);
16792
16816
  react.useEffect(() => {
@@ -25634,9 +25658,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25634
25658
  }
25635
25659
  return svgString;
25636
25660
  }
25637
- const resolvedPackageVersion = "0.5.424";
25661
+ const resolvedPackageVersion = "0.5.426";
25638
25662
  const PACKAGE_VERSION = resolvedPackageVersion;
25639
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.424";
25663
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.426";
25640
25664
  const roundParityValue = (value) => {
25641
25665
  if (typeof value !== "number") return value;
25642
25666
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26450,7 +26474,7 @@ class PixldocsRenderer {
26450
26474
  await this.waitForCanvasScene(container, cloned, i);
26451
26475
  }
26452
26476
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26453
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-JXuSAPvC.cjs"));
26477
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-onpGluLh.cjs"));
26454
26478
  const prepared = preparePagesForExport(
26455
26479
  cloned.pages,
26456
26480
  canvasWidth,
@@ -28770,7 +28794,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28770
28794
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28771
28795
  sanitizeSvgTreeForPdf(svgToDraw);
28772
28796
  try {
28773
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-JXuSAPvC.cjs"));
28797
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-onpGluLh.cjs"));
28774
28798
  try {
28775
28799
  await logTextMeasurementDiagnostic(svgToDraw);
28776
28800
  } catch {
@@ -29167,4 +29191,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
29167
29191
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
29168
29192
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
29169
29193
  exports.warmTemplateFromForm = warmTemplateFromForm;
29170
- //# sourceMappingURL=index-4LN7KRW_.cjs.map
29194
+ //# sourceMappingURL=index-ScUMI-6A.cjs.map