@pixldocs/canvas-renderer 0.5.298 → 0.5.300

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.
@@ -13432,7 +13432,7 @@ const PageCanvas = react.forwardRef(
13432
13432
  fabricCanvas.on("selection:cleared", () => {
13433
13433
  });
13434
13434
  fabricCanvas.on("object:scaling", (e) => {
13435
- var _a2, _b2;
13435
+ var _a2, _b2, _c;
13436
13436
  if (!isActiveRef.current) return;
13437
13437
  const t = e.target;
13438
13438
  if (t) lastResizeScaleTargetRef.current = t;
@@ -13618,6 +13618,76 @@ const PageCanvas = react.forwardRef(
13618
13618
  const asRect0 = obj.getBoundingRect();
13619
13619
  let didReflowTextChild = false;
13620
13620
  for (const child of obj.getObjects()) {
13621
+ if (child instanceof fabric__namespace.Group && (child.__cropGroup || ((_b2 = child._ct) == null ? void 0 : _b2.isCropGroup))) {
13622
+ const ct = child.__cropData;
13623
+ if (!ct) continue;
13624
+ if (isXSide) {
13625
+ if (child.__asLiveOrigW == null) {
13626
+ const baseW = child.width ?? ct.frameW ?? 0;
13627
+ child.__asLiveOrigW = baseW * (child.scaleX ?? 1);
13628
+ }
13629
+ const origW = child.__asLiveOrigW;
13630
+ const newW = Math.max(20, origW * sAxis);
13631
+ if (Math.abs((child.width ?? 0) - newW) > 0.5) {
13632
+ ct.frameW = newW;
13633
+ child._set("width", newW);
13634
+ child._set("scaleX", 1 / sAxis);
13635
+ try {
13636
+ updateCoverLayout(child);
13637
+ } catch {
13638
+ }
13639
+ child.setCoords();
13640
+ child.dirty = true;
13641
+ }
13642
+ } else {
13643
+ if (child.__asLiveOrigH == null) {
13644
+ const baseH = child.height ?? ct.frameH ?? 0;
13645
+ child.__asLiveOrigH = baseH * (child.scaleY ?? 1);
13646
+ }
13647
+ const origH = child.__asLiveOrigH;
13648
+ const newH = Math.max(20, origH * sAxis);
13649
+ if (Math.abs((child.height ?? 0) - newH) > 0.5) {
13650
+ ct.frameH = newH;
13651
+ child._set("height", newH);
13652
+ child._set("scaleY", 1 / sAxis);
13653
+ try {
13654
+ updateCoverLayout(child);
13655
+ } catch {
13656
+ }
13657
+ child.setCoords();
13658
+ child.dirty = true;
13659
+ }
13660
+ }
13661
+ continue;
13662
+ }
13663
+ if (child instanceof fabric__namespace.FabricImage && !child.__cropGroup && !child.smartElementType) {
13664
+ if (isXSide) {
13665
+ if (child.__asLiveOrigW == null) {
13666
+ child.__asLiveOrigW = (child.width ?? 0) * (child.scaleX ?? 1);
13667
+ }
13668
+ const origW = child.__asLiveOrigW;
13669
+ const newW = Math.max(1, origW * sAxis);
13670
+ if (Math.abs((child.width ?? 0) - newW) > 0.5) {
13671
+ child._set("width", newW);
13672
+ child._set("scaleX", 1 / sAxis);
13673
+ child.setCoords();
13674
+ child.dirty = true;
13675
+ }
13676
+ } else {
13677
+ if (child.__asLiveOrigH == null) {
13678
+ child.__asLiveOrigH = (child.height ?? 0) * (child.scaleY ?? 1);
13679
+ }
13680
+ const origH = child.__asLiveOrigH;
13681
+ const newH = Math.max(1, origH * sAxis);
13682
+ if (Math.abs((child.height ?? 0) - newH) > 0.5) {
13683
+ child._set("height", newH);
13684
+ child._set("scaleY", 1 / sAxis);
13685
+ child.setCoords();
13686
+ child.dirty = true;
13687
+ }
13688
+ }
13689
+ continue;
13690
+ }
13621
13691
  if (!(child instanceof fabric__namespace.Textbox)) continue;
13622
13692
  if (isXSide) {
13623
13693
  if (child.__asLiveOrigW == null) {
@@ -13766,7 +13836,7 @@ const PageCanvas = react.forwardRef(
13766
13836
  setGuides(gridGuidesForScale.length ? [...scaleGuides, ...gridGuidesForScale] : scaleGuides);
13767
13837
  if (drilledGroupIdRef.current) {
13768
13838
  try {
13769
- (_b2 = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _b2.call(fabricCanvas);
13839
+ (_c = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _c.call(fabricCanvas);
13770
13840
  } catch {
13771
13841
  }
13772
13842
  }
@@ -14497,8 +14567,8 @@ const PageCanvas = react.forwardRef(
14497
14567
  if (ct) {
14498
14568
  const sourceFrameW = Math.max(1, ct.frameW ?? obj.width ?? 1);
14499
14569
  const sourceFrameH = Math.max(1, ct.frameH ?? obj.height ?? 1);
14500
- const appliedScaleX = Math.abs(isActiveSelection && activeObj ? activeObj.scaleX ?? 1 : obj.scaleX ?? 1);
14501
- const appliedScaleY = Math.abs(isActiveSelection && activeObj ? activeObj.scaleY ?? 1 : obj.scaleY ?? 1);
14570
+ const appliedScaleX = isActiveSelection && activeObj ? Math.abs((activeObj.scaleX ?? 1) * (obj.scaleX ?? 1)) : Math.abs(obj.scaleX ?? 1);
14571
+ const appliedScaleY = isActiveSelection && activeObj ? Math.abs((activeObj.scaleY ?? 1) * (obj.scaleY ?? 1)) : Math.abs(obj.scaleY ?? 1);
14502
14572
  finalWidth = Math.max(1, sourceFrameW * appliedScaleX);
14503
14573
  finalHeight = Math.max(1, sourceFrameH * appliedScaleY);
14504
14574
  finalScaleX = 1;
@@ -23945,9 +24015,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
23945
24015
  }
23946
24016
  return svgString;
23947
24017
  }
23948
- const resolvedPackageVersion = "0.5.298";
24018
+ const resolvedPackageVersion = "0.5.300";
23949
24019
  const PACKAGE_VERSION = resolvedPackageVersion;
23950
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.298";
24020
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.300";
23951
24021
  const roundParityValue = (value) => {
23952
24022
  if (typeof value !== "number") return value;
23953
24023
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24761,7 +24831,7 @@ class PixldocsRenderer {
24761
24831
  await this.waitForCanvasScene(container, cloned, i);
24762
24832
  }
24763
24833
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
24764
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BrPykWdO.cjs"));
24834
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BVHpWHXp.cjs"));
24765
24835
  const prepared = preparePagesForExport(
24766
24836
  cloned.pages,
24767
24837
  canvasWidth,
@@ -27081,7 +27151,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27081
27151
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27082
27152
  sanitizeSvgTreeForPdf(svgToDraw);
27083
27153
  try {
27084
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BrPykWdO.cjs"));
27154
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BVHpWHXp.cjs"));
27085
27155
  try {
27086
27156
  await logTextMeasurementDiagnostic(svgToDraw);
27087
27157
  } catch {
@@ -27478,4 +27548,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
27478
27548
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
27479
27549
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
27480
27550
  exports.warmTemplateFromForm = warmTemplateFromForm;
27481
- //# sourceMappingURL=index-BzOCkAOn.cjs.map
27551
+ //# sourceMappingURL=index-eWyfu-3k.cjs.map