@pixldocs/canvas-renderer 0.5.438 → 0.5.440

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.
@@ -11645,6 +11645,22 @@ const bakeTextboxScaleIntoTypography = (obj, sourceElement) => {
11645
11645
  };
11646
11646
  return updates;
11647
11647
  };
11648
+ const applyTransformPreservingFlip = (obj, matrix) => {
11649
+ fabric.util.applyTransformToObject(obj, matrix);
11650
+ let sx = obj.scaleX ?? 1;
11651
+ let sy = obj.scaleY ?? 1;
11652
+ let flipX = false;
11653
+ let flipY = false;
11654
+ if (sx < 0) {
11655
+ flipX = true;
11656
+ sx = -sx;
11657
+ }
11658
+ if (sy < 0) {
11659
+ flipY = true;
11660
+ sy = -sy;
11661
+ }
11662
+ obj.set({ scaleX: sx, scaleY: sy, flipX, flipY });
11663
+ };
11648
11664
  function applyWarpAwareSelectionBorders(selection) {
11649
11665
  var _a2;
11650
11666
  if (selection.__pixldocsOrigASHasBorders !== void 0) {
@@ -11742,7 +11758,7 @@ function applyWarpAwareSelectionBorders(selection) {
11742
11758
  const savedLayout = k.layoutManager;
11743
11759
  try {
11744
11760
  if (savedLayout) k.layoutManager = void 0;
11745
- fabric.util.applyTransformToObject(k, localMatrix);
11761
+ applyTransformPreservingFlip(k, localMatrix);
11746
11762
  const decomposed = fabric.util.qrDecompose(
11747
11763
  localMatrix
11748
11764
  );
@@ -15123,7 +15139,7 @@ const PageCanvas = forwardRef(
15123
15139
  const normalizedScaleAngle = ((obj.angle ?? 0) % 360 + 360) % 360;
15124
15140
  const isRotatedActiveSelectionCorner = obj instanceof fabric.ActiveSelection && isCornerResizeHandle(corner) && Math.min(normalizedScaleAngle, 360 - normalizedScaleAngle) > 0.5;
15125
15141
  const isRotatedActiveSelectionSide = obj instanceof fabric.ActiveSelection && (corner === "mt" || corner === "mb" || corner === "ml" || corner === "mr") && Math.min(normalizedScaleAngle, 360 - normalizedScaleAngle) > 0.5;
15126
- const isRotatedSingleObjectScale = !(obj instanceof fabric.ActiveSelection) && isCornerResizeHandle(corner) && Math.min(normalizedScaleAngle, 360 - normalizedScaleAngle) > 0.5;
15142
+ const isRotatedSingleObjectScale = !(obj instanceof fabric.ActiveSelection) && (isCornerResizeHandle(corner) || corner === "mt" || corner === "mb" || corner === "ml" || corner === "mr") && Math.min(normalizedScaleAngle, 360 - normalizedScaleAngle) > 0.5;
15127
15143
  if (!isRotatedActiveSelectionCorner && !isRotatedActiveSelectionSide && !isRotatedSingleObjectScale) {
15128
15144
  snapDuringScaleCallback(obj, corner);
15129
15145
  }
@@ -15248,8 +15264,12 @@ const PageCanvas = forwardRef(
15248
15264
  const sourceEl = objId ? elementsRef.current.find((el) => el.id === objId) : void 0;
15249
15265
  bakeTextboxScaleIntoTypography(obj, sourceEl);
15250
15266
  }
15251
- snapDuringScaleCallback(obj, corner);
15252
- const scaleGuides = calculateScaleSnapGuidesCallback(obj, corner);
15267
+ const normResizeAngle = ((obj.angle ?? 0) % 360 + 360) % 360;
15268
+ const isRotatedSingleResize = !(obj instanceof fabric.ActiveSelection) && Math.min(normResizeAngle, 360 - normResizeAngle) > 0.5;
15269
+ if (!isRotatedSingleResize) {
15270
+ snapDuringScaleCallback(obj, corner);
15271
+ }
15272
+ const scaleGuides = isRotatedSingleResize ? [] : calculateScaleSnapGuidesCallback(obj, corner);
15253
15273
  const gridGuidesForTextResize = [];
15254
15274
  try {
15255
15275
  const psGrid = projectSettingsRef.current;
@@ -16771,7 +16791,7 @@ const PageCanvas = forwardRef(
16771
16791
  if (!objId || objId === "__background__") continue;
16772
16792
  const objOwnMatrix = obj.calcOwnMatrix();
16773
16793
  const absoluteMatrix = fabric.util.multiplyTransformMatrices(selectionMatrix, objOwnMatrix);
16774
- fabric.util.applyTransformToObject(obj, absoluteMatrix);
16794
+ applyTransformPreservingFlip(obj, absoluteMatrix);
16775
16795
  obj.setCoords();
16776
16796
  }
16777
16797
  });
@@ -25831,9 +25851,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25831
25851
  }
25832
25852
  return svgString;
25833
25853
  }
25834
- const resolvedPackageVersion = "0.5.438";
25854
+ const resolvedPackageVersion = "0.5.440";
25835
25855
  const PACKAGE_VERSION = resolvedPackageVersion;
25836
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.438";
25856
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.440";
25837
25857
  const roundParityValue = (value) => {
25838
25858
  if (typeof value !== "number") return value;
25839
25859
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26647,7 +26667,7 @@ class PixldocsRenderer {
26647
26667
  await this.waitForCanvasScene(container, cloned, i);
26648
26668
  }
26649
26669
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26650
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-ddzCO9sg.js");
26670
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BkFH66cH.js");
26651
26671
  const prepared = preparePagesForExport(
26652
26672
  cloned.pages,
26653
26673
  canvasWidth,
@@ -28967,7 +28987,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28967
28987
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28968
28988
  sanitizeSvgTreeForPdf(svgToDraw);
28969
28989
  try {
28970
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-ddzCO9sg.js");
28990
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BkFH66cH.js");
28971
28991
  try {
28972
28992
  await logTextMeasurementDiagnostic(svgToDraw);
28973
28993
  } catch {
@@ -29367,4 +29387,4 @@ export {
29367
29387
  buildTeaserBlurFlatKeys as y,
29368
29388
  collectFontDescriptorsFromConfig as z
29369
29389
  };
29370
- //# sourceMappingURL=index-BIvYSBXQ.js.map
29390
+ //# sourceMappingURL=index-H0u34DDY.js.map