@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.
@@ -11663,6 +11663,22 @@ const bakeTextboxScaleIntoTypography = (obj, sourceElement) => {
11663
11663
  };
11664
11664
  return updates;
11665
11665
  };
11666
+ const applyTransformPreservingFlip = (obj, matrix) => {
11667
+ fabric__namespace.util.applyTransformToObject(obj, matrix);
11668
+ let sx = obj.scaleX ?? 1;
11669
+ let sy = obj.scaleY ?? 1;
11670
+ let flipX = false;
11671
+ let flipY = false;
11672
+ if (sx < 0) {
11673
+ flipX = true;
11674
+ sx = -sx;
11675
+ }
11676
+ if (sy < 0) {
11677
+ flipY = true;
11678
+ sy = -sy;
11679
+ }
11680
+ obj.set({ scaleX: sx, scaleY: sy, flipX, flipY });
11681
+ };
11666
11682
  function applyWarpAwareSelectionBorders(selection) {
11667
11683
  var _a2;
11668
11684
  if (selection.__pixldocsOrigASHasBorders !== void 0) {
@@ -11760,7 +11776,7 @@ function applyWarpAwareSelectionBorders(selection) {
11760
11776
  const savedLayout = k.layoutManager;
11761
11777
  try {
11762
11778
  if (savedLayout) k.layoutManager = void 0;
11763
- fabric__namespace.util.applyTransformToObject(k, localMatrix);
11779
+ applyTransformPreservingFlip(k, localMatrix);
11764
11780
  const decomposed = fabric__namespace.util.qrDecompose(
11765
11781
  localMatrix
11766
11782
  );
@@ -15141,7 +15157,7 @@ const PageCanvas = react.forwardRef(
15141
15157
  const normalizedScaleAngle = ((obj.angle ?? 0) % 360 + 360) % 360;
15142
15158
  const isRotatedActiveSelectionCorner = obj instanceof fabric__namespace.ActiveSelection && isCornerResizeHandle(corner) && Math.min(normalizedScaleAngle, 360 - normalizedScaleAngle) > 0.5;
15143
15159
  const isRotatedActiveSelectionSide = obj instanceof fabric__namespace.ActiveSelection && (corner === "mt" || corner === "mb" || corner === "ml" || corner === "mr") && Math.min(normalizedScaleAngle, 360 - normalizedScaleAngle) > 0.5;
15144
- const isRotatedSingleObjectScale = !(obj instanceof fabric__namespace.ActiveSelection) && isCornerResizeHandle(corner) && Math.min(normalizedScaleAngle, 360 - normalizedScaleAngle) > 0.5;
15160
+ const isRotatedSingleObjectScale = !(obj instanceof fabric__namespace.ActiveSelection) && (isCornerResizeHandle(corner) || corner === "mt" || corner === "mb" || corner === "ml" || corner === "mr") && Math.min(normalizedScaleAngle, 360 - normalizedScaleAngle) > 0.5;
15145
15161
  if (!isRotatedActiveSelectionCorner && !isRotatedActiveSelectionSide && !isRotatedSingleObjectScale) {
15146
15162
  snapDuringScaleCallback(obj, corner);
15147
15163
  }
@@ -15266,8 +15282,12 @@ const PageCanvas = react.forwardRef(
15266
15282
  const sourceEl = objId ? elementsRef.current.find((el) => el.id === objId) : void 0;
15267
15283
  bakeTextboxScaleIntoTypography(obj, sourceEl);
15268
15284
  }
15269
- snapDuringScaleCallback(obj, corner);
15270
- const scaleGuides = calculateScaleSnapGuidesCallback(obj, corner);
15285
+ const normResizeAngle = ((obj.angle ?? 0) % 360 + 360) % 360;
15286
+ const isRotatedSingleResize = !(obj instanceof fabric__namespace.ActiveSelection) && Math.min(normResizeAngle, 360 - normResizeAngle) > 0.5;
15287
+ if (!isRotatedSingleResize) {
15288
+ snapDuringScaleCallback(obj, corner);
15289
+ }
15290
+ const scaleGuides = isRotatedSingleResize ? [] : calculateScaleSnapGuidesCallback(obj, corner);
15271
15291
  const gridGuidesForTextResize = [];
15272
15292
  try {
15273
15293
  const psGrid = projectSettingsRef.current;
@@ -16789,7 +16809,7 @@ const PageCanvas = react.forwardRef(
16789
16809
  if (!objId || objId === "__background__") continue;
16790
16810
  const objOwnMatrix = obj.calcOwnMatrix();
16791
16811
  const absoluteMatrix = fabric__namespace.util.multiplyTransformMatrices(selectionMatrix, objOwnMatrix);
16792
- fabric__namespace.util.applyTransformToObject(obj, absoluteMatrix);
16812
+ applyTransformPreservingFlip(obj, absoluteMatrix);
16793
16813
  obj.setCoords();
16794
16814
  }
16795
16815
  });
@@ -25849,9 +25869,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25849
25869
  }
25850
25870
  return svgString;
25851
25871
  }
25852
- const resolvedPackageVersion = "0.5.438";
25872
+ const resolvedPackageVersion = "0.5.440";
25853
25873
  const PACKAGE_VERSION = resolvedPackageVersion;
25854
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.438";
25874
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.440";
25855
25875
  const roundParityValue = (value) => {
25856
25876
  if (typeof value !== "number") return value;
25857
25877
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26665,7 +26685,7 @@ class PixldocsRenderer {
26665
26685
  await this.waitForCanvasScene(container, cloned, i);
26666
26686
  }
26667
26687
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26668
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DW6SkA07.cjs"));
26688
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-CtvA0Dck.cjs"));
26669
26689
  const prepared = preparePagesForExport(
26670
26690
  cloned.pages,
26671
26691
  canvasWidth,
@@ -28985,7 +29005,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28985
29005
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28986
29006
  sanitizeSvgTreeForPdf(svgToDraw);
28987
29007
  try {
28988
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DW6SkA07.cjs"));
29008
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-CtvA0Dck.cjs"));
28989
29009
  try {
28990
29010
  await logTextMeasurementDiagnostic(svgToDraw);
28991
29011
  } catch {
@@ -29382,4 +29402,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
29382
29402
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
29383
29403
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
29384
29404
  exports.warmTemplateFromForm = warmTemplateFromForm;
29385
- //# sourceMappingURL=index-BIAXZTHb.cjs.map
29405
+ //# sourceMappingURL=index-hWZ5kvhb.cjs.map