@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.
@@ -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;
@@ -14617,18 +14622,13 @@ const PageCanvas = forwardRef(
14617
14622
  }
14618
14623
  const modifiedTarget = e.target;
14619
14624
  if (modifiedTarget instanceof fabric.ActiveSelection && modifiedTarget.getObjects().length === 0) {
14625
+ didTransformRef.current = false;
14626
+ groupSelectionTransformStartRef.current = null;
14627
+ activeSelectionMoveStartRef.current = null;
14628
+ activeSelectionResizeHandleRef.current = null;
14629
+ unlockEditsSoon();
14620
14630
  return;
14621
14631
  }
14622
- try {
14623
- const t = e.target;
14624
- if (t instanceof fabric.ActiveSelection) {
14625
- for (const child of t.getObjects()) {
14626
- delete child.__asLiveOrigW;
14627
- delete child.__asLiveOrigH;
14628
- }
14629
- }
14630
- } catch {
14631
- }
14632
14632
  groupShiftReflowSnapshotRef.current = null;
14633
14633
  lockEdits();
14634
14634
  const modifiedTargetId = modifiedTarget ? getObjectId(modifiedTarget) : null;
@@ -15456,16 +15456,27 @@ const PageCanvas = forwardRef(
15456
15456
  finalSkewY = (sourceElement == null ? void 0 : sourceElement.skewY) ?? obj.skewY ?? 0;
15457
15457
  if ((sourceElement == null ? void 0 : sourceElement.angle) !== void 0 || obj.angle !== void 0) finalAngleFromDecomposed = false;
15458
15458
  }
15459
- } else if (obj instanceof fabric.Textbox && isActiveSelection && (Math.abs((decomposed.scaleX ?? 1) - 1) > 1e-3 || Math.abs((decomposed.scaleY ?? 1) - 1) > 1e-3)) {
15460
- const sx = Math.abs(decomposed.scaleX || 1);
15461
- 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;
15462
15469
  const isLikelyUniformCorner = !activeSelectionResizeHandle && Math.abs(sx - sy) < 0.01 && Math.abs(sx - 1) > 1e-3;
15463
15470
  const isCornerHandle = activeSelectionResizeHandle === "tl" || activeSelectionResizeHandle === "tr" || activeSelectionResizeHandle === "bl" || activeSelectionResizeHandle === "br" || isLikelyUniformCorner;
15464
15471
  const isHeightSideHandle = activeSelectionResizeHandle === "mt" || activeSelectionResizeHandle === "mb";
15465
15472
  const fontScale = isCornerHandle ? Math.max(1e-3, Math.sqrt(sx * sy)) : 1;
15466
- const bakedWidth = Math.max(20, intrinsicWidth * sx);
15467
- const baseMinH = Number(obj.minBoxHeight ?? (sourceElement == null ? void 0 : sourceElement.minBoxHeight));
15468
- 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;
15469
15480
  const bakedTextScaleUpdates = { width: bakedWidth };
15470
15481
  const debugTextBeforeBake = debugGroupTextCornerResize ? summarizeFabricObjectForResizeDebug(obj) : null;
15471
15482
  finalScaleX = 1;
@@ -15689,6 +15700,9 @@ const PageCanvas = forwardRef(
15689
15700
  }
15690
15701
  updateElement(objId, elementUpdate, { recordHistory: false, skipLayoutRecalc: true });
15691
15702
  obj.setCoords();
15703
+ delete obj.__asLiveOrigW;
15704
+ delete obj.__asLiveOrigH;
15705
+ delete obj.__asLiveOrigMinH;
15692
15706
  }
15693
15707
  if (isLogicalGroupAS && logicalGroupSelectionId && activeObj instanceof fabric.ActiveSelection) {
15694
15708
  try {
@@ -24847,9 +24861,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24847
24861
  }
24848
24862
  return svgString;
24849
24863
  }
24850
- const resolvedPackageVersion = "0.5.351";
24864
+ const resolvedPackageVersion = "0.5.353";
24851
24865
  const PACKAGE_VERSION = resolvedPackageVersion;
24852
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.351";
24866
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.353";
24853
24867
  const roundParityValue = (value) => {
24854
24868
  if (typeof value !== "number") return value;
24855
24869
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25663,7 +25677,7 @@ class PixldocsRenderer {
25663
25677
  await this.waitForCanvasScene(container, cloned, i);
25664
25678
  }
25665
25679
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25666
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-C4JUR8dI.js");
25680
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BvY4a5sT.js");
25667
25681
  const prepared = preparePagesForExport(
25668
25682
  cloned.pages,
25669
25683
  canvasWidth,
@@ -27983,7 +27997,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27983
27997
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27984
27998
  sanitizeSvgTreeForPdf(svgToDraw);
27985
27999
  try {
27986
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-C4JUR8dI.js");
28000
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BvY4a5sT.js");
27987
28001
  try {
27988
28002
  await logTextMeasurementDiagnostic(svgToDraw);
27989
28003
  } catch {
@@ -28383,4 +28397,4 @@ export {
28383
28397
  buildTeaserBlurFlatKeys as y,
28384
28398
  collectFontDescriptorsFromConfig as z
28385
28399
  };
28386
- //# sourceMappingURL=index-Ugo_-WGu.js.map
28400
+ //# sourceMappingURL=index-C32C3XZP.js.map