@pixldocs/canvas-renderer 0.5.409 → 0.5.411
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.
- package/dist/{index-DaL8UMXJ.cjs → index-BzO7hSG5.cjs} +262 -93
- package/dist/index-BzO7hSG5.cjs.map +1 -0
- package/dist/{index-DAOxGNQt.js → index-DIx3vAjy.js} +262 -93
- package/dist/index-DIx3vAjy.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-CI2YBgI3.cjs → vectorPdfExport-DUaCeIGH.cjs} +4 -4
- package/dist/{vectorPdfExport-CI2YBgI3.cjs.map → vectorPdfExport-DUaCeIGH.cjs.map} +1 -1
- package/dist/{vectorPdfExport-BZbppXw8.js → vectorPdfExport-DgFZfNsT.js} +4 -4
- package/dist/{vectorPdfExport-BZbppXw8.js.map → vectorPdfExport-DgFZfNsT.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-DAOxGNQt.js.map +0 -1
- package/dist/index-DaL8UMXJ.cjs.map +0 -1
|
@@ -4704,6 +4704,117 @@ const svgMaskApply = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.define
|
|
|
4704
4704
|
syncSvgMaskClipPath
|
|
4705
4705
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4706
4706
|
const SELECTION_BORDER_SCALE$1 = 2;
|
|
4707
|
+
const ROTATED_GROUP_IMAGE_RESIZE_DEBUG_PREFIX$1 = "[Pixldocs][rotated-group-image-resize]";
|
|
4708
|
+
const ROTATED_GROUP_IMAGE_RESIZE_DEBUG_MAX_ENTRIES$1 = 400;
|
|
4709
|
+
function isInsideRotatedActiveSelection(obj) {
|
|
4710
|
+
var _a2;
|
|
4711
|
+
const debugObj = obj;
|
|
4712
|
+
const ownAngle = Math.abs(((obj.angle ?? 0) % 360 + 360) % 360);
|
|
4713
|
+
if ((debugObj.__cropData || debugObj.__cropGroup || ((_a2 = debugObj._ct) == null ? void 0 : _a2.isCropGroup)) && Math.min(ownAngle, 360 - ownAngle) > 0.5) return true;
|
|
4714
|
+
const logicalParentAngle = Math.abs(((debugObj.__pixldocsParentGroupAngle ?? 0) % 360 + 360) % 360);
|
|
4715
|
+
if (debugObj.__pixldocsParentGroupId && Math.min(logicalParentAngle, 360 - logicalParentAngle) > 0.5) return true;
|
|
4716
|
+
const parent = debugObj.group;
|
|
4717
|
+
if (!parent) return false;
|
|
4718
|
+
const pType = parent.type;
|
|
4719
|
+
if (pType !== "activeSelection" && pType !== "group") return false;
|
|
4720
|
+
const angle = Math.abs(((parent.angle ?? 0) % 360 + 360) % 360);
|
|
4721
|
+
return Math.min(angle, 360 - angle) > 0.5;
|
|
4722
|
+
}
|
|
4723
|
+
function summarizeResizeObject(obj) {
|
|
4724
|
+
var _a2, _b2, _c2, _d;
|
|
4725
|
+
if (!obj) return null;
|
|
4726
|
+
try {
|
|
4727
|
+
const matrix = (_a2 = obj.calcTransformMatrix) == null ? void 0 : _a2.call(obj);
|
|
4728
|
+
const decomp = matrix ? fabric.util.qrDecompose(matrix) : null;
|
|
4729
|
+
const rect = (_b2 = obj.getBoundingRect) == null ? void 0 : _b2.call(obj);
|
|
4730
|
+
const center = (_c2 = obj.getCenterPoint) == null ? void 0 : _c2.call(obj);
|
|
4731
|
+
return {
|
|
4732
|
+
type: obj.type ?? ((_d = obj.constructor) == null ? void 0 : _d.name),
|
|
4733
|
+
left: obj.left,
|
|
4734
|
+
top: obj.top,
|
|
4735
|
+
width: obj.width,
|
|
4736
|
+
height: obj.height,
|
|
4737
|
+
scaleX: obj.scaleX,
|
|
4738
|
+
scaleY: obj.scaleY,
|
|
4739
|
+
angle: obj.angle,
|
|
4740
|
+
originX: obj.originX,
|
|
4741
|
+
originY: obj.originY,
|
|
4742
|
+
centerX: center == null ? void 0 : center.x,
|
|
4743
|
+
centerY: center == null ? void 0 : center.y,
|
|
4744
|
+
brLeft: rect == null ? void 0 : rect.left,
|
|
4745
|
+
brTop: rect == null ? void 0 : rect.top,
|
|
4746
|
+
brWidth: rect == null ? void 0 : rect.width,
|
|
4747
|
+
brHeight: rect == null ? void 0 : rect.height,
|
|
4748
|
+
worldX: decomp == null ? void 0 : decomp.translateX,
|
|
4749
|
+
worldY: decomp == null ? void 0 : decomp.translateY,
|
|
4750
|
+
worldAngle: decomp == null ? void 0 : decomp.angle,
|
|
4751
|
+
worldScaleX: decomp == null ? void 0 : decomp.scaleX,
|
|
4752
|
+
worldScaleY: decomp == null ? void 0 : decomp.scaleY
|
|
4753
|
+
};
|
|
4754
|
+
} catch (error) {
|
|
4755
|
+
return { type: obj == null ? void 0 : obj.type, error: String(error) };
|
|
4756
|
+
}
|
|
4757
|
+
}
|
|
4758
|
+
function logRotatedGroupImageResize(phase, target, payload = {}) {
|
|
4759
|
+
if (typeof console === "undefined" || !isInsideRotatedActiveSelection(target)) return;
|
|
4760
|
+
try {
|
|
4761
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
4762
|
+
const normalize = (value) => {
|
|
4763
|
+
if (value == null) return value;
|
|
4764
|
+
if (typeof value === "number") return Number.isFinite(value) ? Math.round(value * 1e3) / 1e3 : String(value);
|
|
4765
|
+
if (typeof value === "string" || typeof value === "boolean") return value;
|
|
4766
|
+
if (Array.isArray(value)) return value.map(normalize);
|
|
4767
|
+
if (typeof value === "object") {
|
|
4768
|
+
if (seen.has(value)) return "[Circular]";
|
|
4769
|
+
seen.add(value);
|
|
4770
|
+
if (value instanceof fabric.FabricObject) return normalize(summarizeResizeObject(value));
|
|
4771
|
+
const out = {};
|
|
4772
|
+
Object.entries(value).forEach(([key, entry]) => {
|
|
4773
|
+
out[key] = normalize(entry);
|
|
4774
|
+
});
|
|
4775
|
+
return out;
|
|
4776
|
+
}
|
|
4777
|
+
return String(value);
|
|
4778
|
+
};
|
|
4779
|
+
const debugTarget = target;
|
|
4780
|
+
const parent = debugTarget.group;
|
|
4781
|
+
const ct = debugTarget.__cropData;
|
|
4782
|
+
const start = debugTarget.__cornerResizeStart;
|
|
4783
|
+
const safeStart = start ? {
|
|
4784
|
+
corner: start.corner,
|
|
4785
|
+
angle: start.angle,
|
|
4786
|
+
baseW: start.baseW,
|
|
4787
|
+
baseH: start.baseH,
|
|
4788
|
+
anchorX: start.anchorX,
|
|
4789
|
+
anchorY: start.anchorY,
|
|
4790
|
+
signX: start.signX,
|
|
4791
|
+
signY: start.signY
|
|
4792
|
+
} : void 0;
|
|
4793
|
+
const line = `${ROTATED_GROUP_IMAGE_RESIZE_DEBUG_PREFIX$1} ${phase} ${JSON.stringify(normalize({
|
|
4794
|
+
...payload,
|
|
4795
|
+
target: summarizeResizeObject(target),
|
|
4796
|
+
parent: summarizeResizeObject(parent),
|
|
4797
|
+
logicalParent: debugTarget.__pixldocsParentGroupId ? {
|
|
4798
|
+
id: debugTarget.__pixldocsParentGroupId,
|
|
4799
|
+
type: debugTarget.__pixldocsParentGroupType,
|
|
4800
|
+
angle: debugTarget.__pixldocsParentGroupAngle
|
|
4801
|
+
} : void 0,
|
|
4802
|
+
frameW: ct == null ? void 0 : ct.frameW,
|
|
4803
|
+
frameH: ct == null ? void 0 : ct.frameH,
|
|
4804
|
+
img: summarizeResizeObject(ct == null ? void 0 : ct._img),
|
|
4805
|
+
snapshot: safeStart,
|
|
4806
|
+
lastPointer: debugTarget.__lastPointerForCrop
|
|
4807
|
+
}))}`;
|
|
4808
|
+
if (typeof window !== "undefined") {
|
|
4809
|
+
const debugWindow = window;
|
|
4810
|
+
debugWindow.__pixldocsRotatedGroupImageResizeLogs = Array.isArray(debugWindow.__pixldocsRotatedGroupImageResizeLogs) ? debugWindow.__pixldocsRotatedGroupImageResizeLogs.slice(-ROTATED_GROUP_IMAGE_RESIZE_DEBUG_MAX_ENTRIES$1 + 1) : [];
|
|
4811
|
+
debugWindow.__pixldocsRotatedGroupImageResizeLogs.push(line);
|
|
4812
|
+
}
|
|
4813
|
+
console.log(line);
|
|
4814
|
+
} catch {
|
|
4815
|
+
console.log(ROTATED_GROUP_IMAGE_RESIZE_DEBUG_PREFIX$1, phase, payload);
|
|
4816
|
+
}
|
|
4817
|
+
}
|
|
4707
4818
|
function clamp$1(v, min, max) {
|
|
4708
4819
|
return Math.max(min, Math.min(max, v));
|
|
4709
4820
|
}
|
|
@@ -4950,9 +5061,20 @@ function getLocalDeltaStable(target, eventData) {
|
|
|
4950
5061
|
const angle = fabric.util.degreesToRadians(getWorldAngleDeg(target));
|
|
4951
5062
|
const cos = Math.cos(-angle);
|
|
4952
5063
|
const sin = Math.sin(-angle);
|
|
5064
|
+
const localDx = dx * cos - dy * sin;
|
|
5065
|
+
const localDy = dx * sin + dy * cos;
|
|
5066
|
+
logRotatedGroupImageResize("side-delta", target, {
|
|
5067
|
+
pointer: p,
|
|
5068
|
+
previousPointer: last,
|
|
5069
|
+
canvasDx: dx,
|
|
5070
|
+
canvasDy: dy,
|
|
5071
|
+
worldAngle: getWorldAngleDeg(target),
|
|
5072
|
+
localDx,
|
|
5073
|
+
localDy
|
|
5074
|
+
});
|
|
4953
5075
|
return {
|
|
4954
|
-
localDx
|
|
4955
|
-
localDy
|
|
5076
|
+
localDx,
|
|
5077
|
+
localDy
|
|
4956
5078
|
};
|
|
4957
5079
|
}
|
|
4958
5080
|
function worldDeltaToLocal(dx, dy, angleDeg) {
|
|
@@ -5073,6 +5195,14 @@ function resizeFrameFromCornerUniform(eventData, transform, _x, _y) {
|
|
|
5073
5195
|
signY: defaultSigns.y
|
|
5074
5196
|
};
|
|
5075
5197
|
g.__cornerResizeStart = snap;
|
|
5198
|
+
logRotatedGroupImageResize("corner-start", g, {
|
|
5199
|
+
corner,
|
|
5200
|
+
pointer,
|
|
5201
|
+
center,
|
|
5202
|
+
anchorLocal,
|
|
5203
|
+
anchorWorld,
|
|
5204
|
+
snapshot: snap
|
|
5205
|
+
});
|
|
5076
5206
|
return snap;
|
|
5077
5207
|
})();
|
|
5078
5208
|
const localDelta = worldDeltaToLocal(pointer.x - snapshot.anchorX, pointer.y - snapshot.anchorY, snapshot.angle);
|
|
@@ -5085,6 +5215,19 @@ function resizeFrameFromCornerUniform(eventData, transform, _x, _y) {
|
|
|
5085
5215
|
const s = Math.min(scaleFromW, scaleFromH);
|
|
5086
5216
|
const newW = Math.max(MIN_SIZE, snapshot.baseW * s);
|
|
5087
5217
|
const newH = Math.max(MIN_SIZE, snapshot.baseH * s);
|
|
5218
|
+
logRotatedGroupImageResize("corner-tick-before-apply", g, {
|
|
5219
|
+
corner,
|
|
5220
|
+
pointer,
|
|
5221
|
+
angle,
|
|
5222
|
+
localDelta,
|
|
5223
|
+
rawW,
|
|
5224
|
+
rawH,
|
|
5225
|
+
scaleFromW,
|
|
5226
|
+
scaleFromH,
|
|
5227
|
+
uniformScale: s,
|
|
5228
|
+
newW,
|
|
5229
|
+
newH
|
|
5230
|
+
});
|
|
5088
5231
|
ct.frameW = newW;
|
|
5089
5232
|
ct.frameH = newH;
|
|
5090
5233
|
const centerLocal = {
|
|
@@ -5095,6 +5238,12 @@ function resizeFrameFromCornerUniform(eventData, transform, _x, _y) {
|
|
|
5095
5238
|
setCenterFromWorld(g, snapshot.anchorX + centerWorld.x, snapshot.anchorY + centerWorld.y);
|
|
5096
5239
|
g.set({ width: newW, height: newH });
|
|
5097
5240
|
updateCoverLayout(g);
|
|
5241
|
+
logRotatedGroupImageResize("corner-tick-after-layout", g, {
|
|
5242
|
+
corner,
|
|
5243
|
+
centerLocal,
|
|
5244
|
+
centerWorld,
|
|
5245
|
+
targetWorldCenter: { x: snapshot.anchorX + centerWorld.x, y: snapshot.anchorY + centerWorld.y }
|
|
5246
|
+
});
|
|
5098
5247
|
canvas.requestRenderAll();
|
|
5099
5248
|
return true;
|
|
5100
5249
|
}
|
|
@@ -5123,7 +5272,9 @@ function resizeFrameFromSide(g, side, localDx, localDy) {
|
|
|
5123
5272
|
ct.frameH = Math.max(minSize, ct.frameH - localDy);
|
|
5124
5273
|
moveCenterAlongLocalAxis(g, 0, localDy / 2);
|
|
5125
5274
|
}
|
|
5275
|
+
logRotatedGroupImageResize("side-before-layout", g, { side, localDx, localDy });
|
|
5126
5276
|
updateCoverLayout(g);
|
|
5277
|
+
logRotatedGroupImageResize("side-after-layout", g, { side, localDx, localDy });
|
|
5127
5278
|
}
|
|
5128
5279
|
function installCanvaMaskControls(g) {
|
|
5129
5280
|
const ct = g.__cropData;
|
|
@@ -5140,9 +5291,22 @@ function installCanvaMaskControls(g) {
|
|
|
5140
5291
|
};
|
|
5141
5292
|
g.set(controlStyle);
|
|
5142
5293
|
const notifyResizeSnap = (target, corner) => {
|
|
5143
|
-
if (target.group instanceof fabric.ActiveSelection)
|
|
5294
|
+
if (target.group instanceof fabric.ActiveSelection) {
|
|
5295
|
+
logRotatedGroupImageResize("snap-skipped-active-selection-child", target, { corner });
|
|
5296
|
+
return;
|
|
5297
|
+
}
|
|
5298
|
+
const ownAngle = Math.abs(((target.angle ?? 0) % 360 + 360) % 360);
|
|
5299
|
+
const parentAngle = Math.abs(((target.__pixldocsParentGroupAngle ?? 0) % 360 + 360) % 360);
|
|
5300
|
+
if (Math.min(ownAngle, 360 - ownAngle) > 0.5 || Math.min(parentAngle, 360 - parentAngle) > 0.5) {
|
|
5301
|
+
logRotatedGroupImageResize("snap-skipped-rotated-image", target, { corner, ownAngle, parentAngle });
|
|
5302
|
+
return;
|
|
5303
|
+
}
|
|
5144
5304
|
const handler = target.__resizeSnapHandler;
|
|
5145
|
-
if (typeof handler === "function")
|
|
5305
|
+
if (typeof handler === "function") {
|
|
5306
|
+
logRotatedGroupImageResize("snap-before", target, { corner });
|
|
5307
|
+
handler(target, corner);
|
|
5308
|
+
logRotatedGroupImageResize("snap-after", target, { corner });
|
|
5309
|
+
}
|
|
5146
5310
|
};
|
|
5147
5311
|
g.setControlsVisibility({
|
|
5148
5312
|
mt: true,
|
|
@@ -11205,8 +11369,6 @@ const scaleUpdateNumber = (updates, source, key, factor) => {
|
|
|
11205
11369
|
const value = Number(source == null ? void 0 : source[key]);
|
|
11206
11370
|
if (Number.isFinite(value)) updates[key] = value * factor;
|
|
11207
11371
|
};
|
|
11208
|
-
const GROUP_TEXT_RESIZE_DEBUG_PREFIX = "[Pixldocs][group-text-corner-resize]";
|
|
11209
|
-
const GROUP_TEXT_RESIZE_DEBUG_MAX_ENTRIES = 200;
|
|
11210
11372
|
const isCornerResizeHandle = (handle) => handle === "tl" || handle === "tr" || handle === "bl" || handle === "br";
|
|
11211
11373
|
const summarizeFabricObjectForResizeDebug = (obj) => {
|
|
11212
11374
|
var _a2;
|
|
@@ -11237,40 +11399,10 @@ const summarizeFabricObjectForResizeDebug = (obj) => {
|
|
|
11237
11399
|
}
|
|
11238
11400
|
};
|
|
11239
11401
|
const logGroupTextResizeDebug = (phase, payload) => {
|
|
11240
|
-
|
|
11241
|
-
try {
|
|
11242
|
-
const seen = /* @__PURE__ */ new WeakSet();
|
|
11243
|
-
const normalize = (value) => {
|
|
11244
|
-
if (value == null) return value;
|
|
11245
|
-
const valueType = typeof value;
|
|
11246
|
-
if (valueType === "number") return Number.isFinite(value) ? Math.round(value * 1e3) / 1e3 : String(value);
|
|
11247
|
-
if (valueType === "string" || valueType === "boolean") return value;
|
|
11248
|
-
if (valueType === "function") return `[Function ${value.name || "anonymous"}]`;
|
|
11249
|
-
if (Array.isArray(value)) return value.map((entry) => normalize(entry));
|
|
11250
|
-
if (valueType === "object") {
|
|
11251
|
-
if (seen.has(value)) return "[Circular]";
|
|
11252
|
-
seen.add(value);
|
|
11253
|
-
if (value instanceof fabric.FabricObject) return normalize(summarizeFabricObjectForResizeDebug(value));
|
|
11254
|
-
const output = {};
|
|
11255
|
-
Object.entries(value).forEach(([key, entry]) => {
|
|
11256
|
-
output[key] = normalize(entry);
|
|
11257
|
-
});
|
|
11258
|
-
return output;
|
|
11259
|
-
}
|
|
11260
|
-
return String(value);
|
|
11261
|
-
};
|
|
11262
|
-
const normalizedPayload = normalize(payload);
|
|
11263
|
-
const line = `${GROUP_TEXT_RESIZE_DEBUG_PREFIX} ${phase} ${JSON.stringify(normalizedPayload)}`;
|
|
11264
|
-
const debugWindow = window;
|
|
11265
|
-
debugWindow.__pixldocsGroupTextResizeLogs = Array.isArray(debugWindow.__pixldocsGroupTextResizeLogs) ? debugWindow.__pixldocsGroupTextResizeLogs.slice(-GROUP_TEXT_RESIZE_DEBUG_MAX_ENTRIES + 1) : [];
|
|
11266
|
-
debugWindow.__pixldocsGroupTextResizeLogs.push(line);
|
|
11267
|
-
console.log(line);
|
|
11268
|
-
} catch {
|
|
11269
|
-
console.log(GROUP_TEXT_RESIZE_DEBUG_PREFIX, phase, payload);
|
|
11270
|
-
}
|
|
11402
|
+
return;
|
|
11271
11403
|
};
|
|
11272
|
-
const
|
|
11273
|
-
const
|
|
11404
|
+
const ROTATED_GROUP_IMAGE_RESIZE_DEBUG_PREFIX = "[Pixldocs][rotated-group-image-resize]";
|
|
11405
|
+
const ROTATED_GROUP_IMAGE_RESIZE_DEBUG_MAX_ENTRIES = 400;
|
|
11274
11406
|
const roundRotDriftNumber = (value) => {
|
|
11275
11407
|
if (typeof value !== "number") return value;
|
|
11276
11408
|
return Number.isFinite(value) ? Math.round(value * 1e3) / 1e3 : String(value);
|
|
@@ -11352,52 +11484,27 @@ const summarizeRotDriftObject = (obj, worldMatrix) => {
|
|
|
11352
11484
|
}
|
|
11353
11485
|
};
|
|
11354
11486
|
const logRotGroupImageDrift = (phase, payload) => {
|
|
11487
|
+
return;
|
|
11488
|
+
};
|
|
11489
|
+
const logRotatedGroupImageResizeDebug = (phase, payload) => {
|
|
11355
11490
|
if (typeof console === "undefined") return;
|
|
11356
11491
|
try {
|
|
11357
|
-
const line = `${
|
|
11492
|
+
const line = `${ROTATED_GROUP_IMAGE_RESIZE_DEBUG_PREFIX} ${phase} ${JSON.stringify(normalizeRotDriftPayload(payload))}`;
|
|
11358
11493
|
if (typeof window !== "undefined") {
|
|
11359
11494
|
const debugWindow = window;
|
|
11360
|
-
debugWindow.
|
|
11361
|
-
debugWindow.
|
|
11495
|
+
debugWindow.__pixldocsRotatedGroupImageResizeLogs = Array.isArray(debugWindow.__pixldocsRotatedGroupImageResizeLogs) ? debugWindow.__pixldocsRotatedGroupImageResizeLogs.slice(-ROTATED_GROUP_IMAGE_RESIZE_DEBUG_MAX_ENTRIES + 1) : [];
|
|
11496
|
+
debugWindow.__pixldocsRotatedGroupImageResizeLogs.push(line);
|
|
11362
11497
|
}
|
|
11363
11498
|
console.log(line);
|
|
11364
11499
|
} catch {
|
|
11365
|
-
console.log(
|
|
11500
|
+
console.log(ROTATED_GROUP_IMAGE_RESIZE_DEBUG_PREFIX, phase, payload);
|
|
11366
11501
|
}
|
|
11367
11502
|
};
|
|
11368
11503
|
const shouldLogRotDriftLiveTick = (target, phase) => {
|
|
11369
|
-
|
|
11370
|
-
const anyTarget = target;
|
|
11371
|
-
const key = `__pixldocsRotDrift_${phase}_count`;
|
|
11372
|
-
const count = (anyTarget[key] ?? 0) + 1;
|
|
11373
|
-
anyTarget[key] = count;
|
|
11374
|
-
return count <= 3 || count % 8 === 0;
|
|
11504
|
+
return false;
|
|
11375
11505
|
};
|
|
11376
11506
|
const logRotDriftSelectionSnapshot = (phase, target, extra = {}) => {
|
|
11377
|
-
|
|
11378
|
-
const anyTarget = target;
|
|
11379
|
-
const kids = typeof anyTarget.getObjects === "function" ? anyTarget.getObjects() : [];
|
|
11380
|
-
const selectionMatrix = target instanceof fabric.ActiveSelection ? target.calcTransformMatrix() : null;
|
|
11381
|
-
logRotGroupImageDrift(phase, {
|
|
11382
|
-
...extra,
|
|
11383
|
-
target: summarizeRotDriftObject(target),
|
|
11384
|
-
childCount: kids.length,
|
|
11385
|
-
groupSelectionId: anyTarget.__pixldocsGroupSelection,
|
|
11386
|
-
alignedAngle: anyTarget.__pixldocsAlignedAngle
|
|
11387
|
-
});
|
|
11388
|
-
kids.forEach((kid, childIndex) => {
|
|
11389
|
-
var _a2, _b2;
|
|
11390
|
-
const childWorldMatrix = selectionMatrix ? fabric.util.multiplyTransformMatrices(
|
|
11391
|
-
selectionMatrix,
|
|
11392
|
-
kid.calcOwnMatrix()
|
|
11393
|
-
) : (_a2 = kid.calcTransformMatrix) == null ? void 0 : _a2.call(kid);
|
|
11394
|
-
logRotGroupImageDrift(`${phase}-child`, {
|
|
11395
|
-
...extra,
|
|
11396
|
-
childIndex,
|
|
11397
|
-
parentType: anyTarget.type ?? ((_b2 = target.constructor) == null ? void 0 : _b2.name),
|
|
11398
|
-
child: summarizeRotDriftObject(kid, childWorldMatrix ?? null)
|
|
11399
|
-
});
|
|
11400
|
-
});
|
|
11507
|
+
return;
|
|
11401
11508
|
};
|
|
11402
11509
|
const bakeTextboxScaleIntoTypography = (obj, sourceElement) => {
|
|
11403
11510
|
const sx = Math.abs(obj.scaleX ?? 1) || 1;
|
|
@@ -12198,6 +12305,22 @@ const PageCanvas = forwardRef(
|
|
|
12198
12305
|
[canvasWidth, canvasHeight, getLogicalGroupSnapBoundsCallback, getResizeExcludeIdsCallback]
|
|
12199
12306
|
);
|
|
12200
12307
|
const installImageResizeControlsWithSnap = useCallback((group) => {
|
|
12308
|
+
var _a2;
|
|
12309
|
+
try {
|
|
12310
|
+
const groupId = getObjectId(group);
|
|
12311
|
+
const pageChildrenNow = ((_a2 = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _a2.children) ?? [];
|
|
12312
|
+
const parent = groupId ? findParentGroup(pageChildrenNow, groupId) : null;
|
|
12313
|
+
if (parent) {
|
|
12314
|
+
group.__pixldocsParentGroupId = parent.id;
|
|
12315
|
+
group.__pixldocsParentGroupAngle = parent.angle ?? 0;
|
|
12316
|
+
group.__pixldocsParentGroupType = "logical-group";
|
|
12317
|
+
} else {
|
|
12318
|
+
delete group.__pixldocsParentGroupId;
|
|
12319
|
+
delete group.__pixldocsParentGroupAngle;
|
|
12320
|
+
delete group.__pixldocsParentGroupType;
|
|
12321
|
+
}
|
|
12322
|
+
} catch {
|
|
12323
|
+
}
|
|
12201
12324
|
group.__resizeSnapHandler = (target, corner) => {
|
|
12202
12325
|
const fc = fabricRef.current ?? target.canvas;
|
|
12203
12326
|
if (!fc || !isActiveRef.current || !corner) return;
|
|
@@ -13332,9 +13455,6 @@ const PageCanvas = forwardRef(
|
|
|
13332
13455
|
};
|
|
13333
13456
|
logRotDriftSelectionSnapshot("transform-start", active, {
|
|
13334
13457
|
time: Math.round(performance.now()),
|
|
13335
|
-
groupId,
|
|
13336
|
-
groupAbs,
|
|
13337
|
-
selectionRect: rect,
|
|
13338
13458
|
transformStart: groupSelectionTransformStartRef.current,
|
|
13339
13459
|
selectedStoreIds: useEditorStore.getState().canvas.selectedIds
|
|
13340
13460
|
});
|
|
@@ -14234,14 +14354,14 @@ const PageCanvas = forwardRef(
|
|
|
14234
14354
|
fabricCanvas.on("selection:cleared", () => {
|
|
14235
14355
|
});
|
|
14236
14356
|
fabricCanvas.on("object:scaling", (e) => {
|
|
14237
|
-
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j;
|
|
14357
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
14238
14358
|
if (!isActiveRef.current) return;
|
|
14239
14359
|
const t = e.target;
|
|
14240
14360
|
if (t) lastResizeScaleTargetRef.current = t;
|
|
14241
14361
|
prepareGroupSelectionTransformStart(t);
|
|
14242
14362
|
markTransforming(t);
|
|
14243
14363
|
didTransformRef.current = true;
|
|
14244
|
-
if (shouldLogRotDriftLiveTick(
|
|
14364
|
+
if (shouldLogRotDriftLiveTick()) {
|
|
14245
14365
|
logRotDriftSelectionSnapshot("scaling", t, {
|
|
14246
14366
|
time: Math.round(performance.now()),
|
|
14247
14367
|
corner: t == null ? void 0 : t.__corner,
|
|
@@ -14405,12 +14525,61 @@ const PageCanvas = forwardRef(
|
|
|
14405
14525
|
const corner = (transform == null ? void 0 : transform.corner) || "";
|
|
14406
14526
|
if (obj instanceof fabric.ActiveSelection && corner) {
|
|
14407
14527
|
activeSelectionResizeHandleRef.current = corner;
|
|
14528
|
+
const imageChildrenForResizeDebug = obj.getObjects().filter(
|
|
14529
|
+
(child) => {
|
|
14530
|
+
var _a3;
|
|
14531
|
+
return child instanceof fabric.FabricImage || child instanceof fabric.Group && (child.__cropGroup || ((_a3 = child._ct) == null ? void 0 : _a3.isCropGroup));
|
|
14532
|
+
}
|
|
14533
|
+
);
|
|
14534
|
+
const normalizedSelectionAngle = ((obj.angle ?? 0) % 360 + 360) % 360;
|
|
14535
|
+
const activeLogicalGroupId = obj.__pixldocsGroupSelection;
|
|
14536
|
+
const transformStartForDebug = activeLogicalGroupId && ((_c2 = groupSelectionTransformStartRef.current) == null ? void 0 : _c2.groupId) === activeLogicalGroupId ? groupSelectionTransformStartRef.current : null;
|
|
14537
|
+
const logicalGroupAngle = (transformStartForDebug == null ? void 0 : transformStartForDebug.groupAngle) ?? obj.__pixldocsFrozenGroupAngle ?? 0;
|
|
14538
|
+
const normalizedLogicalGroupAngle = (logicalGroupAngle % 360 + 360) % 360;
|
|
14539
|
+
const isRotatedImageSelection = imageChildrenForResizeDebug.length > 0 && (Math.min(normalizedSelectionAngle, 360 - normalizedSelectionAngle) > 0.5 || Math.min(normalizedLogicalGroupAngle, 360 - normalizedLogicalGroupAngle) > 0.5);
|
|
14540
|
+
if (isRotatedImageSelection) {
|
|
14541
|
+
const countKey = "__pixldocsRotatedImageResizeScaleTickCount";
|
|
14542
|
+
const count = (obj[countKey] ?? 0) + 1;
|
|
14543
|
+
obj[countKey] = count;
|
|
14544
|
+
if (count <= 5 || count % 8 === 0) {
|
|
14545
|
+
logRotatedGroupImageResizeDebug("active-selection-scaling", {
|
|
14546
|
+
time: Math.round(performance.now()),
|
|
14547
|
+
tick: count,
|
|
14548
|
+
handle: corner,
|
|
14549
|
+
groupSelectionId: activeLogicalGroupId,
|
|
14550
|
+
selectedStoreIds: useEditorStore.getState().canvas.selectedIds,
|
|
14551
|
+
route: typeof window !== "undefined" ? window.location.pathname : void 0,
|
|
14552
|
+
transformAction: (_d = fabricCanvas._currentTransform) == null ? void 0 : _d.action,
|
|
14553
|
+
transformCorner: (_e = fabricCanvas._currentTransform) == null ? void 0 : _e.corner,
|
|
14554
|
+
transformOriginal: (() => {
|
|
14555
|
+
var _a3;
|
|
14556
|
+
const original = (_a3 = fabricCanvas._currentTransform) == null ? void 0 : _a3.original;
|
|
14557
|
+
return original ? {
|
|
14558
|
+
left: original.left,
|
|
14559
|
+
top: original.top,
|
|
14560
|
+
width: original.width,
|
|
14561
|
+
height: original.height,
|
|
14562
|
+
scaleX: original.scaleX,
|
|
14563
|
+
scaleY: original.scaleY,
|
|
14564
|
+
angle: original.angle
|
|
14565
|
+
} : null;
|
|
14566
|
+
})(),
|
|
14567
|
+
transformStart: transformStartForDebug,
|
|
14568
|
+
selection: summarizeRotDriftObject(obj),
|
|
14569
|
+
imageChildren: imageChildrenForResizeDebug.map((child, childIndex) => ({
|
|
14570
|
+
childIndex,
|
|
14571
|
+
id: getObjectId(child),
|
|
14572
|
+
object: summarizeRotDriftObject(child)
|
|
14573
|
+
}))
|
|
14574
|
+
});
|
|
14575
|
+
}
|
|
14576
|
+
}
|
|
14408
14577
|
if (isCornerResizeHandle(corner) && obj.getObjects().some((child) => child instanceof fabric.Textbox)) {
|
|
14409
14578
|
obj.__pixldocsLastGroupTextScaleDebug = {
|
|
14410
14579
|
time: Math.round(performance.now()),
|
|
14411
14580
|
corner,
|
|
14412
14581
|
groupSelectionId: obj.__pixldocsGroupSelection,
|
|
14413
|
-
currentTransformAction: (
|
|
14582
|
+
currentTransformAction: (_f = fabricCanvas._currentTransform) == null ? void 0 : _f.action,
|
|
14414
14583
|
selection: summarizeFabricObjectForResizeDebug(obj),
|
|
14415
14584
|
textChildren: obj.getObjects().filter((child) => child instanceof fabric.Textbox).map((child) => summarizeFabricObjectForResizeDebug(child))
|
|
14416
14585
|
};
|
|
@@ -14419,17 +14588,17 @@ const PageCanvas = forwardRef(
|
|
|
14419
14588
|
if (obj instanceof fabric.ActiveSelection && (corner === "ml" || corner === "mr" || corner === "mt" || corner === "mb")) {
|
|
14420
14589
|
const isXSide = corner === "ml" || corner === "mr";
|
|
14421
14590
|
const _cur = fabricCanvas._currentTransform;
|
|
14422
|
-
const startSx = Math.abs(Number(((
|
|
14423
|
-
const startSy = Math.abs(Number(((
|
|
14591
|
+
const startSx = Math.abs(Number(((_g = _cur == null ? void 0 : _cur.original) == null ? void 0 : _g.scaleX) ?? 1)) || 1;
|
|
14592
|
+
const startSy = Math.abs(Number(((_h = _cur == null ? void 0 : _cur.original) == null ? void 0 : _h.scaleY) ?? 1)) || 1;
|
|
14424
14593
|
const sAxis = isXSide ? Math.abs((obj.scaleX ?? 1) / startSx) : Math.abs((obj.scaleY ?? 1) / startSy);
|
|
14425
14594
|
if (sAxis > 1e-3) {
|
|
14426
|
-
if (isXSide && ((
|
|
14595
|
+
if (isXSide && ((_i = groupShiftReflowSnapshotRef.current) == null ? void 0 : _i.selection) !== obj) {
|
|
14427
14596
|
groupShiftReflowSnapshotRef.current = null;
|
|
14428
14597
|
const logicalGroupId = obj.__pixldocsGroupSelection;
|
|
14429
14598
|
if (logicalGroupId) {
|
|
14430
14599
|
try {
|
|
14431
14600
|
const state = useEditorStore.getState();
|
|
14432
|
-
const pageChildren2 = ((
|
|
14601
|
+
const pageChildren2 = ((_j = state.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _j.children) ?? [];
|
|
14433
14602
|
const groupNode = findNodeById(pageChildren2, logicalGroupId);
|
|
14434
14603
|
if (groupNode && isGroup(groupNode) && !isStackLayoutMode(groupNode.layoutMode)) {
|
|
14435
14604
|
const entries = obj.getObjects().map((c) => ({
|
|
@@ -14467,7 +14636,7 @@ const PageCanvas = forwardRef(
|
|
|
14467
14636
|
}
|
|
14468
14637
|
continue;
|
|
14469
14638
|
}
|
|
14470
|
-
if (child instanceof fabric.Group && (child.__cropGroup || ((
|
|
14639
|
+
if (child instanceof fabric.Group && (child.__cropGroup || ((_k = child._ct) == null ? void 0 : _k.isCropGroup))) {
|
|
14471
14640
|
const ct = child.__cropData;
|
|
14472
14641
|
if (!ct) continue;
|
|
14473
14642
|
if (child.__asLiveOrigAngle == null) {
|
|
@@ -14634,7 +14803,7 @@ const PageCanvas = forwardRef(
|
|
|
14634
14803
|
child.dirty = true;
|
|
14635
14804
|
didReflowTextChild = true;
|
|
14636
14805
|
}
|
|
14637
|
-
if (isXSide && ((
|
|
14806
|
+
if (isXSide && ((_l = groupShiftReflowSnapshotRef.current) == null ? void 0 : _l.selection) === obj) {
|
|
14638
14807
|
const snap = groupShiftReflowSnapshotRef.current;
|
|
14639
14808
|
const anchorEntry = snap.children[0];
|
|
14640
14809
|
const anchorTopLive = anchorEntry.obj.top ?? 0;
|
|
@@ -14795,7 +14964,7 @@ const PageCanvas = forwardRef(
|
|
|
14795
14964
|
setGuides(gridGuidesForScale.length ? [...scaleGuides, ...gridGuidesForScale] : scaleGuides);
|
|
14796
14965
|
if (drilledGroupIdRef.current) {
|
|
14797
14966
|
try {
|
|
14798
|
-
(
|
|
14967
|
+
(_m = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _m.call(fabricCanvas);
|
|
14799
14968
|
} catch {
|
|
14800
14969
|
}
|
|
14801
14970
|
}
|
|
@@ -14891,7 +15060,7 @@ const PageCanvas = forwardRef(
|
|
|
14891
15060
|
didTransformRef.current = true;
|
|
14892
15061
|
const tr = e.target;
|
|
14893
15062
|
prepareGroupSelectionTransformStart(tr);
|
|
14894
|
-
if (shouldLogRotDriftLiveTick(
|
|
15063
|
+
if (shouldLogRotDriftLiveTick()) {
|
|
14895
15064
|
logRotDriftSelectionSnapshot("rotating", tr, {
|
|
14896
15065
|
time: Math.round(performance.now()),
|
|
14897
15066
|
transformAction: (_a2 = fabricCanvas._currentTransform) == null ? void 0 : _a2.action,
|
|
@@ -14932,7 +15101,7 @@ const PageCanvas = forwardRef(
|
|
|
14932
15101
|
prepareGroupSelectionTransformStart(e.target);
|
|
14933
15102
|
markTransforming(e.target);
|
|
14934
15103
|
didTransformRef.current = true;
|
|
14935
|
-
if (shouldLogRotDriftLiveTick(e.target
|
|
15104
|
+
if (shouldLogRotDriftLiveTick(e.target)) {
|
|
14936
15105
|
logRotDriftSelectionSnapshot("moving", e.target, {
|
|
14937
15106
|
time: Math.round(performance.now()),
|
|
14938
15107
|
transformAction: (_a2 = fabricCanvas._currentTransform) == null ? void 0 : _a2.action,
|
|
@@ -25204,9 +25373,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
25204
25373
|
}
|
|
25205
25374
|
return svgString;
|
|
25206
25375
|
}
|
|
25207
|
-
const resolvedPackageVersion = "0.5.
|
|
25376
|
+
const resolvedPackageVersion = "0.5.411";
|
|
25208
25377
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
25209
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
25378
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.411";
|
|
25210
25379
|
const roundParityValue = (value) => {
|
|
25211
25380
|
if (typeof value !== "number") return value;
|
|
25212
25381
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -26020,7 +26189,7 @@ class PixldocsRenderer {
|
|
|
26020
26189
|
await this.waitForCanvasScene(container, cloned, i);
|
|
26021
26190
|
}
|
|
26022
26191
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
26023
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
26192
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DgFZfNsT.js");
|
|
26024
26193
|
const prepared = preparePagesForExport(
|
|
26025
26194
|
cloned.pages,
|
|
26026
26195
|
canvasWidth,
|
|
@@ -28340,7 +28509,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
28340
28509
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
28341
28510
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
28342
28511
|
try {
|
|
28343
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
28512
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DgFZfNsT.js");
|
|
28344
28513
|
try {
|
|
28345
28514
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
28346
28515
|
} catch {
|
|
@@ -28740,4 +28909,4 @@ export {
|
|
|
28740
28909
|
buildTeaserBlurFlatKeys as y,
|
|
28741
28910
|
collectFontDescriptorsFromConfig as z
|
|
28742
28911
|
};
|
|
28743
|
-
//# sourceMappingURL=index-
|
|
28912
|
+
//# sourceMappingURL=index-DIx3vAjy.js.map
|