@pixldocs/canvas-renderer 0.5.423 → 0.5.424

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.
@@ -12728,6 +12728,64 @@ const PageCanvas = forwardRef(
12728
12728
  prevKey = null;
12729
12729
  });
12730
12730
  }
12731
+ {
12732
+ const EDGE_HIT_ALONG_MIN = 44;
12733
+ const CORNER_BUFFER = 24;
12734
+ const syncEdgeHitSizes = (obj) => {
12735
+ var _a2;
12736
+ if (!obj || !obj.controls) return;
12737
+ try {
12738
+ const zoom3 = fabricCanvas.getZoom() || 1;
12739
+ let scaleX = obj.scaleX ?? 1;
12740
+ let scaleY = obj.scaleY ?? 1;
12741
+ try {
12742
+ const m = (_a2 = obj.calcTransformMatrix) == null ? void 0 : _a2.call(obj);
12743
+ if (m) {
12744
+ const dec = fabric.util.qrDecompose(m);
12745
+ scaleX = Math.abs(dec.scaleX ?? scaleX);
12746
+ scaleY = Math.abs(dec.scaleY ?? scaleY);
12747
+ }
12748
+ } catch {
12749
+ }
12750
+ const screenW = (obj.width ?? 0) * scaleX * zoom3;
12751
+ const screenH = (obj.height ?? 0) * scaleY * zoom3;
12752
+ const alongW = Math.max(EDGE_HIT_ALONG_MIN, screenW - CORNER_BUFFER);
12753
+ const alongH = Math.max(EDGE_HIT_ALONG_MIN, screenH - CORNER_BUFFER);
12754
+ for (const k of ["ml", "mr"]) {
12755
+ const c = obj.controls[k];
12756
+ if (!c) continue;
12757
+ c.sizeY = alongH;
12758
+ c.touchSizeY = alongH;
12759
+ }
12760
+ for (const k of ["mt", "mb"]) {
12761
+ const c = obj.controls[k];
12762
+ if (!c) continue;
12763
+ c.sizeX = alongW;
12764
+ c.touchSizeX = alongW;
12765
+ }
12766
+ } catch {
12767
+ }
12768
+ };
12769
+ const syncActive = () => {
12770
+ const obj = fabricCanvas.getActiveObject();
12771
+ if (obj) syncEdgeHitSizes(obj);
12772
+ };
12773
+ fabricCanvas.on("selection:created", syncActive);
12774
+ fabricCanvas.on("selection:updated", syncActive);
12775
+ fabricCanvas.on("object:scaling", (e) => syncEdgeHitSizes(e == null ? void 0 : e.target));
12776
+ fabricCanvas.on("object:modified", (e) => syncEdgeHitSizes(e == null ? void 0 : e.target));
12777
+ fabricCanvas.on("object:resizing", (e) => syncEdgeHitSizes(e == null ? void 0 : e.target));
12778
+ fabricCanvas.on("after:render", () => {
12779
+ const obj = fabricCanvas.getActiveObject();
12780
+ if (!obj) return;
12781
+ const lastZoom = obj.__pixldocsLastEdgeHitZoom;
12782
+ const z = fabricCanvas.getZoom() || 1;
12783
+ if (lastZoom !== z) {
12784
+ obj.__pixldocsLastEdgeHitZoom = z;
12785
+ syncEdgeHitSizes(obj);
12786
+ }
12787
+ });
12788
+ }
12731
12789
  const initFonts = async () => {
12732
12790
  try {
12733
12791
  await preloadAllFonts();
@@ -25558,9 +25616,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25558
25616
  }
25559
25617
  return svgString;
25560
25618
  }
25561
- const resolvedPackageVersion = "0.5.423";
25619
+ const resolvedPackageVersion = "0.5.424";
25562
25620
  const PACKAGE_VERSION = resolvedPackageVersion;
25563
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.423";
25621
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.424";
25564
25622
  const roundParityValue = (value) => {
25565
25623
  if (typeof value !== "number") return value;
25566
25624
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26374,7 +26432,7 @@ class PixldocsRenderer {
26374
26432
  await this.waitForCanvasScene(container, cloned, i);
26375
26433
  }
26376
26434
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26377
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CpifSUUc.js");
26435
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Bm9r1fXg.js");
26378
26436
  const prepared = preparePagesForExport(
26379
26437
  cloned.pages,
26380
26438
  canvasWidth,
@@ -28694,7 +28752,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28694
28752
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28695
28753
  sanitizeSvgTreeForPdf(svgToDraw);
28696
28754
  try {
28697
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CpifSUUc.js");
28755
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Bm9r1fXg.js");
28698
28756
  try {
28699
28757
  await logTextMeasurementDiagnostic(svgToDraw);
28700
28758
  } catch {
@@ -29094,4 +29152,4 @@ export {
29094
29152
  buildTeaserBlurFlatKeys as y,
29095
29153
  collectFontDescriptorsFromConfig as z
29096
29154
  };
29097
- //# sourceMappingURL=index-Bai6zGgn.js.map
29155
+ //# sourceMappingURL=index-C7ab3jgT.js.map