@pixldocs/canvas-renderer 0.5.358 → 0.5.360

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.
@@ -11105,6 +11105,136 @@ const logGroupTextResizeDebug = (phase, payload) => {
11105
11105
  console.log(GROUP_TEXT_RESIZE_DEBUG_PREFIX, phase, payload);
11106
11106
  }
11107
11107
  };
11108
+ const ROT_GROUP_IMAGE_DRIFT_DEBUG_PREFIX = "[Pixldocs][rot-group-image-drift]";
11109
+ const ROT_GROUP_IMAGE_DRIFT_DEBUG_MAX_ENTRIES = 500;
11110
+ const roundRotDriftNumber = (value) => {
11111
+ if (typeof value !== "number") return value;
11112
+ return Number.isFinite(value) ? Math.round(value * 1e3) / 1e3 : String(value);
11113
+ };
11114
+ const normalizeRotDriftPayload = (value) => {
11115
+ const seen = /* @__PURE__ */ new WeakSet();
11116
+ const normalize = (entry) => {
11117
+ if (entry == null) return entry;
11118
+ const valueType = typeof entry;
11119
+ if (valueType === "number") return roundRotDriftNumber(entry);
11120
+ if (valueType === "string" || valueType === "boolean") return entry;
11121
+ if (Array.isArray(entry)) return entry.map((item) => normalize(item));
11122
+ if (valueType === "object") {
11123
+ if (seen.has(entry)) return "[Circular]";
11124
+ seen.add(entry);
11125
+ if (entry instanceof fabric__namespace.FabricObject) return normalize(summarizeRotDriftObject(entry));
11126
+ const output = {};
11127
+ Object.entries(entry).forEach(([key, item]) => {
11128
+ output[key] = normalize(item);
11129
+ });
11130
+ return output;
11131
+ }
11132
+ return String(entry);
11133
+ };
11134
+ return normalize(value);
11135
+ };
11136
+ const matrixForRotDriftLog = (matrix) => {
11137
+ if (!matrix) return void 0;
11138
+ return matrix.map((entry) => roundRotDriftNumber(entry));
11139
+ };
11140
+ const summarizeRotDriftObject = (obj, worldMatrix) => {
11141
+ var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
11142
+ if (!obj) return null;
11143
+ const anyObj = obj;
11144
+ try {
11145
+ const ownMatrix = (_a2 = obj.calcOwnMatrix) == null ? void 0 : _a2.call(obj);
11146
+ const calcWorld = worldMatrix ?? ((_b2 = obj.calcTransformMatrix) == null ? void 0 : _b2.call(obj));
11147
+ const decomposed = calcWorld ? fabric__namespace.util.qrDecompose(calcWorld) : null;
11148
+ const center = (_c = obj.getCenterPoint) == null ? void 0 : _c.call(obj);
11149
+ const rect = (_d = obj.getBoundingRect) == null ? void 0 : _d.call(obj);
11150
+ return {
11151
+ id: getObjectId(obj),
11152
+ type: anyObj.type ?? ((_e = obj.constructor) == null ? void 0 : _e.name),
11153
+ isAS: obj instanceof fabric__namespace.ActiveSelection,
11154
+ isGroup: obj instanceof fabric__namespace.Group,
11155
+ isImage: obj instanceof fabric__namespace.FabricImage,
11156
+ isCropGroup: Boolean(anyObj.__cropGroup || ((_f = anyObj._ct) == null ? void 0 : _f.isCropGroup)),
11157
+ hasLayoutManager: Boolean(anyObj.layoutManager),
11158
+ left: obj.left,
11159
+ top: obj.top,
11160
+ angle: obj.angle,
11161
+ scaleX: obj.scaleX,
11162
+ scaleY: obj.scaleY,
11163
+ width: obj.width,
11164
+ height: obj.height,
11165
+ originX: obj.originX,
11166
+ originY: obj.originY,
11167
+ centerX: center == null ? void 0 : center.x,
11168
+ centerY: center == null ? void 0 : center.y,
11169
+ brLeft: rect == null ? void 0 : rect.left,
11170
+ brTop: rect == null ? void 0 : rect.top,
11171
+ brWidth: rect == null ? void 0 : rect.width,
11172
+ brHeight: rect == null ? void 0 : rect.height,
11173
+ worldTx: decomposed == null ? void 0 : decomposed.translateX,
11174
+ worldTy: decomposed == null ? void 0 : decomposed.translateY,
11175
+ worldAngle: decomposed == null ? void 0 : decomposed.angle,
11176
+ worldScaleX: decomposed == null ? void 0 : decomposed.scaleX,
11177
+ worldScaleY: decomposed == null ? void 0 : decomposed.scaleY,
11178
+ ownMatrix: matrixForRotDriftLog(ownMatrix ?? null),
11179
+ worldMatrix: matrixForRotDriftLog(calcWorld ?? null),
11180
+ cropFrameW: (_g = anyObj.__cropData) == null ? void 0 : _g.frameW,
11181
+ cropFrameH: (_h = anyObj.__cropData) == null ? void 0 : _h.frameH,
11182
+ cropPanX: (_k = (_j = (_i = anyObj.__cropData) == null ? void 0 : _i._img) == null ? void 0 : _j._ct) == null ? void 0 : _k.panX,
11183
+ cropPanY: (_n = (_m = (_l = anyObj.__cropData) == null ? void 0 : _l._img) == null ? void 0 : _m._ct) == null ? void 0 : _n.panY,
11184
+ cropZoom: (_q = (_p = (_o = anyObj.__cropData) == null ? void 0 : _o._img) == null ? void 0 : _p._ct) == null ? void 0 : _q.zoom
11185
+ };
11186
+ } catch (error) {
11187
+ return { id: getObjectId(obj), type: anyObj.type, error: String(error) };
11188
+ }
11189
+ };
11190
+ const logRotGroupImageDrift = (phase, payload) => {
11191
+ if (typeof console === "undefined") return;
11192
+ try {
11193
+ const line = `${ROT_GROUP_IMAGE_DRIFT_DEBUG_PREFIX} ${phase} ${JSON.stringify(normalizeRotDriftPayload(payload))}`;
11194
+ if (typeof window !== "undefined") {
11195
+ const debugWindow = window;
11196
+ debugWindow.__pixldocsRotGroupImageDriftLogs = Array.isArray(debugWindow.__pixldocsRotGroupImageDriftLogs) ? debugWindow.__pixldocsRotGroupImageDriftLogs.slice(-ROT_GROUP_IMAGE_DRIFT_DEBUG_MAX_ENTRIES + 1) : [];
11197
+ debugWindow.__pixldocsRotGroupImageDriftLogs.push(line);
11198
+ }
11199
+ console.log(line);
11200
+ } catch {
11201
+ console.log(ROT_GROUP_IMAGE_DRIFT_DEBUG_PREFIX, phase, payload);
11202
+ }
11203
+ };
11204
+ const shouldLogRotDriftLiveTick = (target, phase) => {
11205
+ if (!target) return false;
11206
+ const anyTarget = target;
11207
+ const key = `__pixldocsRotDrift_${phase}_count`;
11208
+ const count = (anyTarget[key] ?? 0) + 1;
11209
+ anyTarget[key] = count;
11210
+ return count <= 3 || count % 8 === 0;
11211
+ };
11212
+ const logRotDriftSelectionSnapshot = (phase, target, extra = {}) => {
11213
+ if (!target) return;
11214
+ const anyTarget = target;
11215
+ const kids = typeof anyTarget.getObjects === "function" ? anyTarget.getObjects() : [];
11216
+ const selectionMatrix = target instanceof fabric__namespace.ActiveSelection ? target.calcTransformMatrix() : null;
11217
+ logRotGroupImageDrift(phase, {
11218
+ ...extra,
11219
+ target: summarizeRotDriftObject(target),
11220
+ childCount: kids.length,
11221
+ groupSelectionId: anyTarget.__pixldocsGroupSelection,
11222
+ alignedAngle: anyTarget.__pixldocsAlignedAngle
11223
+ });
11224
+ kids.forEach((kid, childIndex) => {
11225
+ var _a2, _b2;
11226
+ const childWorldMatrix = selectionMatrix ? fabric__namespace.util.multiplyTransformMatrices(
11227
+ selectionMatrix,
11228
+ kid.calcOwnMatrix()
11229
+ ) : (_a2 = kid.calcTransformMatrix) == null ? void 0 : _a2.call(kid);
11230
+ logRotGroupImageDrift(`${phase}-child`, {
11231
+ ...extra,
11232
+ childIndex,
11233
+ parentType: anyTarget.type ?? ((_b2 = target.constructor) == null ? void 0 : _b2.name),
11234
+ child: summarizeRotDriftObject(kid, childWorldMatrix ?? null)
11235
+ });
11236
+ });
11237
+ };
11108
11238
  const bakeTextboxScaleIntoTypography = (obj, sourceElement) => {
11109
11239
  const sx = Math.abs(obj.scaleX ?? 1) || 1;
11110
11240
  const sy = Math.abs(obj.scaleY ?? 1) || 1;
@@ -11214,6 +11344,7 @@ function applyWarpAwareSelectionBorders(selection) {
11214
11344
  selection.calcTransformMatrix()
11215
11345
  );
11216
11346
  kids.forEach((k, index) => {
11347
+ const beforeRestore = summarizeRotDriftObject(k);
11217
11348
  const localMatrix = fabric__namespace.util.multiplyTransformMatrices(
11218
11349
  invSelection,
11219
11350
  worldMatrices[index]
@@ -11232,8 +11363,19 @@ function applyWarpAwareSelectionBorders(selection) {
11232
11363
  }
11233
11364
  k.setCoords();
11234
11365
  k.dirty = true;
11366
+ logRotGroupImageDrift("aligned-restore-child", {
11367
+ targetAngle,
11368
+ childIndex: index,
11369
+ before: beforeRestore,
11370
+ expectedLocal: fabric__namespace.util.qrDecompose(localMatrix),
11371
+ after: summarizeRotDriftObject(k)
11372
+ });
11235
11373
  });
11236
11374
  };
11375
+ logRotDriftSelectionSnapshot("aligned-before", selection, {
11376
+ targetAngle,
11377
+ worldAngles
11378
+ });
11237
11379
  selection.set({ angle: targetAngle, scaleX: 1, scaleY: 1, skewX: 0, skewY: 0 });
11238
11380
  restoreKidsFromWorld();
11239
11381
  try {
@@ -11244,37 +11386,10 @@ function applyWarpAwareSelectionBorders(selection) {
11244
11386
  selection.setCoords();
11245
11387
  selection.dirty = true;
11246
11388
  selection.__pixldocsAlignedAngle = targetAngle;
11247
- try {
11248
- const payload = {
11249
- targetAngle,
11250
- selection: {
11251
- left: selection.left,
11252
- top: selection.top,
11253
- angle: selection.angle,
11254
- scaleX: selection.scaleX,
11255
- scaleY: selection.scaleY,
11256
- width: selection.width,
11257
- height: selection.height,
11258
- originX: selection.originX,
11259
- originY: selection.originY
11260
- },
11261
- kids: kids.map((c) => ({
11262
- id: c.id ?? c.__pixldocsId,
11263
- type: c.type,
11264
- left: c.left,
11265
- top: c.top,
11266
- angle: c.angle,
11267
- scaleX: c.scaleX,
11268
- scaleY: c.scaleY,
11269
- originX: c.originX,
11270
- originY: c.originY,
11271
- width: c.width,
11272
- height: c.height
11273
- }))
11274
- };
11275
- console.info("[Pixldocs][rot-group-image-drift] aligned-on-select " + JSON.stringify(payload));
11276
- } catch {
11277
- }
11389
+ logRotDriftSelectionSnapshot("aligned-after", selection, {
11390
+ targetAngle,
11391
+ worldAngles
11392
+ });
11278
11393
  }
11279
11394
  }
11280
11395
  }
