@pixldocs/canvas-renderer 0.5.420 → 0.5.422

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.
@@ -14354,7 +14354,7 @@ const PageCanvas = forwardRef(
14354
14354
  fabricCanvas.on("selection:cleared", () => {
14355
14355
  });
14356
14356
  fabricCanvas.on("object:scaling", (e) => {
14357
- var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
14357
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
14358
14358
  if (!isActiveRef.current) return;
14359
14359
  const t = e.target;
14360
14360
  if (t) lastResizeScaleTargetRef.current = t;
@@ -14645,14 +14645,19 @@ const PageCanvas = forwardRef(
14645
14645
  let didReflowTextChild = false;
14646
14646
  for (const child of obj.getObjects()) {
14647
14647
  if (child.__asLiveOrigAngle == null) {
14648
- const childId = getObjectId(child);
14649
- const sourceChild = childId ? elementsRef.current.find((el) => el.id === childId) : void 0;
14650
- const storedWorldAngle = Number.isFinite(sourceChild == null ? void 0 : sourceChild.angle) ? sourceChild.angle ?? 0 : void 0;
14651
- const logicalGroupId = obj.__pixldocsGroupSelection;
14652
- const groupWorldAngle = logicalGroupId ? ((_k = groupSelectionTransformStartRef.current) == null ? void 0 : _k.groupId) === logicalGroupId ? groupSelectionTransformStartRef.current.groupAngle : obj.__pixldocsFrozenGroupAngle ?? (obj.angle ?? 0) : 0;
14653
- child.__asLiveOrigAngle = storedWorldAngle !== void 0 ? storedWorldAngle - groupWorldAngle : child.angle ?? 0;
14648
+ const currentLocalAngle = Number.isFinite(child.angle) ? child.angle ?? 0 : void 0;
14649
+ let matrixLocalAngle;
14650
+ try {
14651
+ const selectionMatrix = obj.calcTransformMatrix();
14652
+ const childMatrix = child.calcOwnMatrix();
14653
+ const worldMatrix = fabric.util.multiplyTransformMatrices(selectionMatrix, childMatrix);
14654
+ const liveWorldAngle = fabric.util.qrDecompose(worldMatrix).angle ?? 0;
14655
+ matrixLocalAngle = liveWorldAngle - (obj.angle ?? 0);
14656
+ } catch {
14657
+ }
14658
+ child.__asLiveOrigAngle = currentLocalAngle ?? matrixLocalAngle ?? 0;
14654
14659
  }
14655
- if (child instanceof fabric.Group && (child.__cropGroup || ((_l = child._ct) == null ? void 0 : _l.isCropGroup))) {
14660
+ if (child instanceof fabric.Group && (child.__cropGroup || ((_k = child._ct) == null ? void 0 : _k.isCropGroup))) {
14656
14661
  const ct = child.__cropData;
14657
14662
  if (!ct) continue;
14658
14663
  if (child.__asLiveOrigAngle == null) {
@@ -14821,7 +14826,7 @@ const PageCanvas = forwardRef(
14821
14826
  child.dirty = true;
14822
14827
  didReflowTextChild = true;
14823
14828
  }
14824
- if (isXSide && ((_m = groupShiftReflowSnapshotRef.current) == null ? void 0 : _m.selection) === obj) {
14829
+ if (isXSide && ((_l = groupShiftReflowSnapshotRef.current) == null ? void 0 : _l.selection) === obj) {
14825
14830
  const snap = groupShiftReflowSnapshotRef.current;
14826
14831
  const anchorEntry = snap.children[0];
14827
14832
  const anchorTopLive = anchorEntry.obj.top ?? 0;
@@ -14982,7 +14987,7 @@ const PageCanvas = forwardRef(
14982
14987
  setGuides(gridGuidesForScale.length ? [...scaleGuides, ...gridGuidesForScale] : scaleGuides);
14983
14988
  if (drilledGroupIdRef.current) {
14984
14989
  try {
14985
- (_n = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _n.call(fabricCanvas);
14990
+ (_m = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _m.call(fabricCanvas);
14986
14991
  } catch {
14987
14992
  }
14988
14993
  }
@@ -15912,7 +15917,16 @@ const PageCanvas = forwardRef(
15912
15917
  scaleX: 1,
15913
15918
  scaleY: 1,
15914
15919
  skewX: 0,
15915
- skewY: 0
15920
+ skewY: 0,
15921
+ // CRITICAL: restore the child's ORIGINAL local angle (pre-live-preview).
15922
+ // The live preview path mutates obj.angle via qrDecompose(S^-1·R(θ))
15923
+ // to cancel AS shear visually. If we leave that mutated angle on the
15924
+ // object, fabric's AS-discard step bakes (AS.angle + mutatedAngle)
15925
+ // into the standalone image — so the next individual rotation starts
15926
+ // from a wrong base and visibly "snaps back" to the pre-resize angle.
15927
+ // Restoring the original local angle here makes AS-discard bake the
15928
+ // correct world angle (AS.angle + imgChildLocalAngle === worldAngleI).
15929
+ angle: imgChildLocalAngle
15916
15930
  });
15917
15931
  obj.dirty = true;
15918
15932
  obj.setCoords();
@@ -25550,9 +25564,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25550
25564
  }
25551
25565
  return svgString;
25552
25566
  }
25553
- const resolvedPackageVersion = "0.5.420";
25567
+ const resolvedPackageVersion = "0.5.422";
25554
25568
  const PACKAGE_VERSION = resolvedPackageVersion;
25555
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.420";
25569
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.422";
25556
25570
  const roundParityValue = (value) => {
25557
25571
  if (typeof value !== "number") return value;
25558
25572
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26366,7 +26380,7 @@ class PixldocsRenderer {
26366
26380
  await this.waitForCanvasScene(container, cloned, i);
26367
26381
  }
26368
26382
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26369
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-B-fqxnfz.js");
26383
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CnV1fqDs.js");
26370
26384
  const prepared = preparePagesForExport(
26371
26385
  cloned.pages,
26372
26386
  canvasWidth,
@@ -28686,7 +28700,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28686
28700
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28687
28701
  sanitizeSvgTreeForPdf(svgToDraw);
28688
28702
  try {
28689
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-B-fqxnfz.js");
28703
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CnV1fqDs.js");
28690
28704
  try {
28691
28705
  await logTextMeasurementDiagnostic(svgToDraw);
28692
28706
  } catch {
@@ -29086,4 +29100,4 @@ export {
29086
29100
  buildTeaserBlurFlatKeys as y,
29087
29101
  collectFontDescriptorsFromConfig as z
29088
29102
  };
29089
- //# sourceMappingURL=index-Bk-8sAnE.js.map
29103
+ //# sourceMappingURL=index-DFjuU6N6.js.map