@pixldocs/canvas-renderer 0.5.259 → 0.5.261

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.
@@ -13481,6 +13481,14 @@ const PageCanvas = forwardRef(
13481
13481
  const isXSide = corner === "ml" || corner === "mr";
13482
13482
  const sAxis = isXSide ? Math.abs(obj.scaleX ?? 1) : Math.abs(obj.scaleY ?? 1);
13483
13483
  if (sAxis > 1e-3) {
13484
+ const asW0 = obj.width ?? 0;
13485
+ const asH0 = obj.height ?? 0;
13486
+ const asSx0 = obj.scaleX ?? 1;
13487
+ const asSy0 = obj.scaleY ?? 1;
13488
+ const asLeft0 = obj.left ?? 0;
13489
+ const asTop0 = obj.top ?? 0;
13490
+ const asRect0 = obj.getBoundingRect();
13491
+ let didReflowTextChild = false;
13484
13492
  for (const child of obj.getObjects()) {
13485
13493
  if (!(child instanceof fabric.Textbox)) continue;
13486
13494
  if (isXSide) {
@@ -13490,12 +13498,15 @@ const PageCanvas = forwardRef(
13490
13498
  const origW = child.__asLiveOrigW;
13491
13499
  const newW = Math.max(20, origW * sAxis);
13492
13500
  if (Math.abs((child.width ?? 0) - newW) > 0.5) {
13493
- child.set({ width: newW, scaleX: 1 / sAxis });
13501
+ child._set("width", newW);
13502
+ child._set("scaleX", 1 / sAxis);
13494
13503
  try {
13495
13504
  child.initDimensions();
13496
13505
  } catch {
13497
13506
  }
13507
+ child.setCoords();
13498
13508
  child.dirty = true;
13509
+ didReflowTextChild = true;
13499
13510
  }
13500
13511
  } else {
13501
13512
  if (child.__asLiveOrigH == null) {
@@ -13504,14 +13515,40 @@ const PageCanvas = forwardRef(
13504
13515
  const origH = child.__asLiveOrigH;
13505
13516
  const newH = Math.max(20, origH * sAxis);
13506
13517
  child.minBoxHeight = newH;
13507
- child.set({ scaleY: 1 / sAxis });
13518
+ child._set("scaleY", 1 / sAxis);
13508
13519
  try {
13509
13520
  child.initDimensions();
13510
13521
  } catch {
13511
13522
  }
13523
+ child.setCoords();
13512
13524
  child.dirty = true;
13525
+ didReflowTextChild = true;
13513
13526
  }
13514
13527
  }
13528
+ if (isXSide && didReflowTextChild && typeof obj.triggerLayout === "function") {
13529
+ try {
13530
+ obj.triggerLayout();
13531
+ } catch {
13532
+ }
13533
+ obj._set("width", asW0);
13534
+ obj._set("scaleX", asSx0);
13535
+ obj._set("scaleY", asSy0);
13536
+ obj.setCoords();
13537
+ const afterRect = obj.getBoundingRect();
13538
+ const fixedLeft = asRect0.left;
13539
+ const fixedRight = asRect0.left + asRect0.width;
13540
+ const nextLeft = corner === "ml" ? (obj.left ?? 0) + (fixedRight - (afterRect.left + afterRect.width)) : (obj.left ?? 0) + (fixedLeft - afterRect.left);
13541
+ obj._set("left", nextLeft);
13542
+ } else {
13543
+ obj._set("height", asH0);
13544
+ obj._set("left", asLeft0);
13545
+ obj._set("top", asTop0);
13546
+ }
13547
+ obj._set("width", asW0);
13548
+ obj._set("scaleX", asSx0);
13549
+ obj._set("scaleY", asSy0);
13550
+ obj.setCoords();
13551
+ obj.dirty = true;
13515
13552
  }
13516
13553
  }
13517
13554
  snapDuringScaleCallback(obj, corner);
@@ -23528,9 +23565,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
23528
23565
  }
23529
23566
  return svgString;
23530
23567
  }
23531
- const resolvedPackageVersion = "0.5.259";
23568
+ const resolvedPackageVersion = "0.5.261";
23532
23569
  const PACKAGE_VERSION = resolvedPackageVersion;
23533
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.259";
23570
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.261";
23534
23571
  const roundParityValue = (value) => {
23535
23572
  if (typeof value !== "number") return value;
23536
23573
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24344,7 +24381,7 @@ class PixldocsRenderer {
24344
24381
  await this.waitForCanvasScene(container, cloned, i);
24345
24382
  }
24346
24383
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
24347
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CNA_nPL_.js");
24384
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Q4d_WUkp.js");
24348
24385
  const prepared = preparePagesForExport(
24349
24386
  cloned.pages,
24350
24387
  canvasWidth,
@@ -26664,7 +26701,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
26664
26701
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
26665
26702
  sanitizeSvgTreeForPdf(svgToDraw);
26666
26703
  try {
26667
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CNA_nPL_.js");
26704
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Q4d_WUkp.js");
26668
26705
  try {
26669
26706
  await logTextMeasurementDiagnostic(svgToDraw);
26670
26707
  } catch {
@@ -27064,4 +27101,4 @@ export {
27064
27101
  buildTeaserBlurFlatKeys as y,
27065
27102
  collectFontDescriptorsFromConfig as z
27066
27103
  };
27067
- //# sourceMappingURL=index-DhFcz1Sq.js.map
27104
+ //# sourceMappingURL=index-CUdaMZ-i.js.map