@pixldocs/canvas-renderer 0.5.352 → 0.5.353

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.
@@ -14169,6 +14169,10 @@ const PageCanvas = forwardRef(
14169
14169
  if (child.__asLiveOrigH == null) {
14170
14170
  child.__asLiveOrigH = (child.height ?? 0) * (child.scaleY ?? 1);
14171
14171
  }
14172
+ if (child.__asLiveOrigMinH == null) {
14173
+ const m = Number(child.minBoxHeight);
14174
+ if (Number.isFinite(m) && m > 0) child.__asLiveOrigMinH = m;
14175
+ }
14172
14176
  const origH = child.__asLiveOrigH;
14173
14177
  const newH = Math.max(20, origH * sAxis);
14174
14178
  child.minBoxHeight = newH;
@@ -14456,6 +14460,7 @@ const PageCanvas = forwardRef(
14456
14460
  });
14457
14461
  fabricCanvas.on("object:rotating", (e) => {
14458
14462
  var _a2, _b2;
14463
+ prepareGroupSelectionTransformStart(e.target);
14459
14464
  markSimpleTransform(e);
14460
14465
  didTransformRef.current = true;
14461
14466
  const tr = e.target;
@@ -14624,16 +14629,6 @@ const PageCanvas = forwardRef(
14624
14629
  unlockEditsSoon();
14625
14630
  return;
14626
14631
  }
14627
- try {
14628
- const t = e.target;
14629
- if (t instanceof fabric.ActiveSelection) {
14630
- for (const child of t.getObjects()) {
14631
- delete child.__asLiveOrigW;
14632
- delete child.__asLiveOrigH;
14633
- }
14634
- }
14635
- } catch {
14636
- }
14637
14632
  groupShiftReflowSnapshotRef.current = null;
14638
14633
  lockEdits();
14639
14634
  const modifiedTargetId = modifiedTarget ? getObjectId(modifiedTarget) : null;
@@ -15461,16 +15456,27 @@ const PageCanvas = forwardRef(
15461
15456
  finalSkewY = (sourceElement == null ? void 0 : sourceElement.skewY) ?? obj.skewY ?? 0;
15462
15457
  if ((sourceElement == null ? void 0 : sourceElement.angle) !== void 0 || obj.angle !== void 0) finalAngleFromDecomposed = false;
15463
15458
  }
15464
- } else if (obj instanceof fabric.Textbox && isActiveSelection && (Math.abs((decomposed.scaleX ?? 1) - 1) > 1e-3 || Math.abs((decomposed.scaleY ?? 1) - 1) > 1e-3)) {
15465
- const sx = Math.abs(decomposed.scaleX || 1);
15466
- const sy = Math.abs(decomposed.scaleY || 1);
15459
+ } else if (obj instanceof fabric.Textbox && isActiveSelection && (activeSelectionResizeHandle != null || obj.__asLiveOrigW != null || obj.__asLiveOrigH != null || Math.abs((decomposed.scaleX ?? 1) - 1) > 1e-3 || Math.abs((decomposed.scaleY ?? 1) - 1) > 1e-3)) {
15460
+ const liveOrigW = obj.__asLiveOrigW;
15461
+ const liveOrigH = obj.__asLiveOrigH;
15462
+ const decSx = Math.abs(decomposed.scaleX || 1);
15463
+ const decSy = Math.abs(decomposed.scaleY || 1);
15464
+ const sx = Math.abs(decSx - 1) < 1e-3 && liveOrigW && liveOrigW > 0 ? Math.max(1e-3, (obj.width ?? liveOrigW) / liveOrigW) : decSx;
15465
+ const baseHForRecover = Number(
15466
+ obj.minBoxHeight ?? obj.height ?? liveOrigH ?? 1
15467
+ );
15468
+ const sy = Math.abs(decSy - 1) < 1e-3 && liveOrigH && liveOrigH > 0 ? Math.max(1e-3, baseHForRecover / liveOrigH) : decSy;
15467
15469
  const isLikelyUniformCorner = !activeSelectionResizeHandle && Math.abs(sx - sy) < 0.01 && Math.abs(sx - 1) > 1e-3;
15468
15470
  const isCornerHandle = activeSelectionResizeHandle === "tl" || activeSelectionResizeHandle === "tr" || activeSelectionResizeHandle === "bl" || activeSelectionResizeHandle === "br" || isLikelyUniformCorner;
15469
15471
  const isHeightSideHandle = activeSelectionResizeHandle === "mt" || activeSelectionResizeHandle === "mb";
15470
15472
  const fontScale = isCornerHandle ? Math.max(1e-3, Math.sqrt(sx * sy)) : 1;
15471
- const bakedWidth = Math.max(20, intrinsicWidth * sx);
15472
- const baseMinH = Number(obj.minBoxHeight ?? (sourceElement == null ? void 0 : sourceElement.minBoxHeight));
15473
- const nextMinH = Number.isFinite(baseMinH) && baseMinH > 0 ? baseMinH * sy : isHeightSideHandle ? Math.max(1, intrinsicHeight * sy) : void 0;
15473
+ const widthBase = liveOrigW && liveOrigW > 0 ? liveOrigW : intrinsicWidth;
15474
+ const heightBase = liveOrigH && liveOrigH > 0 ? liveOrigH : intrinsicHeight;
15475
+ const bakedWidth = Math.max(20, widthBase * sx);
15476
+ const liveMinHOrig = obj.__asLiveOrigMinH;
15477
+ const currentMinH = Number(obj.minBoxHeight ?? (sourceElement == null ? void 0 : sourceElement.minBoxHeight));
15478
+ const minHBase = Number.isFinite(liveMinHOrig) && liveMinHOrig > 0 ? liveMinHOrig : liveOrigH && liveOrigH > 0 ? currentMinH / sy : currentMinH;
15479
+ const nextMinH = Number.isFinite(minHBase) && minHBase > 0 ? minHBase * sy : isHeightSideHandle ? Math.max(1, heightBase * sy) : void 0;
15474
15480
  const bakedTextScaleUpdates = { width: bakedWidth };
15475
15481
  const debugTextBeforeBake = debugGroupTextCornerResize ? summarizeFabricObjectForResizeDebug(obj) : null;
15476
15482
  finalScaleX = 1;
@@ -15694,6 +15700,9 @@ const PageCanvas = forwardRef(
15694
15700
  }
15695
15701
  updateElement(objId, elementUpdate, { recordHistory: false, skipLayoutRecalc: true });
15696
15702
  obj.setCoords();
15703
+ delete obj.__asLiveOrigW;
15704
+ delete obj.__asLiveOrigH;
15705
+ delete obj.__asLiveOrigMinH;
15697
15706
  }
15698
15707
  if (isLogicalGroupAS && logicalGroupSelectionId && activeObj instanceof fabric.ActiveSelection) {
15699
15708
  try {
@@ -24852,9 +24861,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24852
24861
  }
24853
24862
  return svgString;
24854
24863
  }
24855
- const resolvedPackageVersion = "0.5.352";
24864
+ const resolvedPackageVersion = "0.5.353";
24856
24865
  const PACKAGE_VERSION = resolvedPackageVersion;
24857
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.352";
24866
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.353";
24858
24867
  const roundParityValue = (value) => {
24859
24868
  if (typeof value !== "number") return value;
24860
24869
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25668,7 +25677,7 @@ class PixldocsRenderer {
25668
25677
  await this.waitForCanvasScene(container, cloned, i);
25669
25678
  }
25670
25679
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25671
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DyD0q_mD.js");
25680
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BvY4a5sT.js");
25672
25681
  const prepared = preparePagesForExport(
25673
25682
  cloned.pages,
25674
25683
  canvasWidth,
@@ -27988,7 +27997,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27988
27997
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27989
27998
  sanitizeSvgTreeForPdf(svgToDraw);
27990
27999
  try {
27991
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DyD0q_mD.js");
28000
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BvY4a5sT.js");
27992
28001
  try {
27993
28002
  await logTextMeasurementDiagnostic(svgToDraw);
27994
28003
  } catch {
@@ -28388,4 +28397,4 @@ export {
28388
28397
  buildTeaserBlurFlatKeys as y,
28389
28398
  collectFontDescriptorsFromConfig as z
28390
28399
  };
28391
- //# sourceMappingURL=index-CJLS3Ey3.js.map
28400
+ //# sourceMappingURL=index-C32C3XZP.js.map