@pixldocs/canvas-renderer 0.5.288 → 0.5.289

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.
@@ -11220,6 +11220,7 @@ const PageCanvas = forwardRef(
11220
11220
  useRef(null);
11221
11221
  const lastTextEditDimensionsRef = useRef(null);
11222
11222
  const lastResizeScaleTargetRef = useRef(null);
11223
+ const activeSelectionResizeHandleRef = useRef(null);
11223
11224
  const preserveSelectionAfterTransformIdRef = useRef(null);
11224
11225
  const groupSelectionTransformStartRef = useRef(null);
11225
11226
  const activeSelectionMoveStartRef = useRef(null);
@@ -12042,6 +12043,7 @@ const PageCanvas = forwardRef(
12042
12043
  fabricCanvas.on("mouse:down", () => {
12043
12044
  groupSelectionTransformStartRef.current = null;
12044
12045
  activeSelectionMoveStartRef.current = null;
12046
+ activeSelectionResizeHandleRef.current = null;
12045
12047
  const active = fabricCanvas.getActiveObject();
12046
12048
  if (active instanceof fabric.ActiveSelection) {
12047
12049
  const rect = active.getBoundingRect();
@@ -13508,6 +13510,9 @@ const PageCanvas = forwardRef(
13508
13510
  }
13509
13511
  const transform = e.transform;
13510
13512
  const corner = (transform == null ? void 0 : transform.corner) || "";
13513
+ if (obj instanceof fabric.ActiveSelection && corner) {
13514
+ activeSelectionResizeHandleRef.current = corner;
13515
+ }
13511
13516
  if (obj instanceof fabric.ActiveSelection && (corner === "ml" || corner === "mr" || corner === "mt" || corner === "mb")) {
13512
13517
  const isXSide = corner === "ml" || corner === "mr";
13513
13518
  const sAxis = isXSide ? Math.abs(obj.scaleX ?? 1) : Math.abs(obj.scaleY ?? 1);
@@ -14130,6 +14135,7 @@ const PageCanvas = forwardRef(
14130
14135
  activeObjects = activeObjects[0].getObjects();
14131
14136
  }
14132
14137
  const isActiveSelection = activeObj instanceof fabric.ActiveSelection || activeObjects.length > 1;
14138
+ const activeSelectionResizeHandle = isActiveSelection ? activeSelectionResizeHandleRef.current : null;
14133
14139
  if (activeObj instanceof fabric.ActiveSelection && activeObjects.length > 1) {
14134
14140
  const memberIds = activeObjects.map((o) => getObjectId(o)).filter((id) => !!id && id !== "__background__");
14135
14141
  if (memberIds.length > 1) {
@@ -14462,15 +14468,32 @@ const PageCanvas = forwardRef(
14462
14468
  } else if (obj instanceof fabric.Textbox && isActiveSelection && (Math.abs((decomposed.scaleX ?? 1) - 1) > 1e-3 || Math.abs((decomposed.scaleY ?? 1) - 1) > 1e-3)) {
14463
14469
  const sx = Math.abs(decomposed.scaleX || 1);
14464
14470
  const sy = Math.abs(decomposed.scaleY || 1);
14471
+ const isLikelyUniformCorner = !activeSelectionResizeHandle && Math.abs(sx - sy) < 0.01 && Math.abs(sx - 1) > 1e-3;
14472
+ const isCornerHandle = activeSelectionResizeHandle === "tl" || activeSelectionResizeHandle === "tr" || activeSelectionResizeHandle === "bl" || activeSelectionResizeHandle === "br" || isLikelyUniformCorner;
14473
+ const isHeightSideHandle = activeSelectionResizeHandle === "mt" || activeSelectionResizeHandle === "mb";
14474
+ const fontScale = isCornerHandle ? Math.max(1e-3, Math.sqrt(sx * sy)) : 1;
14465
14475
  const bakedWidth = Math.max(20, intrinsicWidth * sx);
14466
- const bakedHeight = Math.max(1, intrinsicHeight * sy);
14467
- finalWidth = bakedWidth;
14468
- finalHeight = bakedHeight;
14476
+ const baseMinH = Number(obj.minBoxHeight ?? (sourceElement == null ? void 0 : sourceElement.minBoxHeight));
14477
+ const nextMinH = Number.isFinite(baseMinH) && baseMinH > 0 ? baseMinH * sy : isHeightSideHandle ? Math.max(1, intrinsicHeight * sy) : void 0;
14478
+ const bakedTextScaleUpdates = { width: bakedWidth };
14469
14479
  finalScaleX = 1;
14470
14480
  finalScaleY = 1;
14471
14481
  try {
14482
+ if (isCornerHandle) {
14483
+ const baseFontSize = Number((sourceElement == null ? void 0 : sourceElement.fontSize) ?? obj.fontSize ?? 16);
14484
+ const nextFontSize = Math.max(1, baseFontSize * fontScale);
14485
+ bakedTextScaleUpdates.fontSize = nextFontSize;
14486
+ obj.set({ fontSize: nextFontSize });
14487
+ }
14488
+ if (nextMinH !== void 0) {
14489
+ bakedTextScaleUpdates.minBoxHeight = Math.max(0, nextMinH);
14490
+ obj.minBoxHeight = bakedTextScaleUpdates.minBoxHeight;
14491
+ }
14472
14492
  obj.set({ width: bakedWidth, scaleX: 1, scaleY: 1 });
14473
14493
  obj.initDimensions();
14494
+ finalWidth = bakedWidth;
14495
+ finalHeight = Math.max(1, obj.height ?? intrinsicHeight * sy);
14496
+ obj.__pixldocsBakedTextScaleUpdates = bakedTextScaleUpdates;
14474
14497
  obj.setCoords();
14475
14498
  } catch {
14476
14499
  }
@@ -14614,6 +14637,7 @@ const PageCanvas = forwardRef(
14614
14637
  }
14615
14638
  groupSelectionTransformStartRef.current = null;
14616
14639
  activeSelectionMoveStartRef.current = null;
14640
+ activeSelectionResizeHandleRef.current = null;
14617
14641
  setTimeout(() => modifiedIdsThisRound.forEach((id) => justModifiedIdsRef.current.delete(id)), 150);
14618
14642
  commitHistory();
14619
14643
  unlockEditsSoon();
@@ -23625,9 +23649,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
23625
23649
  }
23626
23650
  return svgString;
23627
23651
  }
23628
- const resolvedPackageVersion = "0.5.288";
23652
+ const resolvedPackageVersion = "0.5.289";
23629
23653
  const PACKAGE_VERSION = resolvedPackageVersion;
23630
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.288";
23654
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.289";
23631
23655
  const roundParityValue = (value) => {
23632
23656
  if (typeof value !== "number") return value;
23633
23657
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24441,7 +24465,7 @@ class PixldocsRenderer {
24441
24465
  await this.waitForCanvasScene(container, cloned, i);
24442
24466
  }
24443
24467
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
24444
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BeBLRc4B.js");
24468
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-rGdZJ7ux.js");
24445
24469
  const prepared = preparePagesForExport(
24446
24470
  cloned.pages,
24447
24471
  canvasWidth,
@@ -26761,7 +26785,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
26761
26785
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
26762
26786
  sanitizeSvgTreeForPdf(svgToDraw);
26763
26787
  try {
26764
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BeBLRc4B.js");
26788
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-rGdZJ7ux.js");
26765
26789
  try {
26766
26790
  await logTextMeasurementDiagnostic(svgToDraw);
26767
26791
  } catch {
@@ -27161,4 +27185,4 @@ export {
27161
27185
  buildTeaserBlurFlatKeys as y,
27162
27186
  collectFontDescriptorsFromConfig as z
27163
27187
  };
27164
- //# sourceMappingURL=index-Dc3vuyOU.js.map
27188
+ //# sourceMappingURL=index-8DBd7ACA.js.map