@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.
@@ -14187,6 +14187,10 @@ const PageCanvas = react.forwardRef(
14187
14187
  if (child.__asLiveOrigH == null) {
14188
14188
  child.__asLiveOrigH = (child.height ?? 0) * (child.scaleY ?? 1);
14189
14189
  }
14190
+ if (child.__asLiveOrigMinH == null) {
14191
+ const m = Number(child.minBoxHeight);
14192
+ if (Number.isFinite(m) && m > 0) child.__asLiveOrigMinH = m;
14193
+ }
14190
14194
  const origH = child.__asLiveOrigH;
14191
14195
  const newH = Math.max(20, origH * sAxis);
14192
14196
  child.minBoxHeight = newH;
@@ -14474,6 +14478,7 @@ const PageCanvas = react.forwardRef(
14474
14478
  });
14475
14479
  fabricCanvas.on("object:rotating", (e) => {
14476
14480
  var _a2, _b2;
14481
+ prepareGroupSelectionTransformStart(e.target);
14477
14482
  markSimpleTransform(e);
14478
14483
  didTransformRef.current = true;
14479
14484
  const tr = e.target;
@@ -14642,16 +14647,6 @@ const PageCanvas = react.forwardRef(
14642
14647
  unlockEditsSoon();
14643
14648
  return;
14644
14649
  }
14645
- try {
14646
- const t = e.target;
14647
- if (t instanceof fabric__namespace.ActiveSelection) {
14648
- for (const child of t.getObjects()) {
14649
- delete child.__asLiveOrigW;
14650
- delete child.__asLiveOrigH;
14651
- }
14652
- }
14653
- } catch {
14654
- }
14655
14650
  groupShiftReflowSnapshotRef.current = null;
14656
14651
  lockEdits();
14657
14652
  const modifiedTargetId = modifiedTarget ? getObjectId(modifiedTarget) : null;
@@ -15479,16 +15474,27 @@ const PageCanvas = react.forwardRef(
15479
15474
  finalSkewY = (sourceElement == null ? void 0 : sourceElement.skewY) ?? obj.skewY ?? 0;
15480
15475
  if ((sourceElement == null ? void 0 : sourceElement.angle) !== void 0 || obj.angle !== void 0) finalAngleFromDecomposed = false;
15481
15476
  }
15482
- } else if (obj instanceof fabric__namespace.Textbox && isActiveSelection && (Math.abs((decomposed.scaleX ?? 1) - 1) > 1e-3 || Math.abs((decomposed.scaleY ?? 1) - 1) > 1e-3)) {
15483
- const sx = Math.abs(decomposed.scaleX || 1);
15484
- const sy = Math.abs(decomposed.scaleY || 1);
15477
+ } else if (obj instanceof fabric__namespace.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)) {
15478
+ const liveOrigW = obj.__asLiveOrigW;
15479
+ const liveOrigH = obj.__asLiveOrigH;
15480
+ const decSx = Math.abs(decomposed.scaleX || 1);
15481
+ const decSy = Math.abs(decomposed.scaleY || 1);
15482
+ const sx = Math.abs(decSx - 1) < 1e-3 && liveOrigW && liveOrigW > 0 ? Math.max(1e-3, (obj.width ?? liveOrigW) / liveOrigW) : decSx;
15483
+ const baseHForRecover = Number(
15484
+ obj.minBoxHeight ?? obj.height ?? liveOrigH ?? 1
15485
+ );
15486
+ const sy = Math.abs(decSy - 1) < 1e-3 && liveOrigH && liveOrigH > 0 ? Math.max(1e-3, baseHForRecover / liveOrigH) : decSy;
15485
15487
  const isLikelyUniformCorner = !activeSelectionResizeHandle && Math.abs(sx - sy) < 0.01 && Math.abs(sx - 1) > 1e-3;
15486
15488
  const isCornerHandle = activeSelectionResizeHandle === "tl" || activeSelectionResizeHandle === "tr" || activeSelectionResizeHandle === "bl" || activeSelectionResizeHandle === "br" || isLikelyUniformCorner;
15487
15489
  const isHeightSideHandle = activeSelectionResizeHandle === "mt" || activeSelectionResizeHandle === "mb";
15488
15490
  const fontScale = isCornerHandle ? Math.max(1e-3, Math.sqrt(sx * sy)) : 1;
15489
- const bakedWidth = Math.max(20, intrinsicWidth * sx);
15490
- const baseMinH = Number(obj.minBoxHeight ?? (sourceElement == null ? void 0 : sourceElement.minBoxHeight));
15491
- const nextMinH = Number.isFinite(baseMinH) && baseMinH > 0 ? baseMinH * sy : isHeightSideHandle ? Math.max(1, intrinsicHeight * sy) : void 0;
15491
+ const widthBase = liveOrigW && liveOrigW > 0 ? liveOrigW : intrinsicWidth;
15492
+ const heightBase = liveOrigH && liveOrigH > 0 ? liveOrigH : intrinsicHeight;
15493
+ const bakedWidth = Math.max(20, widthBase * sx);
15494
+ const liveMinHOrig = obj.__asLiveOrigMinH;
15495
+ const currentMinH = Number(obj.minBoxHeight ?? (sourceElement == null ? void 0 : sourceElement.minBoxHeight));
15496
+ const minHBase = Number.isFinite(liveMinHOrig) && liveMinHOrig > 0 ? liveMinHOrig : liveOrigH && liveOrigH > 0 ? currentMinH / sy : currentMinH;
15497
+ const nextMinH = Number.isFinite(minHBase) && minHBase > 0 ? minHBase * sy : isHeightSideHandle ? Math.max(1, heightBase * sy) : void 0;
15492
15498
  const bakedTextScaleUpdates = { width: bakedWidth };
15493
15499
  const debugTextBeforeBake = debugGroupTextCornerResize ? summarizeFabricObjectForResizeDebug(obj) : null;
15494
15500
  finalScaleX = 1;
@@ -15712,6 +15718,9 @@ const PageCanvas = react.forwardRef(
15712
15718
  }
15713
15719
  updateElement(objId, elementUpdate, { recordHistory: false, skipLayoutRecalc: true });
15714
15720
  obj.setCoords();
15721
+ delete obj.__asLiveOrigW;
15722
+ delete obj.__asLiveOrigH;
15723
+ delete obj.__asLiveOrigMinH;
15715
15724
  }
