@pixldocs/canvas-renderer 0.5.408 → 0.5.410
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-D_anatnh.js → index-CS_cFpCL.js} +234 -144
- package/dist/index-CS_cFpCL.js.map +1 -0
- package/dist/{index-vGjobYro.cjs → index-xCnkRHXB.cjs} +234 -144
- package/dist/index-xCnkRHXB.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-DSZH7267.cjs → vectorPdfExport-BnnUwU40.cjs} +4 -4
- package/dist/{vectorPdfExport-DSZH7267.cjs.map → vectorPdfExport-BnnUwU40.cjs.map} +1 -1
- package/dist/{vectorPdfExport-PXI2Nd-d.js → vectorPdfExport-DE2UhH5g.js} +4 -4
- package/dist/{vectorPdfExport-PXI2Nd-d.js.map → vectorPdfExport-DE2UhH5g.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-D_anatnh.js.map +0 -1
- package/dist/index-vGjobYro.cjs.map +0 -1
|
@@ -4704,6 +4704,104 @@ 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 = "[Pixldocs][rotated-group-image-resize]";
|
|
4708
|
+
const ROTATED_GROUP_IMAGE_RESIZE_DEBUG_MAX_ENTRIES = 400;
|
|
4709
|
+
function isInsideRotatedActiveSelection(obj) {
|
|
4710
|
+
const parent = obj.group;
|
|
4711
|
+
if (!(parent instanceof fabric.ActiveSelection)) return false;
|
|
4712
|
+
const angle = Math.abs(((parent.angle ?? 0) % 360 + 360) % 360);
|
|
4713
|
+
return Math.min(angle, 360 - angle) > 0.5;
|
|
4714
|
+
}
|
|
4715
|
+
function summarizeResizeObject(obj) {
|
|
4716
|
+
var _a2, _b2, _c2, _d;
|
|
4717
|
+
if (!obj) return null;
|
|
4718
|
+
try {
|
|
4719
|
+
const matrix = (_a2 = obj.calcTransformMatrix) == null ? void 0 : _a2.call(obj);
|
|
4720
|
+
const decomp = matrix ? fabric.util.qrDecompose(matrix) : null;
|
|
4721
|
+
const rect = (_b2 = obj.getBoundingRect) == null ? void 0 : _b2.call(obj);
|
|
4722
|
+
const center = (_c2 = obj.getCenterPoint) == null ? void 0 : _c2.call(obj);
|
|
4723
|
+
return {
|
|
4724
|
+
type: obj.type ?? ((_d = obj.constructor) == null ? void 0 : _d.name),
|
|
4725
|
+
left: obj.left,
|
|
4726
|
+
top: obj.top,
|
|
4727
|
+
width: obj.width,
|
|
4728
|
+
height: obj.height,
|
|
4729
|
+
scaleX: obj.scaleX,
|
|
4730
|
+
scaleY: obj.scaleY,
|
|
4731
|
+
angle: obj.angle,
|
|
4732
|
+
originX: obj.originX,
|
|
4733
|
+
originY: obj.originY,
|
|
4734
|
+
centerX: center == null ? void 0 : center.x,
|
|
4735
|
+
centerY: center == null ? void 0 : center.y,
|
|
4736
|
+
brLeft: rect == null ? void 0 : rect.left,
|
|
4737
|
+
brTop: rect == null ? void 0 : rect.top,
|
|
4738
|
+
brWidth: rect == null ? void 0 : rect.width,
|
|
4739
|
+
brHeight: rect == null ? void 0 : rect.height,
|
|
4740
|
+
worldX: decomp == null ? void 0 : decomp.translateX,
|
|
4741
|
+
worldY: decomp == null ? void 0 : decomp.translateY,
|
|
4742
|
+
worldAngle: decomp == null ? void 0 : decomp.angle,
|
|
4743
|
+
worldScaleX: decomp == null ? void 0 : decomp.scaleX,
|
|
4744
|
+
worldScaleY: decomp == null ? void 0 : decomp.scaleY
|
|
4745
|
+
};
|
|
4746
|
+
} catch (error) {
|
|
4747
|
+
return { type: obj == null ? void 0 : obj.type, error: String(error) };
|
|
4748
|
+
}
|
|
4749
|
+
}
|
|
4750
|
+
function logRotatedGroupImageResize(phase, target, payload = {}) {
|
|
4751
|
+
if (typeof console === "undefined" || !isInsideRotatedActiveSelection(target)) return;
|
|
4752
|
+
try {
|
|
4753
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
4754
|
+
const normalize = (value) => {
|
|
4755
|
+
if (value == null) return value;
|
|
4756
|
+
if (typeof value === "number") return Number.isFinite(value) ? Math.round(value * 1e3) / 1e3 : String(value);
|
|
4757
|
+
if (typeof value === "string" || typeof value === "boolean") return value;
|
|
4758
|
+
if (Array.isArray(value)) return value.map(normalize);
|
|
4759
|
+
if (typeof value === "object") {
|
|
4760
|
+
if (seen.has(value)) return "[Circular]";
|
|
4761
|
+
seen.add(value);
|
|
4762
|
+
if (value instanceof fabric.FabricObject) return normalize(summarizeResizeObject(value));
|
|
4763
|
+
const out = {};
|
|
4764
|
+
Object.entries(value).forEach(([key, entry]) => {
|
|
4765
|
+
out[key] = normalize(entry);
|
|
4766
|
+
});
|
|
4767
|
+
return out;
|
|
4768
|
+
}
|
|
4769
|
+
return String(value);
|
|
4770
|
+
};
|
|
4771
|
+
const debugTarget = target;
|
|
4772
|
+
const parent = debugTarget.group;
|
|
4773
|
+
const ct = debugTarget.__cropData;
|
|
4774
|
+
const start = debugTarget.__cornerResizeStart;
|
|
4775
|
+
const safeStart = start ? {
|
|
4776
|
+
corner: start.corner,
|
|
4777
|
+
angle: start.angle,
|
|
4778
|
+
baseW: start.baseW,
|
|
4779
|
+
baseH: start.baseH,
|
|
4780
|
+
anchorX: start.anchorX,
|
|
4781
|
+
anchorY: start.anchorY,
|
|
4782
|
+
signX: start.signX,
|
|
4783
|
+
signY: start.signY
|
|
4784
|
+
} : void 0;
|
|
4785
|
+
const line = `${ROTATED_GROUP_IMAGE_RESIZE_DEBUG_PREFIX} ${phase} ${JSON.stringify(normalize({
|
|
4786
|
+
...payload,
|
|
4787
|
+
target: summarizeResizeObject(target),
|
|
4788
|
+
parent: summarizeResizeObject(parent),
|
|
4789
|
+
frameW: ct == null ? void 0 : ct.frameW,
|
|
4790
|
+
frameH: ct == null ? void 0 : ct.frameH,
|
|
4791
|
+
img: summarizeResizeObject(ct == null ? void 0 : ct._img),
|
|
4792
|
+
snapshot: safeStart,
|
|
4793
|
+
lastPointer: debugTarget.__lastPointerForCrop
|
|
4794
|
+
}))}`;
|
|
4795
|
+
if (typeof window !== "undefined") {
|
|
4796
|
+
const debugWindow = window;
|
|
4797
|
+
debugWindow.__pixldocsRotatedGroupImageResizeLogs = Array.isArray(debugWindow.__pixldocsRotatedGroupImageResizeLogs) ? debugWindow.__pixldocsRotatedGroupImageResizeLogs.slice(-ROTATED_GROUP_IMAGE_RESIZE_DEBUG_MAX_ENTRIES + 1) : [];
|
|
4798
|
+
debugWindow.__pixldocsRotatedGroupImageResizeLogs.push(line);
|
|
4799
|
+
}
|
|
4800
|
+
console.log(line);
|
|
4801
|
+
} catch {
|
|
4802
|
+
console.log(ROTATED_GROUP_IMAGE_RESIZE_DEBUG_PREFIX, phase, payload);
|
|
4803
|
+
}
|
|
4804
|
+
}
|
|
4707
4805
|
function clamp$1(v, min, max) {
|
|
4708
4806
|
return Math.max(min, Math.min(max, v));
|
|
4709
4807
|
}
|
|
@@ -4947,12 +5045,23 @@ function getLocalDeltaStable(target, eventData) {
|
|
|
4947
5045
|
target.__lastPointerForCrop = p;
|
|
4948
5046
|
const dx = p.x - last.x;
|
|
4949
5047
|
const dy = p.y - last.y;
|
|
4950
|
-
const angle = fabric.util.degreesToRadians(target
|
|
5048
|
+
const angle = fabric.util.degreesToRadians(getWorldAngleDeg(target));
|
|
4951
5049
|
const cos = Math.cos(-angle);
|
|
4952
5050
|
const sin = Math.sin(-angle);
|
|
5051
|
+
const localDx = dx * cos - dy * sin;
|
|
5052
|
+
const localDy = dx * sin + dy * cos;
|
|
5053
|
+
logRotatedGroupImageResize("side-delta", target, {
|
|
5054
|
+
pointer: p,
|
|
5055
|
+
previousPointer: last,
|
|
5056
|
+
canvasDx: dx,
|
|
5057
|
+
canvasDy: dy,
|
|
5058
|
+
worldAngle: getWorldAngleDeg(target),
|
|
5059
|
+
localDx,
|
|
5060
|
+
localDy
|
|
5061
|
+
});
|
|
4953
5062
|
return {
|
|
4954
|
-
localDx
|
|
4955
|
-
localDy
|
|
5063
|
+
localDx,
|
|
5064
|
+
localDy
|
|
4956
5065
|
};
|
|
4957
5066
|
}
|
|
4958
5067
|
function worldDeltaToLocal(dx, dy, angleDeg) {
|
|
@@ -4973,8 +5082,40 @@ function localDeltaToWorld(dx, dy, angleDeg) {
|
|
|
4973
5082
|
y: dx * sin + dy * cos
|
|
4974
5083
|
};
|
|
4975
5084
|
}
|
|
4976
|
-
function
|
|
4977
|
-
|
|
5085
|
+
function getWorldAngleDeg(obj) {
|
|
5086
|
+
var _a2;
|
|
5087
|
+
try {
|
|
5088
|
+
if (typeof obj.getTotalAngle === "function") return obj.getTotalAngle() || 0;
|
|
5089
|
+
const matrix = (_a2 = obj.calcTransformMatrix) == null ? void 0 : _a2.call(obj);
|
|
5090
|
+
return matrix ? fabric.util.qrDecompose(matrix).angle || 0 : obj.angle || 0;
|
|
5091
|
+
} catch {
|
|
5092
|
+
return obj.angle || 0;
|
|
5093
|
+
}
|
|
5094
|
+
}
|
|
5095
|
+
function getWorldCenter(obj) {
|
|
5096
|
+
var _a2;
|
|
5097
|
+
try {
|
|
5098
|
+
const matrix = (_a2 = obj.calcTransformMatrix) == null ? void 0 : _a2.call(obj);
|
|
5099
|
+
if (matrix) {
|
|
5100
|
+
const decomposed = fabric.util.qrDecompose(matrix);
|
|
5101
|
+
return { x: decomposed.translateX || 0, y: decomposed.translateY || 0 };
|
|
5102
|
+
}
|
|
5103
|
+
} catch {
|
|
5104
|
+
}
|
|
5105
|
+
return { x: obj.left || 0, y: obj.top || 0 };
|
|
5106
|
+
}
|
|
5107
|
+
function setCenterFromWorld(obj, worldX, worldY) {
|
|
5108
|
+
const parent = obj.group;
|
|
5109
|
+
if (parent && typeof parent.calcTransformMatrix === "function") {
|
|
5110
|
+
try {
|
|
5111
|
+
const invParent = fabric.util.invertTransform(parent.calcTransformMatrix());
|
|
5112
|
+
const parentPoint = fabric.util.transformPoint({ x: worldX, y: worldY }, invParent);
|
|
5113
|
+
obj.set({ left: parentPoint.x, top: parentPoint.y, originX: "center", originY: "center" });
|
|
5114
|
+
return;
|
|
5115
|
+
} catch {
|
|
5116
|
+
}
|
|
5117
|
+
}
|
|
5118
|
+
obj.set({ left: worldX, top: worldY, originX: "center", originY: "center" });
|
|
4978
5119
|
}
|
|
4979
5120
|
function getCornerDefaultSigns(corner) {
|
|
4980
5121
|
switch (corner) {
|
|
@@ -5018,45 +5159,78 @@ function resizeFrameFromCornerUniform(eventData, transform, _x, _y) {
|
|
|
5018
5159
|
if (!canvas) return false;
|
|
5019
5160
|
const e = getDomEvent(eventData);
|
|
5020
5161
|
if (!e) return false;
|
|
5021
|
-
const pointer = canvas.getPointer(e);
|
|
5022
|
-
g.setCoords();
|
|
5023
|
-
const a = g.aCoords;
|
|
5024
|
-
if (!a) return false;
|
|
5025
5162
|
const corner = transform.corner;
|
|
5026
|
-
const anchor = getOppositeAnchor(a, corner);
|
|
5027
5163
|
const defaultSigns = getCornerDefaultSigns(corner);
|
|
5028
5164
|
const MIN_SIZE = 20;
|
|
5029
|
-
const
|
|
5030
|
-
const
|
|
5031
|
-
const
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5165
|
+
const pointer = canvas.getPointer(e);
|
|
5166
|
+
const angle = getWorldAngleDeg(g);
|
|
5167
|
+
const snapshot = g.__cornerResizeStart && g.__cornerResizeStart.corner === corner && g.__cornerResizeStart.transform === transform ? g.__cornerResizeStart : (() => {
|
|
5168
|
+
const center = getWorldCenter(g);
|
|
5169
|
+
const baseW = Math.max(MIN_SIZE, ct.frameW || g.width || 1);
|
|
5170
|
+
const baseH = Math.max(MIN_SIZE, ct.frameH || g.height || 1);
|
|
5171
|
+
const anchorLocal = { x: -defaultSigns.x * baseW / 2, y: -defaultSigns.y * baseH / 2 };
|
|
5172
|
+
const anchorWorld = localDeltaToWorld(anchorLocal.x, anchorLocal.y, angle);
|
|
5173
|
+
const snap = {
|
|
5174
|
+
corner,
|
|
5175
|
+
transform,
|
|
5176
|
+
angle,
|
|
5177
|
+
baseW,
|
|
5178
|
+
baseH,
|
|
5179
|
+
anchorX: center.x + anchorWorld.x,
|
|
5180
|
+
anchorY: center.y + anchorWorld.y,
|
|
5181
|
+
signX: defaultSigns.x,
|
|
5182
|
+
signY: defaultSigns.y
|
|
5183
|
+
};
|
|
5184
|
+
g.__cornerResizeStart = snap;
|
|
5185
|
+
logRotatedGroupImageResize("corner-start", g, {
|
|
5186
|
+
corner,
|
|
5187
|
+
pointer,
|
|
5188
|
+
center,
|
|
5189
|
+
anchorLocal,
|
|
5190
|
+
anchorWorld,
|
|
5191
|
+
snapshot: snap
|
|
5192
|
+
});
|
|
5193
|
+
return snap;
|
|
5194
|
+
})();
|
|
5195
|
+
const localDelta = worldDeltaToLocal(pointer.x - snapshot.anchorX, pointer.y - snapshot.anchorY, snapshot.angle);
|
|
5196
|
+
const signX = snapshot.signX;
|
|
5197
|
+
const signY = snapshot.signY;
|
|
5037
5198
|
const rawW = Math.max(MIN_SIZE, Math.abs(localDelta.x));
|
|
5038
5199
|
const rawH = Math.max(MIN_SIZE, Math.abs(localDelta.y));
|
|
5039
|
-
const scaleFromW = rawW / baseW;
|
|
5040
|
-
const scaleFromH = rawH / baseH;
|
|
5200
|
+
const scaleFromW = rawW / snapshot.baseW;
|
|
5201
|
+
const scaleFromH = rawH / snapshot.baseH;
|
|
5041
5202
|
const s = Math.min(scaleFromW, scaleFromH);
|
|
5042
|
-
const newW = Math.max(MIN_SIZE, baseW * s);
|
|
5043
|
-
const newH = Math.max(MIN_SIZE, baseH * s);
|
|
5203
|
+
const newW = Math.max(MIN_SIZE, snapshot.baseW * s);
|
|
5204
|
+
const newH = Math.max(MIN_SIZE, snapshot.baseH * s);
|
|
5205
|
+
logRotatedGroupImageResize("corner-tick-before-apply", g, {
|
|
5206
|
+
corner,
|
|
5207
|
+
pointer,
|
|
5208
|
+
angle,
|
|
5209
|
+
localDelta,
|
|
5210
|
+
rawW,
|
|
5211
|
+
rawH,
|
|
5212
|
+
scaleFromW,
|
|
5213
|
+
scaleFromH,
|
|
5214
|
+
uniformScale: s,
|
|
5215
|
+
newW,
|
|
5216
|
+
newH
|
|
5217
|
+
});
|
|
5044
5218
|
ct.frameW = newW;
|
|
5045
5219
|
ct.frameH = newH;
|
|
5046
5220
|
const centerLocal = {
|
|
5047
5221
|
x: signX * (newW / 2),
|
|
5048
5222
|
y: signY * (newH / 2)
|
|
5049
5223
|
};
|
|
5050
|
-
const centerWorld = localDeltaToWorld(centerLocal.x, centerLocal.y, angle);
|
|
5051
|
-
g.
|
|
5052
|
-
|
|
5053
|
-
top: anchor.y + centerWorld.y,
|
|
5054
|
-
originX: "center",
|
|
5055
|
-
originY: "center",
|
|
5056
|
-
width: newW,
|
|
5057
|
-
height: newH
|
|
5058
|
-
});
|
|
5224
|
+
const centerWorld = localDeltaToWorld(centerLocal.x, centerLocal.y, snapshot.angle);
|
|
5225
|
+
setCenterFromWorld(g, snapshot.anchorX + centerWorld.x, snapshot.anchorY + centerWorld.y);
|
|
5226
|
+
g.set({ width: newW, height: newH });
|
|
5059
5227
|
updateCoverLayout(g);
|
|
5228
|
+
logRotatedGroupImageResize("corner-tick-after-layout", g, {
|
|
5229
|
+
corner,
|
|
5230
|
+
centerLocal,
|
|
5231
|
+
centerWorld,
|
|
5232
|
+
targetWorldCenter: { x: snapshot.anchorX + centerWorld.x, y: snapshot.anchorY + centerWorld.y }
|
|
5233
|
+
});
|
|
5060
5234
|
canvas.requestRenderAll();
|
|
5061
5235
|
return true;
|
|
5062
5236
|
}
|
|
@@ -5065,8 +5239,9 @@ function resizeFrameFromSide(g, side, localDx, localDy) {
|
|
|
5065
5239
|
if (!ct) return;
|
|
5066
5240
|
const minSize = 30;
|
|
5067
5241
|
const moveCenterAlongLocalAxis = (obj, localX, localY) => {
|
|
5068
|
-
const
|
|
5069
|
-
|
|
5242
|
+
const center = getWorldCenter(obj);
|
|
5243
|
+
const worldDelta = localDeltaToWorld(localX, localY, getWorldAngleDeg(obj));
|
|
5244
|
+
setCenterFromWorld(obj, center.x + worldDelta.x, center.y + worldDelta.y);
|
|
5070
5245
|
};
|
|
5071
5246
|
if (side === "mr") {
|
|
5072
5247
|
ct.frameW = Math.max(minSize, ct.frameW + localDx);
|
|
@@ -5084,7 +5259,9 @@ function resizeFrameFromSide(g, side, localDx, localDy) {
|
|
|
5084
5259
|
ct.frameH = Math.max(minSize, ct.frameH - localDy);
|
|
5085
5260
|
moveCenterAlongLocalAxis(g, 0, localDy / 2);
|
|
5086
5261
|
}
|
|
5262
|
+
logRotatedGroupImageResize("side-before-layout", g, { side, localDx, localDy });
|
|
5087
5263
|
updateCoverLayout(g);
|
|
5264
|
+
logRotatedGroupImageResize("side-after-layout", g, { side, localDx, localDy });
|
|
5088
5265
|
}
|
|
5089
5266
|
function installCanvaMaskControls(g) {
|
|
5090
5267
|
const ct = g.__cropData;
|
|
@@ -5101,8 +5278,16 @@ function installCanvaMaskControls(g) {
|
|
|
5101
5278
|
};
|
|
5102
5279
|
g.set(controlStyle);
|
|
5103
5280
|
const notifyResizeSnap = (target, corner) => {
|
|
5281
|
+
if (target.group instanceof fabric.ActiveSelection) {
|
|
5282
|
+
logRotatedGroupImageResize("snap-skipped-active-selection-child", target, { corner });
|
|
5283
|
+
return;
|
|
5284
|
+
}
|
|
5104
5285
|
const handler = target.__resizeSnapHandler;
|
|
5105
|
-
if (typeof handler === "function")
|
|
5286
|
+
if (typeof handler === "function") {
|
|
5287
|
+
logRotatedGroupImageResize("snap-before", target, { corner });
|
|
5288
|
+
handler(target, corner);
|
|
5289
|
+
logRotatedGroupImageResize("snap-after", target, { corner });
|
|
5290
|
+
}
|
|
5106
5291
|
};
|
|
5107
5292
|
g.setControlsVisibility({
|
|
5108
5293
|
mt: true,
|
|
@@ -11165,8 +11350,6 @@ const scaleUpdateNumber = (updates, source, key, factor) => {
|
|
|
11165
11350
|
const value = Number(source == null ? void 0 : source[key]);
|
|
11166
11351
|
if (Number.isFinite(value)) updates[key] = value * factor;
|
|
11167
11352
|
};
|
|
11168
|
-
const GROUP_TEXT_RESIZE_DEBUG_PREFIX = "[Pixldocs][group-text-corner-resize]";
|
|
11169
|
-
const GROUP_TEXT_RESIZE_DEBUG_MAX_ENTRIES = 200;
|
|
11170
11353
|
const isCornerResizeHandle = (handle) => handle === "tl" || handle === "tr" || handle === "bl" || handle === "br";
|
|
11171
11354
|
const summarizeFabricObjectForResizeDebug = (obj) => {
|
|
11172
11355
|
var _a2;
|
|
@@ -11197,66 +11380,12 @@ const summarizeFabricObjectForResizeDebug = (obj) => {
|
|
|
11197
11380
|
}
|
|
11198
11381
|
};
|
|
11199
11382
|
const logGroupTextResizeDebug = (phase, payload) => {
|
|
11200
|
-
|
|
11201
|
-
try {
|
|
11202
|
-
const seen = /* @__PURE__ */ new WeakSet();
|
|
11203
|
-
const normalize = (value) => {
|
|
11204
|
-
if (value == null) return value;
|
|
11205
|
-
const valueType = typeof value;
|
|
11206
|
-
if (valueType === "number") return Number.isFinite(value) ? Math.round(value * 1e3) / 1e3 : String(value);
|
|
11207
|
-
if (valueType === "string" || valueType === "boolean") return value;
|
|
11208
|
-
if (valueType === "function") return `[Function ${value.name || "anonymous"}]`;
|
|
11209
|
-
if (Array.isArray(value)) return value.map((entry) => normalize(entry));
|
|
11210
|
-
if (valueType === "object") {
|
|
11211
|
-
if (seen.has(value)) return "[Circular]";
|
|
11212
|
-
seen.add(value);
|
|
11213
|
-
if (value instanceof fabric.FabricObject) return normalize(summarizeFabricObjectForResizeDebug(value));
|
|
11214
|
-
const output = {};
|
|
11215
|
-
Object.entries(value).forEach(([key, entry]) => {
|
|
11216
|
-
output[key] = normalize(entry);
|
|
11217
|
-
});
|
|
11218
|
-
return output;
|
|
11219
|
-
}
|
|
11220
|
-
return String(value);
|
|
11221
|
-
};
|
|
11222
|
-
const normalizedPayload = normalize(payload);
|
|
11223
|
-
const line = `${GROUP_TEXT_RESIZE_DEBUG_PREFIX} ${phase} ${JSON.stringify(normalizedPayload)}`;
|
|
11224
|
-
const debugWindow = window;
|
|
11225
|
-
debugWindow.__pixldocsGroupTextResizeLogs = Array.isArray(debugWindow.__pixldocsGroupTextResizeLogs) ? debugWindow.__pixldocsGroupTextResizeLogs.slice(-GROUP_TEXT_RESIZE_DEBUG_MAX_ENTRIES + 1) : [];
|
|
11226
|
-
debugWindow.__pixldocsGroupTextResizeLogs.push(line);
|
|
11227
|
-
console.log(line);
|
|
11228
|
-
} catch {
|
|
11229
|
-
console.log(GROUP_TEXT_RESIZE_DEBUG_PREFIX, phase, payload);
|
|
11230
|
-
}
|
|
11383
|
+
return;
|
|
11231
11384
|
};
|
|
11232
|
-
const ROT_GROUP_IMAGE_DRIFT_DEBUG_PREFIX = "[Pixldocs][rot-group-image-drift]";
|
|
11233
|
-
const ROT_GROUP_IMAGE_DRIFT_DEBUG_MAX_ENTRIES = 500;
|
|
11234
11385
|
const roundRotDriftNumber = (value) => {
|
|
11235
11386
|
if (typeof value !== "number") return value;
|
|
11236
11387
|
return Number.isFinite(value) ? Math.round(value * 1e3) / 1e3 : String(value);
|
|
11237
11388
|
};
|
|
11238
|
-
const normalizeRotDriftPayload = (value) => {
|
|
11239
|
-
const seen = /* @__PURE__ */ new WeakSet();
|
|
11240
|
-
const normalize = (entry) => {
|
|
11241
|
-
if (entry == null) return entry;
|
|
11242
|
-
const valueType = typeof entry;
|
|
11243
|
-
if (valueType === "number") return roundRotDriftNumber(entry);
|
|
11244
|
-
if (valueType === "string" || valueType === "boolean") return entry;
|
|
11245
|
-
if (Array.isArray(entry)) return entry.map((item) => normalize(item));
|
|
11246
|
-
if (valueType === "object") {
|
|
11247
|
-
if (seen.has(entry)) return "[Circular]";
|
|
11248
|
-
seen.add(entry);
|
|
11249
|
-
if (entry instanceof fabric.FabricObject) return normalize(summarizeRotDriftObject(entry));
|
|
11250
|
-
const output = {};
|
|
11251
|
-
Object.entries(entry).forEach(([key, item]) => {
|
|
11252
|
-
output[key] = normalize(item);
|
|
11253
|
-
});
|
|
11254
|
-
return output;
|
|
11255
|
-
}
|
|
11256
|
-
return String(entry);
|
|
11257
|
-
};
|
|
11258
|
-
return normalize(value);
|
|
11259
|
-
};
|
|
11260
11389
|
const matrixForRotDriftLog = (matrix) => {
|
|
11261
11390
|
if (!matrix) return void 0;
|
|
11262
11391
|
return matrix.map((entry) => roundRotDriftNumber(entry));
|
|
@@ -11312,52 +11441,13 @@ const summarizeRotDriftObject = (obj, worldMatrix) => {
|
|
|
11312
11441
|
}
|
|
11313
11442
|
};
|
|
11314
11443
|
const logRotGroupImageDrift = (phase, payload) => {
|
|
11315
|
-
|
|
11316
|
-
try {
|
|
11317
|
-
const line = `${ROT_GROUP_IMAGE_DRIFT_DEBUG_PREFIX} ${phase} ${JSON.stringify(normalizeRotDriftPayload(payload))}`;
|
|
11318
|
-
if (typeof window !== "undefined") {
|
|
11319
|
-
const debugWindow = window;
|
|
11320
|
-
debugWindow.__pixldocsRotGroupImageDriftLogs = Array.isArray(debugWindow.__pixldocsRotGroupImageDriftLogs) ? debugWindow.__pixldocsRotGroupImageDriftLogs.slice(-ROT_GROUP_IMAGE_DRIFT_DEBUG_MAX_ENTRIES + 1) : [];
|
|
11321
|
-
debugWindow.__pixldocsRotGroupImageDriftLogs.push(line);
|
|
11322
|
-
}
|
|
11323
|
-
console.log(line);
|
|
11324
|
-
} catch {
|
|
11325
|
-
console.log(ROT_GROUP_IMAGE_DRIFT_DEBUG_PREFIX, phase, payload);
|
|
11326
|
-
}
|
|
11444
|
+
return;
|
|
11327
11445
|
};
|
|
11328
11446
|
const shouldLogRotDriftLiveTick = (target, phase) => {
|
|
11329
|
-
|
|
11330
|
-
const anyTarget = target;
|
|
11331
|
-
const key = `__pixldocsRotDrift_${phase}_count`;
|
|
11332
|
-
const count = (anyTarget[key] ?? 0) + 1;
|
|
11333
|
-
anyTarget[key] = count;
|
|
11334
|
-
return count <= 3 || count % 8 === 0;
|
|
11447
|
+
return false;
|
|
11335
11448
|
};
|
|
11336
11449
|
const logRotDriftSelectionSnapshot = (phase, target, extra = {}) => {
|
|
11337
|
-
|
|
11338
|
-
const anyTarget = target;
|
|
11339
|
-
const kids = typeof anyTarget.getObjects === "function" ? anyTarget.getObjects() : [];
|
|
11340
|
-
const selectionMatrix = target instanceof fabric.ActiveSelection ? target.calcTransformMatrix() : null;
|
|
11341
|
-
logRotGroupImageDrift(phase, {
|
|
11342
|
-
...extra,
|
|
11343
|
-
target: summarizeRotDriftObject(target),
|
|
11344
|
-
childCount: kids.length,
|
|
11345
|
-
groupSelectionId: anyTarget.__pixldocsGroupSelection,
|
|
11346
|
-
alignedAngle: anyTarget.__pixldocsAlignedAngle
|
|
11347
|
-
});
|
|
11348
|
-
kids.forEach((kid, childIndex) => {
|
|
11349
|
-
var _a2, _b2;
|
|
11350
|
-
const childWorldMatrix = selectionMatrix ? fabric.util.multiplyTransformMatrices(
|
|
11351
|
-
selectionMatrix,
|
|
11352
|
-
kid.calcOwnMatrix()
|
|
11353
|
-
) : (_a2 = kid.calcTransformMatrix) == null ? void 0 : _a2.call(kid);
|
|
11354
|
-
logRotGroupImageDrift(`${phase}-child`, {
|
|
11355
|
-
...extra,
|
|
11356
|
-
childIndex,
|
|
11357
|
-
parentType: anyTarget.type ?? ((_b2 = target.constructor) == null ? void 0 : _b2.name),
|
|
11358
|
-
child: summarizeRotDriftObject(kid, childWorldMatrix ?? null)
|
|
11359
|
-
});
|
|
11360
|
-
});
|
|
11450
|
+
return;
|
|
11361
11451
|
};
|
|
11362
11452
|
const bakeTextboxScaleIntoTypography = (obj, sourceElement) => {
|
|
11363
11453
|
const sx = Math.abs(obj.scaleX ?? 1) || 1;
|
|
@@ -13292,9 +13382,6 @@ const PageCanvas = forwardRef(
|
|
|
13292
13382
|
};
|
|
13293
13383
|
logRotDriftSelectionSnapshot("transform-start", active, {
|
|
13294
13384
|
time: Math.round(performance.now()),
|
|
13295
|
-
groupId,
|
|
13296
|
-
groupAbs,
|
|
13297
|
-
selectionRect: rect,
|
|
13298
13385
|
transformStart: groupSelectionTransformStartRef.current,
|
|
13299
13386
|
selectedStoreIds: useEditorStore.getState().canvas.selectedIds
|
|
13300
13387
|
});
|
|
@@ -14103,6 +14190,9 @@ const PageCanvas = forwardRef(
|
|
|
14103
14190
|
if (activeObj.__lastPointerForCrop) {
|
|
14104
14191
|
delete activeObj.__lastPointerForCrop;
|
|
14105
14192
|
}
|
|
14193
|
+
if (activeObj.__cornerResizeStart) {
|
|
14194
|
+
delete activeObj.__cornerResizeStart;
|
|
14195
|
+
}
|
|
14106
14196
|
}
|
|
14107
14197
|
if (!didTransformRef.current) {
|
|
14108
14198
|
editLockRef.current = false;
|
|
@@ -14198,7 +14288,7 @@ const PageCanvas = forwardRef(
|
|
|
14198
14288
|
prepareGroupSelectionTransformStart(t);
|
|
14199
14289
|
markTransforming(t);
|
|
14200
14290
|
didTransformRef.current = true;
|
|
14201
|
-
if (shouldLogRotDriftLiveTick(
|
|
14291
|
+
if (shouldLogRotDriftLiveTick()) {
|
|
14202
14292
|
logRotDriftSelectionSnapshot("scaling", t, {
|
|
14203
14293
|
time: Math.round(performance.now()),
|
|
14204
14294
|
corner: t == null ? void 0 : t.__corner,
|
|
@@ -14848,7 +14938,7 @@ const PageCanvas = forwardRef(
|
|
|
14848
14938
|
didTransformRef.current = true;
|
|
14849
14939
|
const tr = e.target;
|
|
14850
14940
|
prepareGroupSelectionTransformStart(tr);
|
|
14851
|
-
if (shouldLogRotDriftLiveTick(
|
|
14941
|
+
if (shouldLogRotDriftLiveTick()) {
|
|
14852
14942
|
logRotDriftSelectionSnapshot("rotating", tr, {
|
|
14853
14943
|
time: Math.round(performance.now()),
|
|
14854
14944
|
transformAction: (_a2 = fabricCanvas._currentTransform) == null ? void 0 : _a2.action,
|
|
@@ -14889,7 +14979,7 @@ const PageCanvas = forwardRef(
|
|
|
14889
14979
|
prepareGroupSelectionTransformStart(e.target);
|
|
14890
14980
|
markTransforming(e.target);
|
|
14891
14981
|
didTransformRef.current = true;
|
|
14892
|
-
if (shouldLogRotDriftLiveTick(e.target
|
|
14982
|
+
if (shouldLogRotDriftLiveTick(e.target)) {
|
|
14893
14983
|
logRotDriftSelectionSnapshot("moving", e.target, {
|
|
14894
14984
|
time: Math.round(performance.now()),
|
|
14895
14985
|
transformAction: (_a2 = fabricCanvas._currentTransform) == null ? void 0 : _a2.action,
|
|
@@ -25161,9 +25251,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
25161
25251
|
}
|
|
25162
25252
|
return svgString;
|
|
25163
25253
|
}
|
|
25164
|
-
const resolvedPackageVersion = "0.5.
|
|
25254
|
+
const resolvedPackageVersion = "0.5.410";
|
|
25165
25255
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
25166
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
25256
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.410";
|
|
25167
25257
|
const roundParityValue = (value) => {
|
|
25168
25258
|
if (typeof value !== "number") return value;
|
|
25169
25259
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25977,7 +26067,7 @@ class PixldocsRenderer {
|
|
|
25977
26067
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25978
26068
|
}
|
|
25979
26069
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25980
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
26070
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DE2UhH5g.js");
|
|
25981
26071
|
const prepared = preparePagesForExport(
|
|
25982
26072
|
cloned.pages,
|
|
25983
26073
|
canvasWidth,
|
|
@@ -28297,7 +28387,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
28297
28387
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
28298
28388
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
28299
28389
|
try {
|
|
28300
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
28390
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DE2UhH5g.js");
|
|
28301
28391
|
try {
|
|
28302
28392
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
28303
28393
|
} catch {
|
|
@@ -28697,4 +28787,4 @@ export {
|
|
|
28697
28787
|
buildTeaserBlurFlatKeys as y,
|
|
28698
28788
|
collectFontDescriptorsFromConfig as z
|
|
28699
28789
|
};
|
|
28700
|
-
//# sourceMappingURL=index-
|
|
28790
|
+
//# sourceMappingURL=index-CS_cFpCL.js.map
|