@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.
@@ -13499,6 +13499,14 @@ const PageCanvas = react.forwardRef(
13499
13499
  const isXSide = corner === "ml" || corner === "mr";
13500
13500
  const sAxis = isXSide ? Math.abs(obj.scaleX ?? 1) : Math.abs(obj.scaleY ?? 1);
13501
13501
  if (sAxis > 1e-3) {
13502
+ const asW0 = obj.width ?? 0;
13503
+ const asH0 = obj.height ?? 0;
13504
+ const asSx0 = obj.scaleX ?? 1;
13505
+ const asSy0 = obj.scaleY ?? 1;
13506
+ const asLeft0 = obj.left ?? 0;
13507
+ const asTop0 = obj.top ?? 0;
13508
+ const asRect0 = obj.getBoundingRect();
13509
+ let didReflowTextChild = false;
13502
13510
  for (const child of obj.getObjects()) {
13503
13511
  if (!(child instanceof fabric__namespace.Textbox)) continue;
13504
13512
  if (isXSide) {
@@ -13508,12 +13516,15 @@ const PageCanvas = react.forwardRef(
13508
13516
  const origW = child.__asLiveOrigW;
13509
13517
  const newW = Math.max(20, origW * sAxis);
13510
13518
  if (Math.abs((child.width ?? 0) - newW) > 0.5) {
13511
- child.set({ width: newW, scaleX: 1 / sAxis });
13519
+ child._set("width", newW);
13520
+ child._set("scaleX", 1 / sAxis);
13512
13521
  try {
13513
13522
  child.initDimensions();
13514
13523
  } catch {
13515
13524
  }
13525
+ child.setCoords();
13516
13526
  child.dirty = true;
13527
+ didReflowTextChild = true;
13517
13528
  }
13518
13529
  } else {
13519
13530
  if (child.__asLiveOrigH == null) {
@@ -13522,14 +13533,40 @@ const PageCanvas = react.forwardRef(
13522
13533
  const origH = child.__asLiveOrigH;
13523
13534
  const newH = Math.max(20, origH * sAxis);
13524
13535
  child.minBoxHeight = newH;
13525
- child.set({ scaleY: 1 / sAxis });
13536
+ child._set("scaleY", 1 / sAxis);
13526
13537
  try {
13527
13538
  child.initDimensions();
13528
13539
  } catch {
13529
13540
  }
13541
+ child.setCoords();
13530
13542
  child.dirty = true;
13543
+ didReflowTextChild = true;
13531
13544
  }
13532
13545
  }
13546
+ if (isXSide && didReflowTextChild && typeof obj.triggerLayout === "function") {
13547
+ try {
13548
+ obj.triggerLayout();
13549
+ } catch {
13550
+ }
13551
+ obj._set("width", asW0);
13552
+ obj._set("scaleX", asSx0);
13553
+ obj._set("scaleY", asSy0);
13554
+ obj.setCoords();
13555
+ const afterRect = obj.getBoundingRect();
13556
+ const fixedLeft = asRect0.left;
13557
+ const fixedRight = asRect0.left + asRect0.width;
13558
+ const nextLeft = corner === "ml" ? (obj.left ?? 0) + (fixedRight - (afterRect.left + afterRect.width)) : (obj.left ?? 0) + (fixedLeft - afterRect.left);
13559
+ obj._set("left", nextLeft);
13560
+ } else {
13561
+ obj._set("height", asH0);
13562
+ obj._set("left", asLeft0);
13563
+ obj._set("top", asTop0);
13564
+ }
13565
+ obj._set("width", asW0);
13566
+ obj._set("scaleX", asSx0);
13567
+ obj._set("scaleY", asSy0);
13568
+ obj.setCoords();
13569
+ obj.dirty = true;
13533
13570
  }
13534
13571
  }
13535
13572
  snapDuringScaleCallback(obj, corner);
@@ -23546,9 +23583,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
23546
23583
  }
23547
23584
  return svgString;
23548
23585
  }
23549
- const resolvedPackageVersion = "0.5.259";
23586
+ const resolvedPackageVersion = "0.5.261";
23550
23587
  const PACKAGE_VERSION = resolvedPackageVersion;
23551
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.259";
23588
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.261";
23552
23589
  const roundParityValue = (value) => {
23553
23590
  if (typeof value !== "number") return value;
23554
23591
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24362,7 +24399,7 @@ class PixldocsRenderer {
24362
24399
  await this.waitForCanvasScene(container, cloned, i);
24363
24400
  }
24364
24401
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
24365
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-Bbu4wM29.cjs"));
24402
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BsjP4JQb.cjs"));
24366
24403
  const prepared = preparePagesForExport(
24367
24404
  cloned.pages,
24368
24405
  canvasWidth,
@@ -26682,7 +26719,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
26682
26719
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
26683
26720
  sanitizeSvgTreeForPdf(svgToDraw);
26684
26721
  try {
26685
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-Bbu4wM29.cjs"));
26722
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BsjP4JQb.cjs"));
26686
26723
  try {
26687
26724
  await logTextMeasurementDiagnostic(svgToDraw);
26688
26725
  } catch {
@@ -27079,4 +27116,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
27079
27116
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
27080
27117
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
27081
27118
  exports.warmTemplateFromForm = warmTemplateFromForm;
27082
- //# sourceMappingURL=index-CUomvTwt.cjs.map
27119
+ //# sourceMappingURL=index-Dfc18rpJ.cjs.map