@pixldocs/canvas-renderer 0.5.383 → 0.5.385

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.
@@ -15401,6 +15401,14 @@ const PageCanvas = forwardRef(
15401
15401
  finalHeight = 0;
15402
15402
  finalScaleX = 1;
15403
15403
  finalScaleY = 1;
15404
+ } else if (obj instanceof fabric.Textbox && isActiveSelection && (sourceElement == null ? void 0 : sourceElement.type) === "text" && (activeSelectionResizeHandle === "ml" || activeSelectionResizeHandle === "mr" || activeSelectionResizeHandle === "mt" || activeSelectionResizeHandle === "mb") && Math.min(
15405
+ ((sourceElement.angle ?? obj.angle ?? 0) % 360 + 360) % 360,
15406
+ 360 - ((sourceElement.angle ?? obj.angle ?? 0) % 360 + 360) % 360
15407
+ ) > 0.5) {
15408
+ finalWidth = Math.max(1, intrinsicWidth);
15409
+ finalHeight = Math.max(1, intrinsicHeight);
15410
+ finalScaleX = 1;
15411
+ finalScaleY = 1;
15404
15412
  } else if (obj instanceof fabric.Textbox && isActiveSelection && (Math.abs((decomposed.scaleX ?? 1) - 1) > 1e-3 || Math.abs((decomposed.scaleY ?? 1) - 1) > 1e-3)) {
15405
15413
  const sx = Math.abs(decomposed.scaleX || 1);
15406
15414
  const sy = Math.abs(decomposed.scaleY || 1);
@@ -15600,6 +15608,45 @@ const PageCanvas = forwardRef(
15600
15608
  if (sourceElement && sourceElement.opacity !== void 0) {
15601
15609
  elementUpdate.opacity = sourceElement.opacity;
15602
15610
  }
15611
+ const isActiveSelectionSideHandle = activeSelectionResizeHandle === "ml" || activeSelectionResizeHandle === "mr" || activeSelectionResizeHandle === "mt" || activeSelectionResizeHandle === "mb";
15612
+ if (isActiveSelection && isActiveSelectionSideHandle && obj instanceof fabric.Textbox && (sourceElement == null ? void 0 : sourceElement.type) === "text") {
15613
+ const cleanAngle = Number.isFinite(sourceElement.angle) ? sourceElement.angle ?? 0 : obj.angle ?? decomposed.angle ?? 0;
15614
+ const normalizedTextAngle = (cleanAngle % 360 + 360) % 360;
15615
+ const isRotatedText = Math.min(normalizedTextAngle, 360 - normalizedTextAngle) > 0.5;
15616
+ if (isRotatedText) {
15617
+ try {
15618
+ const cleanW = Math.max(1, Number(obj.width ?? elementUpdate.width ?? finalWidth));
15619
+ const cleanH = Math.max(1, Number(elementUpdate.height ?? obj.height ?? finalHeight));
15620
+ const cx = decomposed.translateX ?? absoluteLeft + cleanW / 2;
15621
+ const cy = decomposed.translateY ?? absoluteTop + cleanH / 2;
15622
+ const theta = fabric.util.degreesToRadians(cleanAngle);
15623
+ const cos = Math.cos(theta);
15624
+ const sin = Math.sin(theta);
15625
+ const cleanAbsLeft = cx - (cos * cleanW / 2 - sin * cleanH / 2);
15626
+ const cleanAbsTop = cy - (sin * cleanW / 2 + cos * cleanH / 2);
15627
+ const cleanStorePos = absoluteToStorePosition(cleanAbsLeft, cleanAbsTop, objId, pageChildrenForSave);
15628
+ elementUpdate.left = cleanStorePos.left;
15629
+ elementUpdate.top = cleanStorePos.top;
15630
+ elementUpdate.width = cleanW;
15631
+ elementUpdate.height = cleanH;
15632
+ elementUpdate.angle = cleanAngle;
15633
+ elementUpdate.scaleX = 1;
15634
+ elementUpdate.scaleY = 1;
15635
+ elementUpdate.skewX = 0;
15636
+ elementUpdate.skewY = 0;
15637
+ elementUpdate.transformMatrix = fabric.util.composeMatrix({
15638
+ translateX: cx,
15639
+ translateY: cy,
15640
+ angle: cleanAngle,
15641
+ scaleX: 1,
15642
+ scaleY: 1,
15643
+ skewX: 0,
15644
+ skewY: 0
15645
+ });
15646
+ } catch {
15647
+ }
15648
+ }
15649
+ }
15603
15650
  if (debugGroupTextCornerResize && obj instanceof fabric.Textbox) {
15604
15651
  logGroupTextResizeDebug("store-update-text", {
15605
15652
  time: Math.round(performance.now()),
@@ -24816,9 +24863,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24816
24863
  }
24817
24864
  return svgString;
24818
24865
  }
24819
- const resolvedPackageVersion = "0.5.383";
24866
+ const resolvedPackageVersion = "0.5.385";
24820
24867
  const PACKAGE_VERSION = resolvedPackageVersion;
24821
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.383";
24868
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.385";
24822
24869
  const roundParityValue = (value) => {
24823
24870
  if (typeof value !== "number") return value;
24824
24871
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25632,7 +25679,7 @@ class PixldocsRenderer {
25632
25679
  await this.waitForCanvasScene(container, cloned, i);
25633
25680
  }
25634
25681
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25635
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BegTwE0k.js");
25682
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CqGfBDhF.js");
25636
25683
  const prepared = preparePagesForExport(
25637
25684
  cloned.pages,
25638
25685
  canvasWidth,
@@ -27952,7 +27999,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27952
27999
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27953
28000
  sanitizeSvgTreeForPdf(svgToDraw);
27954
28001
  try {
27955
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BegTwE0k.js");
28002
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CqGfBDhF.js");
27956
28003
  try {
27957
28004
  await logTextMeasurementDiagnostic(svgToDraw);
27958
28005
  } catch {
@@ -28352,4 +28399,4 @@ export {
28352
28399
  buildTeaserBlurFlatKeys as y,
28353
28400
  collectFontDescriptorsFromConfig as z
28354
28401
  };
28355
- //# sourceMappingURL=index-BHS16lGJ.js.map
28402
+ //# sourceMappingURL=index-Y4ydIPau.js.map