@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.
@@ -14372,7 +14372,7 @@ const PageCanvas = react.forwardRef(
14372
14372
  fabricCanvas.on("selection:cleared", () => {
14373
14373
  });
14374
14374
  fabricCanvas.on("object:scaling", (e) => {
14375
- var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
14375
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
14376
14376
  if (!isActiveRef.current) return;
14377
14377
  const t = e.target;
14378
14378
  if (t) lastResizeScaleTargetRef.current = t;
@@ -14663,14 +14663,19 @@ const PageCanvas = react.forwardRef(
14663
14663
  let didReflowTextChild = false;
14664
14664
  for (const child of obj.getObjects()) {
14665
14665
  if (child.__asLiveOrigAngle == null) {
14666
- const childId = getObjectId(child);
14667
- const sourceChild = childId ? elementsRef.current.find((el) => el.id === childId) : void 0;
14668
- const storedWorldAngle = Number.isFinite(sourceChild == null ? void 0 : sourceChild.angle) ? sourceChild.angle ?? 0 : void 0;
14669
- const logicalGroupId = obj.__pixldocsGroupSelection;
14670
- const groupWorldAngle = logicalGroupId ? ((_k = groupSelectionTransformStartRef.current) == null ? void 0 : _k.groupId) === logicalGroupId ? groupSelectionTransformStartRef.current.groupAngle : obj.__pixldocsFrozenGroupAngle ?? (obj.angle ?? 0) : 0;
14671
- child.__asLiveOrigAngle = storedWorldAngle !== void 0 ? storedWorldAngle - groupWorldAngle : child.angle ?? 0;
14666
+ const currentLocalAngle = Number.isFinite(child.angle) ? child.angle ?? 0 : void 0;
14667
+ let matrixLocalAngle;
14668
+ try {
14669
+ const selectionMatrix = obj.calcTransformMatrix();
14670
+ const childMatrix = child.calcOwnMatrix();
14671
+ const worldMatrix = fabric__namespace.util.multiplyTransformMatrices(selectionMatrix, childMatrix);
14672
+ const liveWorldAngle = fabric__namespace.util.qrDecompose(worldMatrix).angle ?? 0;
14673
+ matrixLocalAngle = liveWorldAngle - (obj.angle ?? 0);
14674
+ } catch {
14675
+ }
14676
+ child.__asLiveOrigAngle = currentLocalAngle ?? matrixLocalAngle ?? 0;
14672
14677
  }
14673
- if (child instanceof fabric__namespace.Group && (child.__cropGroup || ((_l = child._ct) == null ? void 0 : _l.isCropGroup))) {
14678
+ if (child instanceof fabric__namespace.Group && (child.__cropGroup || ((_k = child._ct) == null ? void 0 : _k.isCropGroup))) {
14674
14679
  const ct = child.__cropData;
14675
14680
  if (!ct) continue;
14676
14681
  if (child.__asLiveOrigAngle == null) {
@@ -14839,7 +14844,7 @@ const PageCanvas = react.forwardRef(
14839
14844
  child.dirty = true;
14840
14845
  didReflowTextChild = true;
14841
14846
  }
14842
- if (isXSide && ((_m = groupShiftReflowSnapshotRef.current) == null ? void 0 : _m.selection) === obj) {
14847
+ if (isXSide && ((_l = groupShiftReflowSnapshotRef.current) == null ? void 0 : _l.selection) === obj) {
14843
14848
  const snap = groupShiftReflowSnapshotRef.current;
14844
14849
  const anchorEntry = snap.children[0];
14845
14850
  const anchorTopLive = anchorEntry.obj.top ?? 0;
@@ -15000,7 +15005,7 @@ const PageCanvas = react.forwardRef(
15000
15005
  setGuides(gridGuidesForScale.length ? [...scaleGuides, ...gridGuidesForScale] : scaleGuides);
15001
15006
  if (drilledGroupIdRef.current) {
15002
15007
  try {
15003
- (_n = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _n.call(fabricCanvas);
15008
+ (_m = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _m.call(fabricCanvas);
15004
15009
  } catch {
15005
15010
  }
15006
15011
  }
@@ -15930,7 +15935,16 @@ const PageCanvas = react.forwardRef(
15930
15935
  scaleX: 1,
15931
15936
  scaleY: 1,
15932
15937
  skewX: 0,
15933
- skewY: 0
15938
+ skewY: 0,
15939
+ // CRITICAL: restore the child's ORIGINAL local angle (pre-live-preview).
15940
+ // The live preview path mutates obj.angle via qrDecompose(S^-1·R(θ))
15941
+ // to cancel AS shear visually. If we leave that mutated angle on the
15942
+ // object, fabric's AS-discard step bakes (AS.angle + mutatedAngle)
15943
+ // into the standalone image — so the next individual rotation starts
15944
+ // from a wrong base and visibly "snaps back" to the pre-resize angle.
15945
+ // Restoring the original local angle here makes AS-discard bake the
15946
+ // correct world angle (AS.angle + imgChildLocalAngle === worldAngleI).
15947
+ angle: imgChildLocalAngle
15934
15948
  });
15935
15949
  obj.dirty = true;
15936
15950
  obj.setCoords();
@@ -25568,9 +25582,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25568
25582
  }
25569
25583
  return svgString;
25570
25584
  }
25571
- const resolvedPackageVersion = "0.5.420";
25585
+ const resolvedPackageVersion = "0.5.422";
25572
25586
  const PACKAGE_VERSION = resolvedPackageVersion;
25573
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.420";
25587
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.422";
25574
25588
  const roundParityValue = (value) => {
25575
25589
  if (typeof value !== "number") return value;
25576
25590
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26384,7 +26398,7 @@ class PixldocsRenderer {
26384
26398
  await this.waitForCanvasScene(container, cloned, i);
26385
26399
  }
26386
26400
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26387
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-Cq4TBhox.cjs"));
26401
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DdBfenYt.cjs"));
26388
26402
  const prepared = preparePagesForExport(
26389
26403
  cloned.pages,
26390
26404
  canvasWidth,
@@ -28704,7 +28718,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28704
28718
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28705
28719
  sanitizeSvgTreeForPdf(svgToDraw);
28706
28720
  try {
28707
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-Cq4TBhox.cjs"));
28721
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DdBfenYt.cjs"));
28708
28722
  try {
28709
28723
  await logTextMeasurementDiagnostic(svgToDraw);
28710
28724
  } catch {
@@ -29101,4 +29115,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
29101
29115
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
29102
29116
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
29103
29117
  exports.warmTemplateFromForm = warmTemplateFromForm;
29104
- //# sourceMappingURL=index-yZYb0Y4m.cjs.map
29118
+ //# sourceMappingURL=index-yOZRi1jo.cjs.map