@pixldocs/canvas-renderer 0.5.351 → 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;
@@ -14635,18 +14640,13 @@ const PageCanvas = react.forwardRef(
14635
14640
  }
14636
14641
  const modifiedTarget = e.target;
14637
14642
  if (modifiedTarget instanceof fabric__namespace.ActiveSelection && modifiedTarget.getObjects().length === 0) {
14643
+ didTransformRef.current = false;
14644
+ groupSelectionTransformStartRef.current = null;
14645
+ activeSelectionMoveStartRef.current = null;
14646
+ activeSelectionResizeHandleRef.current = null;
14647
+ unlockEditsSoon();
14638
14648
  return;
14639
14649
  }
14640
- try {
14641
- const t = e.target;
14642
- if (t instanceof fabric__namespace.ActiveSelection) {
14643
- for (const child of t.getObjects()) {
14644
- delete child.__asLiveOrigW;
14645
- delete child.__asLiveOrigH;
14646
- }
14647
- }
14648
- } catch {
14649
- }
14650
14650
  groupShiftReflowSnapshotRef.current = null;
14651
14651
  lockEdits();
14652
14652
  const modifiedTargetId = modifiedTarget ? getObjectId(modifiedTarget) : null;
@@ -15474,16 +15474,27 @@ const PageCanvas = react.forwardRef(
15474
15474
  finalSkewY = (sourceElement == null ? void 0 : sourceElement.skewY) ?? obj.skewY ?? 0;
15475
15475
  if ((sourceElement == null ? void 0 : sourceElement.angle) !== void 0 || obj.angle !== void 0) finalAngleFromDecomposed = false;
15476
15476
  }
15477
- } else if (obj instanceof fabric__namespace.Textbox && isActiveSelection && (Math.abs((decomposed.scaleX ?? 1) - 1) > 1e-3 || Math.abs((decomposed.scaleY ?? 1) - 1) > 1e-3)) {
15478
- const sx = Math.abs(decomposed.scaleX || 1);
15479
- 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;
15480
15487
  const isLikelyUniformCorner = !activeSelectionResizeHandle && Math.abs(sx - sy) < 0.01 && Math.abs(sx - 1) > 1e-3;
15481
15488
  const isCornerHandle = activeSelectionResizeHandle === "tl" || activeSelectionResizeHandle === "tr" || activeSelectionResizeHandle === "bl" || activeSelectionResizeHandle === "br" || isLikelyUniformCorner;
15482
15489
  const isHeightSideHandle = activeSelectionResizeHandle === "mt" || activeSelectionResizeHandle === "mb";
15483
15490
  const fontScale = isCornerHandle ? Math.max(1e-3, Math.sqrt(sx * sy)) : 1;
15484
- const bakedWidth = Math.max(20, intrinsicWidth * sx);
15485
- const baseMinH = Number(obj.minBoxHeight ?? (sourceElement == null ? void 0 : sourceElement.minBoxHeight));
15486
- 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;
15487
15498
  const bakedTextScaleUpdates = { width: bakedWidth };
15488
15499
  const debugTextBeforeBake = debugGroupTextCornerResize ? summarizeFabricObjectForResizeDebug(obj) : null;
15489
15500
  finalScaleX = 1;
@@ -15707,6 +15718,9 @@ const PageCanvas = react.forwardRef(
15707
15718
  }
15708
15719
  updateElement(objId, elementUpdate, { recordHistory: false, skipLayoutRecalc: true });
15709
15720
  obj.setCoords();
15721
+ delete obj.__asLiveOrigW;
15722
+ delete obj.__asLiveOrigH;
15723
+ delete obj.__asLiveOrigMinH;
15710
15724
  }
15711
15725
  if (isLogicalGroupAS && logicalGroupSelectionId && activeObj instanceof fabric__namespace.ActiveSelection) {
15712
15726
  try {
@@ -24865,9 +24879,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24865
24879
  }
24866
24880
  return svgString;
24867
24881
  }
24868
- const resolvedPackageVersion = "0.5.351";
24882
+ const resolvedPackageVersion = "0.5.353";
24869
24883
  const PACKAGE_VERSION = resolvedPackageVersion;
24870
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.351";
24884
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.353";
24871
24885
  const roundParityValue = (value) => {
24872
24886
  if (typeof value !== "number") return value;
24873
24887
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25681,7 +25695,7 @@ class PixldocsRenderer {
25681
25695
  await this.waitForCanvasScene(container, cloned, i);
25682
25696
  }
25683
25697
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25684
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-CmEq_yn3.cjs"));
25698
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DihZwtD7.cjs"));
25685
25699
  const prepared = preparePagesForExport(
25686
25700
  cloned.pages,
25687
25701
  canvasWidth,
@@ -28001,7 +28015,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28001
28015
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28002
28016
  sanitizeSvgTreeForPdf(svgToDraw);
28003
28017
  try {
28004
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-CmEq_yn3.cjs"));
28018
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DihZwtD7.cjs"));
28005
28019
  try {
28006
28020
  await logTextMeasurementDiagnostic(svgToDraw);
28007
28021
  } catch {
@@ -28398,4 +28412,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
28398
28412
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
28399
28413
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
28400
28414
  exports.warmTemplateFromForm = warmTemplateFromForm;
28401
- //# sourceMappingURL=index-CG3kYo0Z.cjs.map
28415
+ //# sourceMappingURL=index-UiuMKvLc.cjs.map