@pixldocs/canvas-renderer 0.5.443 → 0.5.445

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.
@@ -11661,6 +11661,13 @@ const applyTransformPreservingFlip = (obj, matrix) => {
11661
11661
  }
11662
11662
  obj.set({ scaleX: sx, scaleY: sy, flipX, flipY });
11663
11663
  };
11664
+ const restorePersistedFlipState = (obj, flipX, flipY, angle) => {
11665
+ const sx = Math.abs(Number(obj.scaleX ?? 1)) || 1;
11666
+ const sy = Math.abs(Number(obj.scaleY ?? 1)) || 1;
11667
+ obj.set({ scaleX: sx, scaleY: sy, flipX, flipY, ...Number.isFinite(angle) ? { angle } : {} });
11668
+ obj.setCoords();
11669
+ obj.dirty = true;
11670
+ };
11664
11671
  const toggleLogicalFlipInMatrix = (matrix, flipX, flipY) => {
11665
11672
  if (!flipX && !flipY) return matrix;
11666
11673
  const sx = flipX ? -1 : 1;
@@ -16476,8 +16483,9 @@ const PageCanvas = forwardRef(
16476
16483
  const objectFlipY = obj.flipY ?? false;
16477
16484
  const persistedFlipX = (sourceElement == null ? void 0 : sourceElement.flipX) ?? objectFlipX;
16478
16485
  const persistedFlipY = (sourceElement == null ? void 0 : sourceElement.flipY) ?? objectFlipY;
16486
+ const persistedAngle = sourceElement ? Number.isFinite(sourceElement.angle) ? sourceElement.angle ?? 0 : 0 : Number.isFinite(obj.angle) ? obj.angle ?? 0 : void 0;
16479
16487
  const isActiveSelectionResizeGesture = activeSelectionResizeHandle === "ml" || activeSelectionResizeHandle === "mr" || activeSelectionResizeHandle === "mt" || activeSelectionResizeHandle === "mb" || activeSelectionResizeHandle === "tl" || activeSelectionResizeHandle === "tr" || activeSelectionResizeHandle === "bl" || activeSelectionResizeHandle === "br";
16480
- const expectedCleanAngle = isActiveSelection && isActiveSelectionResizeGesture ? Number.isFinite(sourceElement == null ? void 0 : sourceElement.angle) ? (sourceElement == null ? void 0 : sourceElement.angle) ?? 0 : Number.isFinite(obj.angle) ? obj.angle ?? 0 : void 0 : void 0;
16488
+ const expectedCleanAngle = isActiveSelection && isActiveSelectionResizeGesture ? sourceElement ? Number.isFinite(sourceElement.angle) ? sourceElement.angle ?? 0 : 0 : Number.isFinite(obj.angle) ? obj.angle ?? 0 : void 0 : void 0;
16481
16489
  const normalizedFinalAbsoluteMatrix = normalizeMatrixForPersistedFlip(
16482
16490
  toggleLogicalFlipInMatrix(
16483
16491
  finalAbsoluteMatrix,
@@ -16491,7 +16499,7 @@ const PageCanvas = forwardRef(
16491
16499
  const cleanTransformMatrix = toggleLogicalFlipInMatrix(normalizedFinalAbsoluteMatrix, persistedFlipX, persistedFlipY);
16492
16500
  const persistedDecomposed = fabric.util.qrDecompose(cleanTransformMatrix);
16493
16501
  if (isActiveSelection && (obj instanceof fabric.FabricImage || obj instanceof fabric.Group && obj.__cropGroup)) {
16494
- activeSelectionFlipRestores.push({ obj, flipX: persistedFlipX, flipY: persistedFlipY });
16502
+ activeSelectionFlipRestores.push({ obj, flipX: persistedFlipX, flipY: persistedFlipY, angle: persistedAngle });
16495
16503
  }
16496
16504
  const elementUpdate = {
16497
16505
  left: storePos.left,
@@ -16717,14 +16725,15 @@ const PageCanvas = forwardRef(
16717
16725
  skipActiveSelectionBakeOnClearRef.current = true;
16718
16726
  try {
16719
16727
  for (const restore of activeSelectionFlipRestores) {
16720
- restore.obj.set({ flipX: restore.flipX, flipY: restore.flipY });
16721
- restore.obj.setCoords();
16722
- restore.obj.dirty = true;
16728
+ restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY, restore.angle);
16723
16729
  }
16724
16730
  fabricCanvas.discardActiveObject();
16725
16731
  } finally {
16726
16732
  skipActiveSelectionBakeOnClearRef.current = false;
16727
16733
  }
16734
+ for (const restore of activeSelectionFlipRestores) {
16735
+ restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY, restore.angle);
16736
+ }
16728
16737
  for (const bake of pendingCropGroupFrameBakes) {
16729
16738
  const ct = bake.obj.__cropData;
16730
16739
  if (!ct) continue;
@@ -16744,6 +16753,9 @@ const PageCanvas = forwardRef(
16744
16753
  updateCoverLayout(bake.obj);
16745
16754
  bake.obj.setCoords();
16746
16755
  }
16756
+ for (const restore of activeSelectionFlipRestores) {
16757
+ restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY, restore.angle);
16758
+ }
16747
16759
  if (membersToReselect.length > 1) {
16748
16760
  const newSel = new fabric.ActiveSelection(membersToReselect, { canvas: fabricCanvas });
16749
16761
  if (wasGroupSel) restoreGroupSelectionVisualState(newSel, wasGroupSel);
@@ -25911,9 +25923,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25911
25923
  }
25912
25924
  return svgString;
25913
25925
  }
25914
- const resolvedPackageVersion = "0.5.443";
25926
+ const resolvedPackageVersion = "0.5.445";
25915
25927
  const PACKAGE_VERSION = resolvedPackageVersion;
25916
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.443";
25928
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.445";
25917
25929
  const roundParityValue = (value) => {
25918
25930
  if (typeof value !== "number") return value;
25919
25931
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26727,7 +26739,7 @@ class PixldocsRenderer {
26727
26739
  await this.waitForCanvasScene(container, cloned, i);
26728
26740
  }
26729
26741
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26730
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Chx_7ffv.js");
26742
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-B5RZe-Kw.js");
26731
26743
  const prepared = preparePagesForExport(
26732
26744
  cloned.pages,
26733
26745
  canvasWidth,
@@ -29047,7 +29059,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29047
29059
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29048
29060
  sanitizeSvgTreeForPdf(svgToDraw);
29049
29061
  try {
29050
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Chx_7ffv.js");
29062
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-B5RZe-Kw.js");
29051
29063
  try {
29052
29064
  await logTextMeasurementDiagnostic(svgToDraw);
29053
29065
  } catch {
@@ -29447,4 +29459,4 @@ export {
29447
29459
  buildTeaserBlurFlatKeys as y,
29448
29460
  collectFontDescriptorsFromConfig as z
29449
29461
  };
29450
- //# sourceMappingURL=index-mfdztOqY.js.map
29462
+ //# sourceMappingURL=index-DX5LKnWg.js.map