@pixldocs/canvas-renderer 0.5.448 → 0.5.450

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,17 +11664,20 @@ const bakeTextboxScaleIntoTypography = (obj, sourceElement) => {
11664
11664
  return updates;
11665
11665
  };
11666
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;
11667
+ const intendedFlipX = obj.flipX ?? false;
11668
+ const intendedFlipY = obj.flipY ?? false;
11669
+ const cleanMatrix = toggleLogicalFlipInMatrix(matrix, intendedFlipX, intendedFlipY);
11670
+ fabric__namespace.util.applyTransformToObject(obj, cleanMatrix);
11671
+ let sx = Number(obj.scaleX ?? 1) || 1;
11672
+ let sy = Number(obj.scaleY ?? 1) || 1;
11673
+ let flipX = intendedFlipX;
11674
+ let flipY = intendedFlipY;
11672
11675
  if (sx < 0) {
11673
- flipX = true;
11676
+ flipX = !flipX;
11674
11677
  sx = -sx;
11675
11678
  }
11676
11679
  if (sy < 0) {
11677
- flipY = true;
11680
+ flipY = !flipY;
11678
11681
  sy = -sy;
11679
11682
  }
11680
11683
  obj.set({ scaleX: sx, scaleY: sy, flipX, flipY });
@@ -11682,19 +11685,13 @@ const applyTransformPreservingFlip = (obj, matrix) => {
11682
11685
  const restorePersistedFlipState = (obj, flipX, flipY, angle) => {
11683
11686
  const sx = Math.abs(Number(obj.scaleX ?? 1)) || 1;
11684
11687
  const sy = Math.abs(Number(obj.scaleY ?? 1)) || 1;
11685
- obj.set({ scaleX: sx, scaleY: sy, skewX: 0, skewY: 0, flipX, flipY, ...Number.isFinite(angle) ? { angle } : {} });
11686
- obj.setCoords();
11687
- obj.dirty = true;
11688
- };
11689
- const isBitmapLikeFabricObject = (obj) => {
11690
- var _a2;
11691
- return obj instanceof fabric__namespace.FabricImage || obj instanceof fabric__namespace.Group && !!(obj.__cropGroup || ((_a2 = obj._ct) == null ? void 0 : _a2.isCropGroup));
11692
- };
11693
- const restorePersistedFlipFlagsOnly = (obj, flipX, flipY) => {
11694
- if (!isBitmapLikeFabricObject(obj)) return;
11695
- const sx = Math.abs(Number(obj.scaleX ?? 1)) || 1;
11696
- const sy = Math.abs(Number(obj.scaleY ?? 1)) || 1;
11697
- obj.set({ scaleX: sx, scaleY: sy, flipX, flipY });
11688
+ obj.set({
11689
+ scaleX: sx,
11690
+ scaleY: sy,
11691
+ flipX,
11692
+ flipY,
11693
+ ...Number.isFinite(angle) ? { angle } : {}
11694
+ });
11698
11695
  obj.setCoords();
11699
11696
  obj.dirty = true;
11700
11697
  };
@@ -11805,16 +11802,11 @@ function applyWarpAwareSelectionBorders(selection) {
11805
11802
  selection.calcTransformMatrix()
11806
11803
  );
11807
11804
  kids.forEach((k, index) => {
11808
- var _a3;
11809
11805
  const beforeRestore = summarizeRotDriftObject(k);
11810
11806
  const localMatrix = fabric__namespace.util.multiplyTransformMatrices(
11811
11807
  invSelection,
11812
11808
  worldMatrices[index]
11813
11809
  );
11814
- const isImageLikeKid = k instanceof fabric__namespace.FabricImage || k instanceof fabric__namespace.Group && (k.__cropGroup || ((_a3 = k._ct) == null ? void 0 : _a3.isCropGroup));
11815
- const persistedKidFlipX = !!k.flipX;
11816
- const persistedKidFlipY = !!k.flipY;
11817
- const expectedCleanKidAngle = isImageLikeKid && (persistedKidFlipX || persistedKidFlipY) ? fabric__namespace.util.qrDecompose(toggleLogicalFlipInMatrix(localMatrix, persistedKidFlipX, persistedKidFlipY)).angle ?? 0 : void 0;
11818
11810
  const savedLayout = k.layoutManager;
11819
11811
  try {
11820
11812
  if (savedLayout) k.layoutManager = void 0;
@@ -11824,9 +11816,6 @@ function applyWarpAwareSelectionBorders(selection) {
11824
11816
  );
11825
11817
  const expectedCenter = new fabric__namespace.Point(decomposed.translateX, decomposed.translateY);
11826
11818
  k.setPositionByOrigin(expectedCenter, "center", "center");
11827
- if (isImageLikeKid && (persistedKidFlipX || persistedKidFlipY)) {
11828
- restorePersistedFlipState(k, persistedKidFlipX, persistedKidFlipY, expectedCleanKidAngle);
11829
- }
11830
11819
  } finally {
11831
11820
  if (savedLayout) k.layoutManager = savedLayout;
11832
11821
  }
@@ -14667,7 +14656,7 @@ const PageCanvas = react.forwardRef(
14667
14656
  fabricCanvas.on("selection:cleared", () => {
14668
14657
  });
14669
14658
  fabricCanvas.on("object:scaling", (e) => {
14670
- var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
14659
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
14671
14660
  if (!isActiveRef.current) return;
14672
14661
  const t = e.target;
14673
14662
  if (t) lastResizeScaleTargetRef.current = t;
@@ -14898,66 +14887,11 @@ const PageCanvas = react.forwardRef(
14898
14887
  };
14899
14888
  }
14900
14889
  }
14901
- if (obj instanceof fabric__namespace.ActiveSelection && isCornerResizeHandle(corner)) {
14902
- const _cur = fabricCanvas._currentTransform;
14903
- const startSx = Math.abs(Number(((_g = _cur == null ? void 0 : _cur.original) == null ? void 0 : _g.scaleX) ?? 1)) || 1;
14904
- const startSy = Math.abs(Number(((_h = _cur == null ? void 0 : _cur.original) == null ? void 0 : _h.scaleY) ?? 1)) || 1;
14905
- const liveAsSx = Math.abs((obj.scaleX ?? 1) / startSx) || 1;
14906
- const liveAsSy = Math.abs((obj.scaleY ?? 1) / startSy) || 1;
14907
- const uniform = Math.max(1e-3, Math.sqrt(liveAsSx * liveAsSy));
14908
- for (const child of obj.getObjects()) {
14909
- if (!isBitmapLikeFabricObject(child)) continue;
14910
- const liveGestureKey = `${obj.__pixldocsGroupSelection ?? "selection"}:${corner}:${((_i = groupSelectionTransformStartRef.current) == null ? void 0 : _i.selectionLeft) ?? obj.left ?? 0}:${((_j = groupSelectionTransformStartRef.current) == null ? void 0 : _j.selectionTop) ?? obj.top ?? 0}`;
14911
- if (child.__asLiveGestureKey !== liveGestureKey) {
14912
- child.__asLiveGestureKey = liveGestureKey;
14913
- child.__asLiveOrigAngle = Number.isFinite(child.angle) ? child.angle ?? 0 : 0;
14914
- child.__asLiveOrigFlipX = !!child.flipX;
14915
- child.__asLiveOrigFlipY = !!child.flipY;
14916
- child.__asLiveOrigScaleX = Math.abs(Number(child.scaleX ?? 1)) || 1;
14917
- child.__asLiveOrigScaleY = Math.abs(Number(child.scaleY ?? 1)) || 1;
14918
- }
14919
- const childAngleDeg = child.__asLiveOrigAngle ?? (child.angle ?? 0);
14920
- const origScaleX = child.__asLiveOrigScaleX;
14921
- const origScaleY = child.__asLiveOrigScaleY;
14922
- const baseW = Math.max(1, Number(((_k = child.__cropData) == null ? void 0 : _k.frameW) ?? child.width ?? 1));
14923
- const baseH = Math.max(1, Number(((_l = child.__cropData) == null ? void 0 : _l.frameH) ?? child.height ?? 1));
14924
- try {
14925
- const inv = [1 / liveAsSx, 0, 0, 1 / liveAsSy, 0, 0];
14926
- const Rtheta = fabric__namespace.util.composeMatrix({ angle: childAngleDeg, scaleX: 1, scaleY: 1, translateX: 0, translateY: 0 });
14927
- const Uscale = fabric__namespace.util.composeMatrix({ angle: 0, scaleX: origScaleX * uniform, scaleY: origScaleY * uniform, translateX: 0, translateY: 0 });
14928
- const M = fabric__namespace.util.multiplyTransformMatrices(
14929
- fabric__namespace.util.multiplyTransformMatrices(inv, Rtheta),
14930
- Uscale
14931
- );
14932
- const dec = fabric__namespace.util.qrDecompose(M);
14933
- child._set("angle", dec.angle);
14934
- child._set("scaleX", dec.scaleX);
14935
- child._set("scaleY", dec.scaleY);
14936
- child._set("skewX", dec.skewX);
14937
- child._set("skewY", dec.skewY);
14938
- child._set("flipX", !!(child.__asLiveOrigFlipX ?? child.flipX));
14939
- child._set("flipY", !!(child.__asLiveOrigFlipY ?? child.flipY));
14940
- const worldMatrix = fabric__namespace.util.multiplyTransformMatrices(
14941
- obj.calcTransformMatrix(),
14942
- child.calcOwnMatrix()
14943
- );
14944
- const live = fabric__namespace.util.qrDecompose(worldMatrix);
14945
- child.__asLiveWorldAngle = (obj.angle ?? 0) + childAngleDeg;
14946
- child.__asLiveWorldCenterX = live.translateX;
14947
- child.__asLiveWorldCenterY = live.translateY;
14948
- child.__asLiveFinalW = baseW * origScaleX * uniform;
14949
- child.__asLiveFinalH = baseH * origScaleY * uniform;
14950
- } catch {
14951
- }
14952
- child.setCoords();
14953
- child.dirty = true;
14954
- }
14955
- }
14956
14890
  if (obj instanceof fabric__namespace.ActiveSelection && (corner === "ml" || corner === "mr" || corner === "mt" || corner === "mb")) {
14957
14891
  const isXSide = corner === "ml" || corner === "mr";
14958
14892
  const _cur = fabricCanvas._currentTransform;
14959
- const startSx = Math.abs(Number(((_m = _cur == null ? void 0 : _cur.original) == null ? void 0 : _m.scaleX) ?? 1)) || 1;
14960
- const startSy = Math.abs(Number(((_n = _cur == null ? void 0 : _cur.original) == null ? void 0 : _n.scaleY) ?? 1)) || 1;
14893
+ const startSx = Math.abs(Number(((_g = _cur == null ? void 0 : _cur.original) == null ? void 0 : _g.scaleX) ?? 1)) || 1;
14894
+ const startSy = Math.abs(Number(((_h = _cur == null ? void 0 : _cur.original) == null ? void 0 : _h.scaleY) ?? 1)) || 1;
14961
14895
  const sAxis = isXSide ? Math.abs((obj.scaleX ?? 1) / startSx) : Math.abs((obj.scaleY ?? 1) / startSy);
14962
14896
  if (sAxis > 1e-3) {
14963
14897
  const captureAsLiveWorldSnapshot = (childObj, liveW, liveH) => {
@@ -14976,13 +14910,13 @@ const PageCanvas = react.forwardRef(
14976
14910
  } catch {
14977
14911
  }
14978
14912
  };
14979
- if (isXSide && ((_o = groupShiftReflowSnapshotRef.current) == null ? void 0 : _o.selection) !== obj) {
14913
+ if (isXSide && ((_i = groupShiftReflowSnapshotRef.current) == null ? void 0 : _i.selection) !== obj) {
14980
14914
  groupShiftReflowSnapshotRef.current = null;
14981
14915
  const logicalGroupId = obj.__pixldocsGroupSelection;
14982
14916
  if (logicalGroupId) {
14983
14917
  try {
14984
14918
  const state = useEditorStore.getState();
14985
- const pageChildren2 = ((_p = state.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _p.children) ?? [];
14919
+ const pageChildren2 = ((_j = state.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _j.children) ?? [];
14986
14920
  const groupNode = findNodeById(pageChildren2, logicalGroupId);
14987
14921
  if (groupNode && isGroup(groupNode) && !isStackLayoutMode(groupNode.layoutMode)) {
14988
14922
  const entries = obj.getObjects().map((c) => ({
@@ -15012,50 +14946,124 @@ const PageCanvas = react.forwardRef(
15012
14946
  const asRect0 = obj.getBoundingRect();
15013
14947
  let didReflowTextChild = false;
15014
14948
  for (const child of obj.getObjects()) {
15015
- const liveGestureKey = `${obj.__pixldocsGroupSelection ?? "selection"}:${corner}:${((_q = groupSelectionTransformStartRef.current) == null ? void 0 : _q.selectionLeft) ?? obj.left ?? 0}:${((_r = groupSelectionTransformStartRef.current) == null ? void 0 : _r.selectionTop) ?? obj.top ?? 0}`;
14949
+ const liveGestureKey = `${obj.__pixldocsGroupSelection ?? "selection"}:${corner}:${((_k = groupSelectionTransformStartRef.current) == null ? void 0 : _k.selectionLeft) ?? obj.left ?? 0}:${((_l = groupSelectionTransformStartRef.current) == null ? void 0 : _l.selectionTop) ?? obj.top ?? 0}`;
15016
14950
  if (child.__asLiveGestureKey !== liveGestureKey) {
15017
14951
  child.__asLiveGestureKey = liveGestureKey;
15018
14952
  child.__asLiveOrigAngle = Number.isFinite(child.angle) ? child.angle ?? 0 : 0;
15019
- child.__asLiveOrigFlipX = !!child.flipX;
15020
- child.__asLiveOrigFlipY = !!child.flipY;
15021
14953
  }
15022
- const liveAsSx = isXSide ? sAxis : 1;
15023
- const liveAsSy = isXSide ? 1 : sAxis;
15024
- if (child instanceof fabric__namespace.Group && (child.__cropGroup || ((_s = child._ct) == null ? void 0 : _s.isCropGroup)) || child instanceof fabric__namespace.FabricImage && !child.__cropGroup && !child.smartElementType) {
15025
- const childAngleDeg2 = child.__asLiveOrigAngle ?? (child.angle ?? 0);
15026
- const theta2 = fabric__namespace.util.degreesToRadians(childAngleDeg2);
15027
- const cosT2 = Math.cos(theta2);
15028
- const sinT2 = Math.sin(theta2);
15029
- const dX = isXSide ? Math.max(1e-3, liveAsSx * cosT2 * cosT2 + sinT2 * sinT2) : 1;
15030
- const dY = isXSide ? 1 : Math.max(1e-3, liveAsSy * cosT2 * cosT2 + sinT2 * sinT2);
15031
- if (child.__asLiveOrigScaleX == null) child.__asLiveOrigScaleX = Math.abs(Number(child.scaleX ?? 1)) || 1;
15032
- if (child.__asLiveOrigScaleY == null) child.__asLiveOrigScaleY = Math.abs(Number(child.scaleY ?? 1)) || 1;
15033
- const origScaleX = child.__asLiveOrigScaleX;
15034
- const origScaleY = child.__asLiveOrigScaleY;
15035
- const baseW = Math.max(1, Number(((_t = child.__cropData) == null ? void 0 : _t.frameW) ?? child.width ?? 1));
15036
- const baseH = Math.max(1, Number(((_u = child.__cropData) == null ? void 0 : _u.frameH) ?? child.height ?? 1));
15037
- const liveW = baseW * origScaleX * dX;
15038
- const liveH = baseH * origScaleY * dY;
14954
+ if (child instanceof fabric__namespace.Group && (child.__cropGroup || ((_m = child._ct) == null ? void 0 : _m.isCropGroup))) {
14955
+ const ct = child.__cropData;
14956
+ if (!ct) continue;
14957
+ if (child.__asLiveOrigAngle == null) {
14958
+ child.__asLiveOrigAngle = child.angle ?? 0;
14959
+ }
14960
+ const childAngleDegC = child.__asLiveOrigAngle;
14961
+ const asSxC = isXSide ? sAxis : 1;
14962
+ const asSyC = isXSide ? 1 : sAxis;
14963
+ const thetaC = fabric__namespace.util.degreesToRadians(childAngleDegC);
14964
+ const cosTC = Math.cos(thetaC);
14965
+ const sinTC = Math.sin(thetaC);
14966
+ const sLocalC = isXSide ? asSxC * cosTC * cosTC + sinTC * sinTC : asSyC * cosTC * cosTC + sinTC * sinTC;
14967
+ if (isXSide) {
14968
+ if (child.__asLiveOrigW == null) {
14969
+ const baseW = child.width ?? ct.frameW ?? 0;
14970
+ child.__asLiveOrigW = baseW * (child.scaleX ?? 1);
14971
+ }
14972
+ const origW = child.__asLiveOrigW;
14973
+ const newW = Math.max(20, origW * sLocalC);
14974
+ if (Math.abs((child.width ?? 0) - newW) > 0.5) {
14975
+ ct.frameW = newW;
14976
+ child._set("width", newW);
14977
+ }
14978
+ } else {
14979
+ if (child.__asLiveOrigH == null) {
14980
+ const baseH = child.height ?? ct.frameH ?? 0;
14981
+ child.__asLiveOrigH = baseH * (child.scaleY ?? 1);
14982
+ }
14983
+ const origH = child.__asLiveOrigH;
14984
+ const newH = Math.max(20, origH * sLocalC);
14985
+ if (Math.abs((child.height ?? 0) - newH) > 0.5) {
14986
+ ct.frameH = newH;
14987
+ child._set("height", newH);
14988
+ }
14989
+ }
15039
14990
  try {
15040
- const inv = [1 / liveAsSx, 0, 0, 1 / liveAsSy, 0, 0];
15041
- const Rtheta = fabric__namespace.util.composeMatrix({ angle: childAngleDeg2, scaleX: 1, scaleY: 1, translateX: 0, translateY: 0 });
15042
- const Dscale = fabric__namespace.util.composeMatrix({ angle: 0, scaleX: origScaleX * dX, scaleY: origScaleY * dY, translateX: 0, translateY: 0 });
15043
- const M = fabric__namespace.util.multiplyTransformMatrices(
15044
- fabric__namespace.util.multiplyTransformMatrices(inv, Rtheta),
15045
- Dscale
15046
- );
15047
- const dec = fabric__namespace.util.qrDecompose(M);
15048
- child._set("angle", dec.angle);
15049
- child._set("scaleX", dec.scaleX);
15050
- child._set("scaleY", dec.scaleY);
15051
- child._set("skewX", dec.skewX);
15052
- child._set("skewY", dec.skewY);
15053
- child._set("flipX", !!(child.__asLiveOrigFlipX ?? child.flipX));
15054
- child._set("flipY", !!(child.__asLiveOrigFlipY ?? child.flipY));
14991
+ const invC = [1 / asSxC, 0, 0, 1 / asSyC, 0, 0];
14992
+ const RthetaC = fabric__namespace.util.composeMatrix({
14993
+ angle: childAngleDegC,
14994
+ scaleX: 1,
14995
+ scaleY: 1,
14996
+ translateX: 0,
14997
+ translateY: 0
14998
+ });
14999
+ const MC = fabric__namespace.util.multiplyTransformMatrices(invC, RthetaC);
15000
+ const decC = fabric__namespace.util.qrDecompose(MC);
15001
+ child._set("angle", decC.angle);
15002
+ child._set("scaleX", decC.scaleX);
15003
+ child._set("scaleY", decC.scaleY);
15004
+ child._set("skewX", decC.skewX);
15005
+ child._set("skewY", decC.skewY);
15006
+ } catch {
15007
+ }
15008
+ try {
15009
+ updateCoverLayout(child);
15010
+ } catch {
15011
+ }
15012
+ child.setCoords();
15013
+ captureAsLiveWorldSnapshot(child, ct.frameW ?? child.width ?? 0, ct.frameH ?? child.height ?? 0);
15014
+ child.dirty = true;
15015
+ continue;
15016
+ }
15017
+ if (child instanceof fabric__namespace.FabricImage && !child.__cropGroup && !child.smartElementType) {
15018
+ if (child.__asLiveOrigAngle == null) {
15019
+ child.__asLiveOrigAngle = child.angle ?? 0;
15020
+ }
15021
+ const childAngleDegI = child.__asLiveOrigAngle;
15022
+ const asSxI = isXSide ? sAxis : 1;
15023
+ const asSyI = isXSide ? 1 : sAxis;
15024
+ const thetaI = fabric__namespace.util.degreesToRadians(childAngleDegI);
15025
+ const cosTI = Math.cos(thetaI);
15026
+ const sinTI = Math.sin(thetaI);
15027
+ const sLocalI = isXSide ? asSxI * cosTI * cosTI + sinTI * sinTI : asSyI * cosTI * cosTI + sinTI * sinTI;
15028
+ if (isXSide) {
15029
+ if (child.__asLiveOrigW == null) {
15030
+ child.__asLiveOrigW = (child.width ?? 0) * (child.scaleX ?? 1);
15031
+ }
15032
+ const origW = child.__asLiveOrigW;
15033
+ const newW = Math.max(1, origW * sLocalI);
15034
+ if (Math.abs((child.width ?? 0) - newW) > 0.5) {
15035
+ child._set("width", newW);
15036
+ }
15037
+ } else {
15038
+ if (child.__asLiveOrigH == null) {
15039
+ child.__asLiveOrigH = (child.height ?? 0) * (child.scaleY ?? 1);
15040
+ }
15041
+ const origH = child.__asLiveOrigH;
15042
+ const newH = Math.max(1, origH * sLocalI);
15043
+ if (Math.abs((child.height ?? 0) - newH) > 0.5) {
15044
+ child._set("height", newH);
15045
+ }
15046
+ }
15047
+ try {
15048
+ const invI = [1 / asSxI, 0, 0, 1 / asSyI, 0, 0];
15049
+ const RthetaI = fabric__namespace.util.composeMatrix({
15050
+ angle: childAngleDegI,
15051
+ scaleX: 1,
15052
+ scaleY: 1,
15053
+ translateX: 0,
15054
+ translateY: 0
15055
+ });
15056
+ const MI = fabric__namespace.util.multiplyTransformMatrices(invI, RthetaI);
15057
+ const decI = fabric__namespace.util.qrDecompose(MI);
15058
+ child._set("angle", decI.angle);
15059
+ child._set("scaleX", decI.scaleX);
15060
+ child._set("scaleY", decI.scaleY);
15061
+ child._set("skewX", decI.skewX);
15062
+ child._set("skewY", decI.skewY);
15055
15063
  } catch {
15056
15064
  }
15057
- captureAsLiveWorldSnapshot(child, liveW, liveH);
15058
15065
  child.setCoords();
15066
+ captureAsLiveWorldSnapshot(child, child.width ?? 0, child.height ?? 0);
15059
15067
  child.dirty = true;
15060
15068
  continue;
15061
15069
  }
@@ -15112,7 +15120,7 @@ const PageCanvas = react.forwardRef(
15112
15120
  child.dirty = true;
15113
15121
  didReflowTextChild = true;
15114
15122
  }
15115
- if (isXSide && ((_v = groupShiftReflowSnapshotRef.current) == null ? void 0 : _v.selection) === obj) {
15123
+ if (isXSide && ((_n = groupShiftReflowSnapshotRef.current) == null ? void 0 : _n.selection) === obj) {
15116
15124
  const snap = groupShiftReflowSnapshotRef.current;
15117
15125
  const anchorEntry = snap.children[0];
15118
15126
  const anchorTopLive = anchorEntry.obj.top ?? 0;
@@ -15274,7 +15282,7 @@ const PageCanvas = react.forwardRef(
15274
15282
  setGuides(gridGuidesForScale.length ? [...scaleGuides, ...gridGuidesForScale] : scaleGuides);
15275
15283
  if (drilledGroupIdRef.current) {
15276
15284
  try {
15277
- (_w = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _w.call(fabricCanvas);
15285
+ (_o = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _o.call(fabricCanvas);
15278
15286
  } catch {
15279
15287
  }
15280
15288
  }
@@ -15501,8 +15509,6 @@ const PageCanvas = react.forwardRef(
15501
15509
  for (const child of t.getObjects()) {
15502
15510
  delete child.__asLiveOrigW;
15503
15511
  delete child.__asLiveOrigH;
15504
- delete child.__asLiveOrigScaleX;
15505
- delete child.__asLiveOrigScaleY;
15506
15512
  delete child.__asLiveRotSnap;
15507
15513
  delete child.__asLiveGestureKey;
15508
15514
  }
@@ -16205,12 +16211,10 @@ const PageCanvas = react.forwardRef(
16205
16211
  const ownSy = Math.abs(obj.scaleY ?? 1);
16206
16212
  const bakedW = Math.max(1, intrinsicWidth * ownSx * (imgIsXSide ? sLocalI : 1));
16207
16213
  const bakedH = Math.max(1, intrinsicHeight * ownSy * (imgIsXSide ? 1 : sLocalI));
16208
- const cleanW = Math.max(1, Number(obj.__asLiveFinalW ?? bakedW));
16209
- const cleanH = Math.max(1, Number(obj.__asLiveFinalH ?? bakedH));
16210
16214
  try {
16211
16215
  obj.set({
16212
- width: cleanW,
16213
- height: cleanH,
16216
+ width: bakedW,
16217
+ height: bakedH,
16214
16218
  scaleX: 1,
16215
16219
  scaleY: 1,
16216
16220
  skewX: 0,
@@ -16229,8 +16233,8 @@ const PageCanvas = react.forwardRef(
16229
16233
  obj.setCoords();
16230
16234
  } catch {
16231
16235
  }
16232
- finalWidth = cleanW;
16233
- finalHeight = cleanH;
16236
+ finalWidth = Math.max(1, Number(obj.__asLiveFinalW ?? bakedW));
16237
+ finalHeight = Math.max(1, Number(obj.__asLiveFinalH ?? bakedH));
16234
16238
  finalScaleX = 1;
16235
16239
  finalScaleY = 1;
16236
16240
  const worldCx = Number.isFinite(obj.__asLiveWorldCenterX) ? obj.__asLiveWorldCenterX : decomposed.translateX ?? 0;
@@ -16506,9 +16510,8 @@ const PageCanvas = react.forwardRef(
16506
16510
  const objectFlipY = obj.flipY ?? false;
16507
16511
  const persistedFlipX = (sourceElement == null ? void 0 : sourceElement.flipX) ?? objectFlipX;
16508
16512
  const persistedFlipY = (sourceElement == null ? void 0 : sourceElement.flipY) ?? objectFlipY;
16509
- const persistedAngle = sourceElement ? Number.isFinite(sourceElement.angle) ? sourceElement.angle ?? 0 : 0 : Number.isFinite(obj.angle) ? obj.angle ?? 0 : void 0;
16510
16513
  const isActiveSelectionResizeGesture = activeSelectionResizeHandle === "ml" || activeSelectionResizeHandle === "mr" || activeSelectionResizeHandle === "mt" || activeSelectionResizeHandle === "mb" || activeSelectionResizeHandle === "tl" || activeSelectionResizeHandle === "tr" || activeSelectionResizeHandle === "bl" || activeSelectionResizeHandle === "br";
16511
- const expectedCleanAngle = isActiveSelection && isActiveSelectionResizeGesture ? sourceElement ? Number.isFinite(sourceElement.angle) ? sourceElement.angle ?? 0 : 0 : Number.isFinite(obj.angle) ? obj.angle ?? 0 : void 0 : void 0;
16514
+ 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;
16512
16515
  const normalizedFinalAbsoluteMatrix = normalizeMatrixForPersistedFlip(
16513
16516
  toggleLogicalFlipInMatrix(
16514
16517
  finalAbsoluteMatrix,
@@ -16521,15 +16524,6 @@ const PageCanvas = react.forwardRef(
16521
16524
  );
16522
16525
  const cleanTransformMatrix = toggleLogicalFlipInMatrix(normalizedFinalAbsoluteMatrix, persistedFlipX, persistedFlipY);
16523
16526
  const persistedDecomposed = fabric__namespace.util.qrDecompose(cleanTransformMatrix);
16524
- if (isActiveSelection && (obj instanceof fabric__namespace.FabricImage || obj instanceof fabric__namespace.Group && obj.__cropGroup)) {
16525
- activeSelectionFlipRestores.push({
16526
- obj,
16527
- flipX: persistedFlipX,
16528
- flipY: persistedFlipY,
16529
- localAngle: Number.isFinite(obj.angle) ? obj.angle ?? 0 : persistedAngle,
16530
- worldAngle: persistedAngle
16531
- });
16532
- }
16533
16527
  const elementUpdate = {
16534
16528
  left: storePos.left,
16535
16529
  top: storePos.top,
@@ -16609,7 +16603,7 @@ const PageCanvas = react.forwardRef(
16609
16603
  }
16610
16604
  const isCropGroupObj = obj instanceof fabric__namespace.Group && obj.__cropGroup;
16611
16605
  const isPlainImageObj = obj instanceof fabric__namespace.FabricImage && !obj.__cropGroup && !obj.smartElementType;
16612
- if (isActiveSelection && isActiveSelectionResizeGesture && (isCropGroupObj || isPlainImageObj)) {
16606
+ if (isActiveSelection && isActiveSelectionSideHandle && (isCropGroupObj || isPlainImageObj)) {
16613
16607
  const childLocalAngleSrc = obj.__asLiveOrigAngle != null ? obj.__asLiveOrigAngle : Number.isFinite(sourceElement == null ? void 0 : sourceElement.angle) ? sourceElement.angle ?? 0 : obj.angle ?? 0;
16614
16608
  const normAng = (childLocalAngleSrc % 360 + 360) % 360;
16615
16609
  const isRotatedImg = Math.min(normAng, 360 - normAng) > 0.5;
@@ -16659,10 +16653,7 @@ const PageCanvas = react.forwardRef(
16659
16653
  });
16660
16654
  }
16661
16655
  if (isActiveSelection && (obj instanceof fabric__namespace.FabricImage || obj instanceof fabric__namespace.Group && obj.__cropGroup)) {
16662
- const restore = activeSelectionFlipRestores.find((entry) => entry.obj === obj);
16663
- if (restore) {
16664
- restore.worldAngle = Number.isFinite(elementUpdate.angle) ? elementUpdate.angle : persistedAngle;
16665
- }
16656
+ activeSelectionFlipRestores.push({ obj, flipX: persistedFlipX, flipY: persistedFlipY, angle: elementUpdate.angle });
16666
16657
  }
16667
16658
  if (isActiveSelection) {
16668
16659
  logRotGroupImageDrift("store-update-child", {
@@ -16760,14 +16751,14 @@ const PageCanvas = react.forwardRef(
16760
16751
  skipActiveSelectionBakeOnClearRef.current = true;
16761
16752
  try {
16762
16753
  for (const restore of activeSelectionFlipRestores) {
16763
- restorePersistedFlipFlagsOnly(restore.obj, restore.flipX, restore.flipY);
16754
+ restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY, restore.angle);
16764
16755
  }
16765
16756
  fabricCanvas.discardActiveObject();
16766
16757
  } finally {
16767
16758
  skipActiveSelectionBakeOnClearRef.current = false;
16768
16759
  }
16769
16760
  for (const restore of activeSelectionFlipRestores) {
16770
- restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY);
16761
+ restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY, restore.angle);
16771
16762
  }
16772
16763
  for (const bake of pendingCropGroupFrameBakes) {
16773
16764
  const ct = bake.obj.__cropData;
@@ -16788,9 +16779,6 @@ const PageCanvas = react.forwardRef(
16788
16779
  updateCoverLayout(bake.obj);
16789
16780
  bake.obj.setCoords();
16790
16781
  }
16791
- for (const restore of activeSelectionFlipRestores) {
16792
- restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY);
16793
- }
16794
16782
  if (membersToReselect.length > 1) {
16795
16783
  const newSel = new fabric__namespace.ActiveSelection(membersToReselect, { canvas: fabricCanvas });
16796
16784
  if (wasGroupSel) restoreGroupSelectionVisualState(newSel, wasGroupSel);
@@ -16848,10 +16836,6 @@ const PageCanvas = react.forwardRef(
16848
16836
  if (t instanceof fabric__namespace.ActiveSelection) {
16849
16837
  for (const child of t.getObjects()) {
16850
16838
  delete child.__asLiveOrigAngle;
16851
- delete child.__asLiveOrigFlipX;
16852
- delete child.__asLiveOrigFlipY;
16853
- delete child.__asLiveOrigScaleX;
16854
- delete child.__asLiveOrigScaleY;
16855
16839
  delete child.__asLiveGestureKey;
16856
16840
  delete child.__asLiveWorldAngle;
16857
16841
  delete child.__asLiveWorldCenterX;
@@ -25962,9 +25946,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25962
25946
  }
25963
25947
  return svgString;
25964
25948
  }
25965
- const resolvedPackageVersion = "0.5.448";
25949
+ const resolvedPackageVersion = "0.5.450";
25966
25950
  const PACKAGE_VERSION = resolvedPackageVersion;
25967
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.448";
25951
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.450";
25968
25952
  const roundParityValue = (value) => {
25969
25953
  if (typeof value !== "number") return value;
25970
25954
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26778,7 +26762,7 @@ class PixldocsRenderer {
26778
26762
  await this.waitForCanvasScene(container, cloned, i);
26779
26763
  }
26780
26764
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26781
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-B9AA07qB.cjs"));
26765
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-CF7KqDSy.cjs"));
26782
26766
  const prepared = preparePagesForExport(
26783
26767
  cloned.pages,
26784
26768
  canvasWidth,
@@ -29098,7 +29082,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29098
29082
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29099
29083
  sanitizeSvgTreeForPdf(svgToDraw);
29100
29084
  try {
29101
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-B9AA07qB.cjs"));
29085
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-CF7KqDSy.cjs"));
29102
29086
  try {
29103
29087
  await logTextMeasurementDiagnostic(svgToDraw);
29104
29088
  } catch {
@@ -29495,4 +29479,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
29495
29479
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
29496
29480
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
29497
29481
  exports.warmTemplateFromForm = warmTemplateFromForm;
29498
- //# sourceMappingURL=index-CzxefTLk.cjs.map
29482
+ //# sourceMappingURL=index-DM88x3tM.cjs.map