@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.
@@ -12746,6 +12746,64 @@ const PageCanvas = react.forwardRef(
12746
12746
  prevKey = null;
12747
12747
  });
12748
12748
  }
12749
+ {
12750
+ const EDGE_HIT_ALONG_MIN = 44;
12751
+ const CORNER_BUFFER = 24;
12752
+ const syncEdgeHitSizes = (obj) => {
12753
+ var _a2;
12754
+ if (!obj || !obj.controls) return;
12755
+ try {
12756
+ const zoom3 = fabricCanvas.getZoom() || 1;
12757
+ let scaleX = obj.scaleX ?? 1;
12758
+ let scaleY = obj.scaleY ?? 1;
12759
+ try {
12760
+ const m = (_a2 = obj.calcTransformMatrix) == null ? void 0 : _a2.call(obj);
12761
+ if (m) {
12762
+ const dec = fabric__namespace.util.qrDecompose(m);
12763
+ scaleX = Math.abs(dec.scaleX ?? scaleX);
12764
+ scaleY = Math.abs(dec.scaleY ?? scaleY);
12765
+ }
12766
+ } catch {
12767
+ }
12768
+ const screenW = (obj.width ?? 0) * scaleX * zoom3;
12769
+ const screenH = (obj.height ?? 0) * scaleY * zoom3;
12770
+ const alongW = Math.max(EDGE_HIT_ALONG_MIN, screenW - CORNER_BUFFER);
12771
+ const alongH = Math.max(EDGE_HIT_ALONG_MIN, screenH - CORNER_BUFFER);
12772
+ for (const k of ["ml", "mr"]) {
12773
+ const c = obj.controls[k];
12774
+ if (!c) continue;
12775
+ c.sizeY = alongH;
12776
+ c.touchSizeY = alongH;
12777
+ }
12778
+ for (const k of ["mt", "mb"]) {
12779
+ const c = obj.controls[k];
12780
+ if (!c) continue;
12781
+ c.sizeX = alongW;
12782
+ c.touchSizeX = alongW;
12783
+ }
12784
+ } catch {
12785
+ }
12786
+ };
12787
+ const syncActive = () => {
12788
+ const obj = fabricCanvas.getActiveObject();
12789
+ if (obj) syncEdgeHitSizes(obj);
12790
+ };
12791
+ fabricCanvas.on("selection:created", syncActive);
12792
+ fabricCanvas.on("selection:updated", syncActive);
12793
+ fabricCanvas.on("object:scaling", (e) => syncEdgeHitSizes(e == null ? void 0 : e.target));
12794
+ fabricCanvas.on("object:modified", (e) => syncEdgeHitSizes(e == null ? void 0 : e.target));
12795
+ fabricCanvas.on("object:resizing", (e) => syncEdgeHitSizes(e == null ? void 0 : e.target));
12796
+ fabricCanvas.on("after:render", () => {
12797
+ const obj = fabricCanvas.getActiveObject();
12798
+ if (!obj) return;
12799
+ const lastZoom = obj.__pixldocsLastEdgeHitZoom;
12800
+ const z = fabricCanvas.getZoom() || 1;
12801
+ if (lastZoom !== z) {
12802
+ obj.__pixldocsLastEdgeHitZoom = z;
12803
+ syncEdgeHitSizes(obj);
12804
+ }
12805
+ });
12806
+ }
12749
12807
  const initFonts = async () => {
12750
12808
  try {
12751
12809
  await preloadAllFonts();
@@ -25576,9 +25634,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25576
25634
  }
25577
25635
  return svgString;
25578
25636
  }
25579
- const resolvedPackageVersion = "0.5.423";
25637
+ const resolvedPackageVersion = "0.5.424";
25580
25638
  const PACKAGE_VERSION = resolvedPackageVersion;
25581
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.423";
25639
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.424";
25582
25640
  const roundParityValue = (value) => {
25583
25641
  if (typeof value !== "number") return value;
25584
25642
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26392,7 +26450,7 @@ class PixldocsRenderer {
26392
26450
  await this.waitForCanvasScene(container, cloned, i);
26393
26451
  }
26394
26452
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26395
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DiLsMhi9.cjs"));
26453
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-JXuSAPvC.cjs"));
26396
26454
  const prepared = preparePagesForExport(
26397
26455
  cloned.pages,
26398
26456
  canvasWidth,
@@ -28712,7 +28770,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28712
28770
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28713
28771
  sanitizeSvgTreeForPdf(svgToDraw);
28714
28772
  try {
28715
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DiLsMhi9.cjs"));
28773
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-JXuSAPvC.cjs"));
28716
28774
  try {
28717
28775
  await logTextMeasurementDiagnostic(svgToDraw);
28718
28776
  } catch {
@@ -29109,4 +29167,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
29109
29167
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
29110
29168
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
29111
29169
  exports.warmTemplateFromForm = warmTemplateFromForm;
29112
- //# sourceMappingURL=index-DNExytIw.cjs.map
29170
+ //# sourceMappingURL=index-4LN7KRW_.cjs.map