@pixldocs/canvas-renderer 0.5.445 → 0.5.446

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.
@@ -11664,7 +11664,7 @@ const applyTransformPreservingFlip = (obj, matrix) => {
11664
11664
  const restorePersistedFlipState = (obj, flipX, flipY, angle) => {
11665
11665
  const sx = Math.abs(Number(obj.scaleX ?? 1)) || 1;
11666
11666
  const sy = Math.abs(Number(obj.scaleY ?? 1)) || 1;
11667
- obj.set({ scaleX: sx, scaleY: sy, flipX, flipY, ...Number.isFinite(angle) ? { angle } : {} });
11667
+ obj.set({ scaleX: sx, scaleY: sy, skewX: 0, skewY: 0, flipX, flipY, ...Number.isFinite(angle) ? { angle } : {} });
11668
11668
  obj.setCoords();
11669
11669
  obj.dirty = true;
11670
11670
  };
@@ -11775,11 +11775,16 @@ function applyWarpAwareSelectionBorders(selection) {
11775
11775
  selection.calcTransformMatrix()
11776
11776
  );
11777
11777
  kids.forEach((k, index) => {
11778
+ var _a3;
11778
11779
  const beforeRestore = summarizeRotDriftObject(k);
11779
11780
  const localMatrix = fabric.util.multiplyTransformMatrices(
11780
11781
  invSelection,
11781
11782
  worldMatrices[index]
11782
11783
  );
11784
+ const isImageLikeKid = k instanceof fabric.FabricImage || k instanceof fabric.Group && (k.__cropGroup || ((_a3 = k._ct) == null ? void 0 : _a3.isCropGroup));
11785
+ const persistedKidFlipX = !!k.flipX;
11786
+ const persistedKidFlipY = !!k.flipY;
11787
+ const expectedCleanKidAngle = isImageLikeKid && (persistedKidFlipX || persistedKidFlipY) ? fabric.util.qrDecompose(toggleLogicalFlipInMatrix(localMatrix, persistedKidFlipX, persistedKidFlipY)).angle ?? 0 : void 0;
11783
11788
  const savedLayout = k.layoutManager;
11784
11789
  try {
11785
11790
  if (savedLayout) k.layoutManager = void 0;
@@ -11789,6 +11794,9 @@ function applyWarpAwareSelectionBorders(selection) {
11789
11794
  );
11790
11795
  const expectedCenter = new fabric.Point(decomposed.translateX, decomposed.translateY);
11791
11796
  k.setPositionByOrigin(expectedCenter, "center", "center");
11797
+ if (isImageLikeKid && (persistedKidFlipX || persistedKidFlipY)) {
11798
+ restorePersistedFlipState(k, persistedKidFlipX, persistedKidFlipY, expectedCleanKidAngle);
11799
+ }
11792
11800
  } finally {
11793
11801
  if (savedLayout) k.layoutManager = savedLayout;
11794
11802
  }
@@ -14867,22 +14875,6 @@ const PageCanvas = forwardRef(
14867
14875
  const startSy = Math.abs(Number(((_h = _cur == null ? void 0 : _cur.original) == null ? void 0 : _h.scaleY) ?? 1)) || 1;
14868
14876
  const sAxis = isXSide ? Math.abs((obj.scaleX ?? 1) / startSx) : Math.abs((obj.scaleY ?? 1) / startSy);
14869
14877
  if (sAxis > 1e-3) {
14870
- const captureAsLiveWorldSnapshot = (childObj, liveW, liveH) => {
14871
- try {
14872
- const selectionMatrix = obj.calcTransformMatrix();
14873
- const childMatrix = childObj.calcOwnMatrix();
14874
- const worldMatrix = fabric.util.multiplyTransformMatrices(selectionMatrix, childMatrix);
14875
- const live = fabric.util.qrDecompose(worldMatrix);
14876
- const childOrigLocalAngle = Number.isFinite(childObj.__asLiveOrigAngle) ? childObj.__asLiveOrigAngle : childObj.angle ?? 0;
14877
- childObj.__asLiveWorldAngle = (obj.angle ?? 0) + childOrigLocalAngle;
14878
- childObj.__asLiveWorldCenterX = live.translateX;
14879
- childObj.__asLiveWorldCenterY = live.translateY;
14880
- childObj.__asLiveParentWorldAngle = obj.angle ?? 0;
14881
- if (Number.isFinite(liveW)) childObj.__asLiveFinalW = liveW;
14882
- if (Number.isFinite(liveH)) childObj.__asLiveFinalH = liveH;
14883
- } catch {
14884
- }
14885
- };
14886
14878
  if (isXSide && ((_i = groupShiftReflowSnapshotRef.current) == null ? void 0 : _i.selection) !== obj) {
14887
14879
  groupShiftReflowSnapshotRef.current = null;
14888
14880
  const logicalGroupId = obj.__pixldocsGroupSelection;
@@ -14925,118 +14917,12 @@ const PageCanvas = forwardRef(
14925
14917
  child.__asLiveOrigAngle = Number.isFinite(child.angle) ? child.angle ?? 0 : 0;
14926
14918
  }
14927
14919
  if (child instanceof fabric.Group && (child.__cropGroup || ((_m = child._ct) == null ? void 0 : _m.isCropGroup))) {
14928
- const ct = child.__cropData;
14929
- if (!ct) continue;
14930
- if (child.__asLiveOrigAngle == null) {
14931
- child.__asLiveOrigAngle = child.angle ?? 0;
14932
- }
14933
- const childAngleDegC = child.__asLiveOrigAngle;
14934
- const asSxC = isXSide ? sAxis : 1;
14935
- const asSyC = isXSide ? 1 : sAxis;
14936
- const thetaC = fabric.util.degreesToRadians(childAngleDegC);
14937
- const cosTC = Math.cos(thetaC);
14938
- const sinTC = Math.sin(thetaC);
14939
- const sLocalC = isXSide ? asSxC * cosTC * cosTC + sinTC * sinTC : asSyC * cosTC * cosTC + sinTC * sinTC;
14940
- if (isXSide) {
14941
- if (child.__asLiveOrigW == null) {
14942
- const baseW = child.width ?? ct.frameW ?? 0;
14943
- child.__asLiveOrigW = baseW * (child.scaleX ?? 1);
14944
- }
14945
- const origW = child.__asLiveOrigW;
14946
- const newW = Math.max(20, origW * sLocalC);
14947
- if (Math.abs((child.width ?? 0) - newW) > 0.5) {
14948
- ct.frameW = newW;
14949
- child._set("width", newW);
14950
- }
14951
- } else {
14952
- if (child.__asLiveOrigH == null) {
14953
- const baseH = child.height ?? ct.frameH ?? 0;
14954
- child.__asLiveOrigH = baseH * (child.scaleY ?? 1);
14955
- }
14956
- const origH = child.__asLiveOrigH;
14957
- const newH = Math.max(20, origH * sLocalC);
14958
- if (Math.abs((child.height ?? 0) - newH) > 0.5) {
14959
- ct.frameH = newH;
14960
- child._set("height", newH);
14961
- }
14962
- }
14963
- try {
14964
- const invC = [1 / asSxC, 0, 0, 1 / asSyC, 0, 0];
14965
- const RthetaC = fabric.util.composeMatrix({
14966
- angle: childAngleDegC,
14967
- scaleX: 1,
14968
- scaleY: 1,
14969
- translateX: 0,
14970
- translateY: 0
14971
- });
14972
- const MC = fabric.util.multiplyTransformMatrices(invC, RthetaC);
14973
- const decC = fabric.util.qrDecompose(MC);
14974
- child._set("angle", decC.angle);
14975
- child._set("scaleX", decC.scaleX);
14976
- child._set("scaleY", decC.scaleY);
14977
- child._set("skewX", decC.skewX);
14978
- child._set("skewY", decC.skewY);
14979
- } catch {
14980
- }
14981
- try {
14982
- updateCoverLayout(child);
14983
- } catch {
14984
- }
14985
14920
  child.setCoords();
14986
- captureAsLiveWorldSnapshot(child, ct.frameW ?? child.width ?? 0, ct.frameH ?? child.height ?? 0);
14987
14921
  child.dirty = true;
14988
14922
  continue;
14989
14923
  }
14990
14924
  if (child instanceof fabric.FabricImage && !child.__cropGroup && !child.smartElementType) {
14991
- if (child.__asLiveOrigAngle == null) {
14992
- child.__asLiveOrigAngle = child.angle ?? 0;
14993
- }
14994
- const childAngleDegI = child.__asLiveOrigAngle;
14995
- const asSxI = isXSide ? sAxis : 1;
14996
- const asSyI = isXSide ? 1 : sAxis;
14997
- const thetaI = fabric.util.degreesToRadians(childAngleDegI);
14998
- const cosTI = Math.cos(thetaI);
14999
- const sinTI = Math.sin(thetaI);
15000
- const sLocalI = isXSide ? asSxI * cosTI * cosTI + sinTI * sinTI : asSyI * cosTI * cosTI + sinTI * sinTI;
15001
- if (isXSide) {
15002
- if (child.__asLiveOrigW == null) {
15003
- child.__asLiveOrigW = (child.width ?? 0) * (child.scaleX ?? 1);
15004
- }
15005
- const origW = child.__asLiveOrigW;
15006
- const newW = Math.max(1, origW * sLocalI);
15007
- if (Math.abs((child.width ?? 0) - newW) > 0.5) {
15008
- child._set("width", newW);
15009
- }
15010
- } else {
15011
- if (child.__asLiveOrigH == null) {
15012
- child.__asLiveOrigH = (child.height ?? 0) * (child.scaleY ?? 1);
15013
- }
15014
- const origH = child.__asLiveOrigH;
15015
- const newH = Math.max(1, origH * sLocalI);
15016
- if (Math.abs((child.height ?? 0) - newH) > 0.5) {
15017
- child._set("height", newH);
15018
- }
15019
- }
15020
- try {
15021
- const invI = [1 / asSxI, 0, 0, 1 / asSyI, 0, 0];
15022
- const RthetaI = fabric.util.composeMatrix({
15023
- angle: childAngleDegI,
15024
- scaleX: 1,
15025
- scaleY: 1,
15026
- translateX: 0,
15027
- translateY: 0
15028
- });
15029
- const MI = fabric.util.multiplyTransformMatrices(invI, RthetaI);
15030
- const decI = fabric.util.qrDecompose(MI);
15031
- child._set("angle", decI.angle);
15032
- child._set("scaleX", decI.scaleX);
15033
- child._set("scaleY", decI.scaleY);
15034
- child._set("skewX", decI.skewX);
15035
- child._set("skewY", decI.skewY);
15036
- } catch {
15037
- }
15038
14925
  child.setCoords();
15039
- captureAsLiveWorldSnapshot(child, child.width ?? 0, child.height ?? 0);
15040
14926
  child.dirty = true;
15041
14927
  continue;
15042
14928
  }
@@ -25923,9 +25809,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25923
25809
  }
25924
25810
  return svgString;
25925
25811
  }
25926
- const resolvedPackageVersion = "0.5.445";
25812
+ const resolvedPackageVersion = "0.5.446";
25927
25813
  const PACKAGE_VERSION = resolvedPackageVersion;
25928
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.445";
25814
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.446";
25929
25815
  const roundParityValue = (value) => {
25930
25816
  if (typeof value !== "number") return value;
25931
25817
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26739,7 +26625,7 @@ class PixldocsRenderer {
26739
26625
  await this.waitForCanvasScene(container, cloned, i);
26740
26626
  }
26741
26627
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26742
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-B5RZe-Kw.js");
26628
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DNSgRVdW.js");
26743
26629
  const prepared = preparePagesForExport(
26744
26630
  cloned.pages,
26745
26631
  canvasWidth,
@@ -29059,7 +28945,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29059
28945
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29060
28946
  sanitizeSvgTreeForPdf(svgToDraw);
29061
28947
  try {
29062
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-B5RZe-Kw.js");
28948
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DNSgRVdW.js");
29063
28949
  try {
29064
28950
  await logTextMeasurementDiagnostic(svgToDraw);
29065
28951
  } catch {
@@ -29459,4 +29345,4 @@ export {
29459
29345
  buildTeaserBlurFlatKeys as y,
29460
29346
  collectFontDescriptorsFromConfig as z
29461
29347
  };
29462
- //# sourceMappingURL=index-DX5LKnWg.js.map
29348
+ //# sourceMappingURL=index-BhfNlcH_.js.map