@@ -12322,6 +12437,10 @@ const PageCanvas = react.forwardRef(
12322
12437
  selectionLeft: rect.left,
12323
12438
  selectionTop: rect.top
12324
12439
  };
12440
+ logRotDriftSelectionSnapshot("mouse-down-active-selection", active, {
12441
+ time: Math.round(performance.now()),
12442
+ selectedStoreIds: useEditorStore.getState().canvas.selectedIds
12443
+ });
12325
12444
  }
12326
12445
  if (fabricCanvas._currentTransform) {
12327
12446
  fabricCanvas.__isUserTransforming = true;
@@ -12934,6 +13053,14 @@ const PageCanvas = react.forwardRef(
12934
13053
  groupTop: groupAbs.top,
12935
13054
  selectionAngle: ((active.angle ?? 0) % 360 + 360) % 360
12936
13055
  };
13056
+ logRotDriftSelectionSnapshot("transform-start", active, {
13057
+ time: Math.round(performance.now()),
13058
+ groupId,
13059
+ groupAbs,
13060
+ selectionRect: rect,
13061
+ transformStart: groupSelectionTransformStartRef.current,
13062
+ selectedStoreIds: useEditorStore.getState().canvas.selectedIds
13063
+ });
12937
13064
  };
12938
13065
  const restoreGroupSelectionVisualState = (selection, groupId) => {
12939
13066
  applyLogicalGroupSelectionVisualState(selection, groupId);
@@ -13720,13 +13847,22 @@ const PageCanvas = react.forwardRef(
13720
13847
  fabricCanvas.on("selection:cleared", () => {
13721
13848
  });
13722
13849
  fabricCanvas.on("object:scaling", (e) => {
13723
- var _a2, _b2, _c, _d, _e, _f;
13850
+ var _a2, _b2, _c, _d, _e, _f, _g, _h;
13724
13851
  if (!isActiveRef.current) return;
13725
13852
  const t = e.target;
13726
13853
  if (t) lastResizeScaleTargetRef.current = t;
13727
13854
  prepareGroupSelectionTransformStart(t);
13728
13855
  markTransforming(t);
13729
13856
  didTransformRef.current = true;
13857
+ if (shouldLogRotDriftLiveTick(t, "scaling")) {
13858
+ logRotDriftSelectionSnapshot("scaling", t, {
13859
+ time: Math.round(performance.now()),
13860
+ corner: t == null ? void 0 : t.__corner,
13861
+ transformAction: (_a2 = fabricCanvas._currentTransform) == null ? void 0 : _a2.action,
13862
+ transformCorner: (_b2 = fabricCanvas._currentTransform) == null ? void 0 : _b2.corner,
13863
+ transformStart: groupSelectionTransformStartRef.current
13864
+ });
13865
+ }
13730
13866
  const transformTargetId = t ? getObjectId(t) : null;
13731
13867
  if (transformTargetId && transformTargetId !== "__background__") {
13732
13868
  preserveSelectionAfterTransformIdRef.current = transformTargetId;
@@ -13887,7 +14023,7 @@ const PageCanvas = react.forwardRef(
13887
14023
  time: Math.round(performance.now()),
13888
14024
  corner,
13889
14025
  groupSelectionId: obj.__pixldocsGroupSelection,
13890
- currentTransformAction: (_a2 = fabricCanvas._currentTransform) == null ? void 0 : _a2.action,
14026
+ currentTransformAction: (_c = fabricCanvas._currentTransform) == null ? void 0 : _c.action,
13891
14027
  selection: summarizeFabricObjectForResizeDebug(obj),
13892
14028
  textChildren: obj.getObjects().filter((child) => child instanceof fabric__namespace.Textbox).map((child) => summarizeFabricObjectForResizeDebug(child))
13893
14029
  };
@@ -13897,13 +14033,13 @@ const PageCanvas = react.forwardRef(
13897
14033
  const isXSide = corner === "ml" || corner === "mr";
13898
14034
  const sAxis = isXSide ? Math.abs(obj.scaleX ?? 1) : Math.abs(obj.scaleY ?? 1);
13899
14035
  if (sAxis > 1e-3) {
13900
- if (isXSide && ((_b2 = groupShiftReflowSnapshotRef.current) == null ? void 0 : _b2.selection) !== obj) {
14036
+ if (isXSide && ((_d = groupShiftReflowSnapshotRef.current) == null ? void 0 : _d.selection) !== obj) {
13901
14037
  groupShiftReflowSnapshotRef.current = null;
13902
14038
  const logicalGroupId = obj.__pixldocsGroupSelection;
13903
14039
  if (logicalGroupId) {
13904
14040
  try {
13905
14041
  const state = useEditorStore.getState();
13906
- const pageChildren2 = ((_c = state.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _c.children) ?? [];
14042
+ const pageChildren2 = ((_e = state.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _e.children) ?? [];
13907
14043
  const groupNode = findNodeById(pageChildren2, logicalGroupId);
13908
14044
  if (groupNode && isGroup(groupNode) && !isStackLayoutMode(groupNode.layoutMode)) {
13909
14045
  const entries = obj.getObjects().map((c) => ({
@@ -13933,7 +14069,7 @@ const PageCanvas = react.forwardRef(
13933
14069
  const asRect0 = obj.getBoundingRect();
13934
14070
  let didReflowTextChild = false;
13935
14071
  for (const child of obj.getObjects()) {
13936
- if (child instanceof fabric__namespace.Group && (child.__cropGroup || ((_d = child._ct) == null ? void 0 : _d.isCropGroup))) {
14072
+ if (child instanceof fabric__namespace.Group && (child.__cropGroup || ((_f = child._ct) == null ? void 0 : _f.isCropGroup))) {
13937
14073
  const ct = child.__cropData;
13938
14074
  if (!ct) continue;
13939
14075
  if (isXSide) {
@@ -14038,7 +14174,7 @@ const PageCanvas = react.forwardRef(
14038
14174
  didReflowTextChild = true;
14039
14175
  }
14040
14176
  }
14041
- if (isXSide && ((_e = groupShiftReflowSnapshotRef.current) == null ? void 0 : _e.selection) === obj) {
14177
+ if (isXSide && ((_g = groupShiftReflowSnapshotRef.current) == null ? void 0 : _g.selection) === obj) {
14042
14178
  const snap = groupShiftReflowSnapshotRef.current;
14043
14179
  const anchorEntry = snap.children[0];
14044
14180
  const anchorTopLive = anchorEntry.obj.top ?? 0;
@@ -14194,7 +14330,7 @@ const PageCanvas = react.forwardRef(
14194
14330
  setGuides(gridGuidesForScale.length ? [...scaleGuides, ...gridGuidesForScale] : scaleGuides);
14195
14331
  if (drilledGroupIdRef.current) {
14196
14332
  try {
14197
- (_f = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _f.call(fabricCanvas);
14333
+ (_h = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _h.call(fabricCanvas);
14198
14334
  } catch {
14199
14335
  }
14200
14336
  }
@@ -14285,42 +14421,17 @@ const PageCanvas = react.forwardRef(
14285
14421
  }
14286
14422
  });
14287
14423
  fabricCanvas.on("object:rotating", (e) => {
14424
+ var _a2, _b2;
14288
14425
  markSimpleTransform(e);
14289
14426
  didTransformRef.current = true;
14290
14427
  const tr = e.target;
14291
- try {
14292
- const t = tr;
14293
- if (t) {
14294
- const payload = {
14295
- targetType: t.type,
14296
- isAS: t instanceof fabric__namespace.ActiveSelection,
14297
- left: t.left,
14298
- top: t.top,
14299
- angle: t.angle,
14300
- scaleX: t.scaleX,
14301
- scaleY: t.scaleY,
14302
- width: t.width,
14303
- height: t.height,
14304
- originX: t.originX,
14305
- originY: t.originY,
14306
- childCount: (t._objects ?? []).length,
14307
- children: (t._objects ?? []).map((c) => ({
14308
- id: getObjectId(c),
14309
- type: c.type,
14310
- left: c.left,
14311
- top: c.top,
14312
- angle: c.angle,
14313
- scaleX: c.scaleX,
14314
- scaleY: c.scaleY,
14315
- originX: c.originX,
14316
- originY: c.originY,
14317
- width: c.width,
14318
- height: c.height
14319
- }))
14320
- };
14321
- console.info("[Pixldocs][rot-group-image-drift] rotating " + JSON.stringify(payload));
14322
- }
14323
- } catch {
14428
+ if (shouldLogRotDriftLiveTick(tr, "rotating")) {
14429
+ logRotDriftSelectionSnapshot("rotating", tr, {
14430
+ time: Math.round(performance.now()),
14431
+ transformAction: (_a2 = fabricCanvas._currentTransform) == null ? void 0 : _a2.action,
14432
+ transformCorner: (_b2 = fabricCanvas._currentTransform) == null ? void 0 : _b2.corner,
14433
+ transformStart: groupSelectionTransformStartRef.current
14434
+ });
14324
14435
  }
14325
14436
  try {
14326
14437
  const getCursor = fabricCanvas.__pixldocsGetRotateCursor;
@@ -14350,43 +14461,18 @@ const PageCanvas = react.forwardRef(
14350
14461
  didTransformRef.current = true;
14351
14462
  });
14352
14463
  fabricCanvas.on("object:moving", (e) => {
14464
+ var _a2, _b2;
14353
14465
  if (!isActiveRef.current) return;
14354
14466
  prepareGroupSelectionTransformStart(e.target);
14355
14467
  markTransforming(e.target);
14356
14468
  didTransformRef.current = true;
14357
- try {
14358
- const t = e.target;
14359
- if (t && (t.angle ?? 0) !== 0) {
14360
- const payload = {
14361
- targetType: t.type,
14362
- isAS: t instanceof fabric__namespace.ActiveSelection,
14363
- left: t.left,
14364
- top: t.top,
14365
- angle: t.angle,
14366
- scaleX: t.scaleX,
14367
- scaleY: t.scaleY,
14368
- width: t.width,
14369
- height: t.height,
14370
- originX: t.originX,
14371
- originY: t.originY,
14372
- childCount: (t._objects ?? []).length,
14373
- children: (t._objects ?? []).map((c) => ({
14374
- id: getObjectId(c),
14375
- type: c.type,
14376
- left: c.left,
14377
- top: c.top,
14378
- angle: c.angle,
14379
- scaleX: c.scaleX,
14380
- scaleY: c.scaleY,
14381
- originX: c.originX,
14382
- originY: c.originY,
14383
- width: c.width,
14384
- height: c.height
14385
- }))
14386
- };
14387
- console.info("[Pixldocs][rot-group-image-drift] moving " + JSON.stringify(payload));
14388
- }
14389
- } catch {
14469
+ if (shouldLogRotDriftLiveTick(e.target, "moving")) {
14470
+ logRotDriftSelectionSnapshot("moving", e.target, {
14471
+ time: Math.round(performance.now()),
14472
+ transformAction: (_a2 = fabricCanvas._currentTransform) == null ? void 0 : _a2.action,
14473
+ transformCorner: (_b2 = fabricCanvas._currentTransform) == null ? void 0 : _b2.corner,
14474
+ transformStart: groupSelectionTransformStartRef.current
14475
+ });
14390
14476
  }
14391
14477
  const activeDuringMove = fabricCanvas.getActiveObject();
14392
14478
  const movingLogicalGroupId = activeDuringMove instanceof fabric__namespace.ActiveSelection ? activeDuringMove.__pixldocsGroupSelection : void 0;
@@ -14724,6 +14810,15 @@ const PageCanvas = react.forwardRef(
14724
14810
  activeObjects = activeObjects[0].getObjects();
14725
14811
  }
14726
14812
  const isActiveSelection = activeObj instanceof fabric__namespace.ActiveSelection || activeObjects.length > 1;
14813
+ if (activeObj instanceof fabric__namespace.ActiveSelection) {
14814
+ logRotDriftSelectionSnapshot("modified-start-active-selection", activeObj, {
14815
+ time: Math.round(performance.now()),
14816
+ modifiedTarget: summarizeRotDriftObject(modifiedTarget),
14817
+ activeObjectIds: activeObjects.map((candidate) => getObjectId(candidate)),
14818
+ selectedStoreIds: useEditorStore.getState().canvas.selectedIds,
14819
+ transformStart: groupSelectionTransformStartRef.current
14820
+ });
14821
+ }
14727
14822
  const activeSelectionResizeHandle = isActiveSelection ? activeSelectionResizeHandleRef.current : null;
14728
14823
  const debugGroupTextCornerResize = activeObj instanceof fabric__namespace.ActiveSelection && isCornerResizeHandle(activeSelectionResizeHandle) && activeObjects.some((candidate) => candidate instanceof fabric__namespace.Textbox);
14729
14824
  if (debugGroupTextCornerResize) {
@@ -15373,6 +15468,32 @@ const PageCanvas = react.forwardRef(
15373
15468
  objectBeforeStoreWrite: summarizeFabricObjectForResizeDebug(obj)
15374
15469
  });
15375
15470
  }
15471
+ if (isActiveSelection) {
15472
+ logRotGroupImageDrift("store-update-child", {
15473
+ time: Math.round(performance.now()),
15474
+ objId,
15475
+ sourceElement: sourceElement ? {
15476
+ id: sourceElement.id,
15477
+ type: sourceElement.type,
15478
+ left: sourceElement.left,
15479
+ top: sourceElement.top,
15480
+ width: sourceElement.width,
15481
+ height: sourceElement.height,
15482
+ angle: sourceElement.angle,
15483
+ scaleX: sourceElement.scaleX,
15484
+ scaleY: sourceElement.scaleY
15485
+ } : null,
15486
+ objectBeforeStoreWrite: summarizeRotDriftObject(obj, finalAbsoluteMatrix),
15487
+ activeSelection: summarizeRotDriftObject(activeObj),
15488
+ absoluteMatrix,
15489
+ finalAbsoluteMatrix,
15490
+ decomposed,
15491
+ absoluteLeft,
15492
+ absoluteTop,
15493
+ storePos,
15494
+ elementUpdate
15495
+ });
15496
+ }
15376
15497
  updateElement(objId, elementUpdate, { recordHistory: false, skipLayoutRecalc: true });
15377
15498
  obj.setCoords();
15378
15499
  }
@@ -15403,6 +15524,19 @@ const PageCanvas = react.forwardRef(
15403
15524
  renderOnAddRemove: fabricCanvas.renderOnAddRemove
15404
15525
  });
15405
15526
  }
15527
+ logRotDriftSelectionSnapshot("before-reselect", activeObj, {
15528
+ time: Math.round(performance.now()),
15529
+ wasGroupSel,
15530
+ memberIds: membersToReselect.map((member) => getObjectId(member)),
15531
+ pendingCropBakes: pendingCropGroupFrameBakes.map((bake) => ({
15532
+ id: getObjectId(bake.obj),
15533
+ width: bake.width,
15534
+ height: bake.height,
15535
+ left: bake.left,
15536
+ top: bake.top,
15537
+ angle: bake.angle
15538
+ }))
15539
+ });
15406
15540
  const prevRenderOnAddRemove = fabricCanvas.renderOnAddRemove;
15407
15541
  fabricCanvas.renderOnAddRemove = false;
15408
15542
  skipSelectionClearOnDiscardRef.current = true;
@@ -15436,6 +15570,11 @@ const PageCanvas = react.forwardRef(
15436
15570
  if (wasGroupSel) restoreGroupSelectionVisualState(newSel, wasGroupSel);
15437
15571
  fabricCanvas.setActiveObject(newSel);
15438
15572
  newSel.setCoords();
15573
+ logRotDriftSelectionSnapshot("after-reselect", newSel, {
15574
+ time: Math.round(performance.now()),
15575
+ wasGroupSel,
15576
+ memberIds: membersToReselect.map((member) => getObjectId(member))
15577
+ });
15439
15578
  if (debugGroupTextCornerResize) {
15440
15579
  logGroupTextResizeDebug("after-reselect", {
15441
15580
  time: Math.round(performance.now()),
@@ -16813,7 +16952,7 @@ const PageCanvas = react.forwardRef(
16813
16952
  const isFlatGroupSelection = toSelect.length > 1 && toSelect.every((o) => !(o instanceof fabric__namespace.Group));
16814
16953
  const active = fc.getActiveObject();
16815
16954
  const sameSelection = active instanceof fabric__namespace.ActiveSelection && active.getObjects().length === toSelect.length && toSelect.every((obj) => active.getObjects().includes(obj));
16816
- if (sameSelection && isFlatGroupSelection) {
16955
+ if (sameSelection && (isFlatGroupSelection || isPureSingleGroupSelection)) {
16817
16956
  if (selectedGroupSelectionId && active instanceof fabric__namespace.ActiveSelection) {
16818
16957
  if (isPureSingleGroupSelection) {
16819
16958
  active.__pixldocsGroupSelection = selectedGroupSelectionId;
@@ -16845,8 +16984,10 @@ const PageCanvas = react.forwardRef(
16845
16984
  });
16846
16985
  if (isPureSingleGroupSelection) {
16847
16986
  active.hasBorders = true;
16848
- active.setCoords();
16849
- applyWarpAwareSelectionBorders(active);
16987
+ if (active.__pixldocsAlignedAngle == null) {
16988
+ active.setCoords();
16989
+ applyWarpAwareSelectionBorders(active);
16990
+ }
16850
16991
  }
16851
16992
  }
16852
16993
  fc.requestRenderAll();
@@ -24492,9 +24633,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24492
24633
  }
24493
24634
  return svgString;
24494
24635
  }
24495
- const resolvedPackageVersion = "0.5.358";
24636
+ const resolvedPackageVersion = "0.5.360";
24496
24637
  const PACKAGE_VERSION = resolvedPackageVersion;
24497
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.358";
24638
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.360";
24498
24639
  const roundParityValue = (value) => {
24499
24640
  if (typeof value !== "number") return value;
24500
24641
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25308,7 +25449,7 @@ class PixldocsRenderer {
25308
25449
  await this.waitForCanvasScene(container, cloned, i);
25309
25450
  }
25310
25451
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25311
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BjU5UnhU.cjs"));
25452
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BGYJ-v0u.cjs"));
25312
25453
  const prepared = preparePagesForExport(
25313
25454
  cloned.pages,
25314
25455
  canvasWidth,
@@ -27628,7 +27769,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27628
27769
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27629
27770
  sanitizeSvgTreeForPdf(svgToDraw);
27630
27771
  try {
27631
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BjU5UnhU.cjs"));
27772
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BGYJ-v0u.cjs"));
27632
27773
  try {
27633
27774
  await logTextMeasurementDiagnostic(svgToDraw);
27634
27775
  } catch {
@@ -28025,4 +28166,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
28025
28166
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
28026
28167
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
28027
28168
  exports.warmTemplateFromForm = warmTemplateFromForm;
28028
- //# sourceMappingURL=index-BMPgVllP.cjs.map
28169
+ //# sourceMappingURL=index-BTxKjVRe.cjs.map