15716
15725
  if (isLogicalGroupAS && logicalGroupSelectionId && activeObj instanceof fabric__namespace.ActiveSelection) {
15717
15726
  try {
@@ -24870,9 +24879,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24870
24879
  }
24871
24880
  return svgString;
24872
24881
  }
24873
- const resolvedPackageVersion = "0.5.352";
24882
+ const resolvedPackageVersion = "0.5.353";
24874
24883
  const PACKAGE_VERSION = resolvedPackageVersion;
24875
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.352";
24884
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.353";
24876
24885
  const roundParityValue = (value) => {
24877
24886
  if (typeof value !== "number") return value;
24878
24887
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25686,7 +25695,7 @@ class PixldocsRenderer {
25686
25695
  await this.waitForCanvasScene(container, cloned, i);
25687
25696
  }
25688
25697
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25689
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DssfP9Fv.cjs"));
25698
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DihZwtD7.cjs"));
25690
25699
  const prepared = preparePagesForExport(
25691
25700
  cloned.pages,
25692
25701
  canvasWidth,
@@ -28006,7 +28015,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28006
28015
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28007
28016
  sanitizeSvgTreeForPdf(svgToDraw);
28008
28017
  try {
28009
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DssfP9Fv.cjs"));
28018
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DihZwtD7.cjs"));
28010
28019
  try {
28011
28020
  await logTextMeasurementDiagnostic(svgToDraw);
28012
28021
  } catch {
@@ -28403,4 +28412,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
28403
28412
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
28404
28413
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
28405
28414
  exports.warmTemplateFromForm = warmTemplateFromForm;
28406
- //# sourceMappingURL=index-BBwoWejC.cjs.map
28415
+ //# sourceMappingURL=index-UiuMKvLc.cjs.map