@pixldocs/canvas-renderer 0.5.395 → 0.5.397
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-apZqfLuE.cjs → index-BgYo0VtS.cjs} +242 -45
- package/dist/index-BgYo0VtS.cjs.map +1 -0
- package/dist/{index-Bl3vMS3U.js → index-CqOZyZpi.js} +242 -45
- package/dist/index-CqOZyZpi.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-DXadS763.js → vectorPdfExport-EYMFI-uk.js} +4 -4
- package/dist/{vectorPdfExport-DXadS763.js.map → vectorPdfExport-EYMFI-uk.js.map} +1 -1
- package/dist/{vectorPdfExport-BFZzT33a.cjs → vectorPdfExport-o6mqay90.cjs} +4 -4
- package/dist/{vectorPdfExport-BFZzT33a.cjs.map → vectorPdfExport-o6mqay90.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-Bl3vMS3U.js.map +0 -1
- package/dist/index-apZqfLuE.cjs.map +0 -1
|
@@ -125,6 +125,7 @@ const createDefaultGroup = (partial) => ({
|
|
|
125
125
|
locked: false,
|
|
126
126
|
left: 0,
|
|
127
127
|
top: 0,
|
|
128
|
+
angle: 0,
|
|
128
129
|
...partial
|
|
129
130
|
});
|
|
130
131
|
const PAGE_BACKGROUND_ELEMENT_ID = "__pageBackground__";
|
|
@@ -847,9 +848,17 @@ function getNodeBounds(node, pageChildren, options) {
|
|
|
847
848
|
let width;
|
|
848
849
|
let height;
|
|
849
850
|
if (isGroup(node) && (pageChildren == null ? void 0 : pageChildren.length) !== void 0) {
|
|
850
|
-
const
|
|
851
|
-
|
|
852
|
-
|
|
851
|
+
const group = node;
|
|
852
|
+
const storedWidth = Number(group.width);
|
|
853
|
+
const storedHeight = Number(group.height);
|
|
854
|
+
if (!isStackLayoutMode(group.layoutMode) && storedWidth > 0 && storedHeight > 0) {
|
|
855
|
+
width = storedWidth;
|
|
856
|
+
height = storedHeight;
|
|
857
|
+
} else {
|
|
858
|
+
const size = groupBoundsFromChildren(group, pageChildren ?? []);
|
|
859
|
+
width = size.width;
|
|
860
|
+
height = size.height;
|
|
861
|
+
}
|
|
853
862
|
} else {
|
|
854
863
|
width = simpleWidth(node);
|
|
855
864
|
height = simpleHeight(node);
|
|
@@ -10524,6 +10533,115 @@ const normalizeAngle180 = (angle) => {
|
|
|
10524
10533
|
const n = (angle % 360 + 360) % 360;
|
|
10525
10534
|
return n > 180 ? n - 360 : n;
|
|
10526
10535
|
};
|
|
10536
|
+
const isValidLogicalGroupFrame = (frame) => !!frame && Number.isFinite(frame.left) && Number.isFinite(frame.top) && Number.isFinite(frame.width) && frame.width > 0 && Number.isFinite(frame.height) && frame.height > 0;
|
|
10537
|
+
const frameFromStoredGroupNode = (group, pageChildren, options) => {
|
|
10538
|
+
const width = Number(group.width);
|
|
10539
|
+
const height = Number(group.height);
|
|
10540
|
+
if (!Number.isFinite(width) || width <= 0 || !Number.isFinite(height) || height <= 0) return null;
|
|
10541
|
+
try {
|
|
10542
|
+
const abs = getAbsoluteBounds(group, pageChildren, options);
|
|
10543
|
+
return { left: abs.left, top: abs.top, width, height };
|
|
10544
|
+
} catch {
|
|
10545
|
+
return null;
|
|
10546
|
+
}
|
|
10547
|
+
};
|
|
10548
|
+
const orientedFrameFromWorldPoints = (points, angle) => {
|
|
10549
|
+
if (points.length === 0 || !Number.isFinite(angle)) return null;
|
|
10550
|
+
const rad = -angle * Math.PI / 180;
|
|
10551
|
+
const cos = Math.cos(rad);
|
|
10552
|
+
const sin = Math.sin(rad);
|
|
10553
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
10554
|
+
for (const p of points) {
|
|
10555
|
+
const xr = p.x * cos - p.y * sin;
|
|
10556
|
+
const yr = p.x * sin + p.y * cos;
|
|
10557
|
+
minX = Math.min(minX, xr);
|
|
10558
|
+
minY = Math.min(minY, yr);
|
|
10559
|
+
maxX = Math.max(maxX, xr);
|
|
10560
|
+
maxY = Math.max(maxY, yr);
|
|
10561
|
+
}
|
|
10562
|
+
if (![minX, minY, maxX, maxY].every(Number.isFinite)) return null;
|
|
10563
|
+
const width = Math.max(1, maxX - minX);
|
|
10564
|
+
const height = Math.max(1, maxY - minY);
|
|
10565
|
+
const centerXRot = minX + width / 2;
|
|
10566
|
+
const centerYRot = minY + height / 2;
|
|
10567
|
+
const back = angle * Math.PI / 180;
|
|
10568
|
+
const c = Math.cos(back);
|
|
10569
|
+
const s = Math.sin(back);
|
|
10570
|
+
const centerX = centerXRot * c - centerYRot * s;
|
|
10571
|
+
const centerY = centerXRot * s + centerYRot * c;
|
|
10572
|
+
return { left: centerX - width / 2, top: centerY - height / 2, width, height };
|
|
10573
|
+
};
|
|
10574
|
+
const collectFabricObjectWorldPoints = (objects) => {
|
|
10575
|
+
const points = [];
|
|
10576
|
+
for (const obj of objects) {
|
|
10577
|
+
try {
|
|
10578
|
+
obj.setCoords();
|
|
10579
|
+
} catch {
|
|
10580
|
+
}
|
|
10581
|
+
const coords = typeof obj.getCoords === "function" ? obj.getCoords() : null;
|
|
10582
|
+
if (Array.isArray(coords) && coords.length) {
|
|
10583
|
+
points.push(...coords.map((p) => ({ x: p.x, y: p.y })));
|
|
10584
|
+
continue;
|
|
10585
|
+
}
|
|
10586
|
+
const aC = obj.aCoords;
|
|
10587
|
+
if (!aC) continue;
|
|
10588
|
+
for (const key of ["tl", "tr", "br", "bl"]) {
|
|
10589
|
+
const p = aC[key];
|
|
10590
|
+
if (p) points.push({ x: p.x, y: p.y });
|
|
10591
|
+
}
|
|
10592
|
+
}
|
|
10593
|
+
return points;
|
|
10594
|
+
};
|
|
10595
|
+
const collectFabricObjectWorldCenters = (objects) => {
|
|
10596
|
+
var _a2;
|
|
10597
|
+
const centers = [];
|
|
10598
|
+
for (const obj of objects) {
|
|
10599
|
+
try {
|
|
10600
|
+
obj.setCoords();
|
|
10601
|
+
} catch {
|
|
10602
|
+
}
|
|
10603
|
+
const coords = typeof obj.getCoords === "function" ? obj.getCoords() : null;
|
|
10604
|
+
if (Array.isArray(coords) && coords.length >= 4) {
|
|
10605
|
+
const pts = coords.slice(0, 4).map((p) => ({ x: Number(p.x), y: Number(p.y) })).filter((p) => Number.isFinite(p.x) && Number.isFinite(p.y));
|
|
10606
|
+
if (pts.length) centers.push({ x: pts.reduce((sum, p) => sum + p.x, 0) / pts.length, y: pts.reduce((sum, p) => sum + p.y, 0) / pts.length });
|
|
10607
|
+
continue;
|
|
10608
|
+
}
|
|
10609
|
+
try {
|
|
10610
|
+
const center = (_a2 = obj.getCenterPoint) == null ? void 0 : _a2.call(obj);
|
|
10611
|
+
if (center && Number.isFinite(center.x) && Number.isFinite(center.y)) centers.push({ x: center.x, y: center.y });
|
|
10612
|
+
} catch {
|
|
10613
|
+
}
|
|
10614
|
+
}
|
|
10615
|
+
return centers;
|
|
10616
|
+
};
|
|
10617
|
+
const logicalFrameContainsWorldCenters = (frame, angle, centers) => {
|
|
10618
|
+
if (!isValidLogicalGroupFrame(frame) || centers.length === 0) return true;
|
|
10619
|
+
const a = typeof angle === "number" && Number.isFinite(angle) ? normalizeAngle180(angle) : 0;
|
|
10620
|
+
const cx = frame.left + frame.width / 2;
|
|
10621
|
+
const cy = frame.top + frame.height / 2;
|
|
10622
|
+
const rad = -a * Math.PI / 180;
|
|
10623
|
+
const c = Math.cos(rad);
|
|
10624
|
+
const s = Math.sin(rad);
|
|
10625
|
+
const tolerance = Math.max(8, Math.min(frame.width, frame.height) * 0.08);
|
|
10626
|
+
return centers.every((p) => {
|
|
10627
|
+
const dx = p.x - cx;
|
|
10628
|
+
const dy = p.y - cy;
|
|
10629
|
+
const localX = cx + dx * c - dy * s;
|
|
10630
|
+
const localY = cy + dx * s + dy * c;
|
|
10631
|
+
return localX >= frame.left - tolerance && localX <= frame.left + frame.width + tolerance && localY >= frame.top - tolerance && localY <= frame.top + frame.height + tolerance;
|
|
10632
|
+
});
|
|
10633
|
+
};
|
|
10634
|
+
const shouldRepairUnrotatedLogicalGroupFrame = (storedFrame, contentFrame, angle) => {
|
|
10635
|
+
if (!isValidLogicalGroupFrame(storedFrame) || !isValidLogicalGroupFrame(contentFrame)) return false;
|
|
10636
|
+
if (Math.abs(normalizeAngle180(typeof angle === "number" && Number.isFinite(angle) ? angle : 0)) > 0.5) return false;
|
|
10637
|
+
const storedArea = storedFrame.width * storedFrame.height;
|
|
10638
|
+
const contentArea = contentFrame.width * contentFrame.height;
|
|
10639
|
+
const areaRatio = storedArea / Math.max(1, contentArea);
|
|
10640
|
+
const dx = Math.abs(storedFrame.left + storedFrame.width / 2 - (contentFrame.left + contentFrame.width / 2));
|
|
10641
|
+
const dy = Math.abs(storedFrame.top + storedFrame.height / 2 - (contentFrame.top + contentFrame.height / 2));
|
|
10642
|
+
const driftTolerance = Math.max(12, Math.min(storedFrame.width, storedFrame.height) * 0.08);
|
|
10643
|
+
return areaRatio > 1.35 || dx > driftTolerance || dy > driftTolerance;
|
|
10644
|
+
};
|
|
10527
10645
|
let ensureCanvaControlRenders = () => {
|
|
10528
10646
|
};
|
|
10529
10647
|
try {
|
|
@@ -11517,13 +11635,40 @@ function applyWarpAwareSelectionBorders(selection, preferredGroupAngle, preferre
|
|
|
11517
11635
|
for (const b of buckets) b.area = orientedAreaForAngle(b.angle);
|
|
11518
11636
|
buckets.sort((a, b) => b.count - a.count || a.area - b.area || Math.abs(b.angle) - Math.abs(a.angle));
|
|
11519
11637
|
const dominant = buckets[0];
|
|
11520
|
-
|
|
11638
|
+
let effectivePreferredGroupAngle = preferredGroupAngle;
|
|
11639
|
+
let effectivePreferredGroupFrame = preferredGroupFrame;
|
|
11640
|
+
const logicalGroupId = selection.__pixldocsGroupSelection;
|
|
11641
|
+
if (logicalGroupId && (!(typeof effectivePreferredGroupAngle === "number" && Number.isFinite(effectivePreferredGroupAngle)) || !isValidLogicalGroupFrame(effectivePreferredGroupFrame))) {
|
|
11642
|
+
try {
|
|
11643
|
+
const stateNow = useEditorStore.getState();
|
|
11644
|
+
const pageNow = stateNow.canvas.pages.find((p) => p.id === stateNow.canvas.currentPageId);
|
|
11645
|
+
const groupNode = pageNow ? findNodeById(pageNow.children ?? [], logicalGroupId) : null;
|
|
11646
|
+
if (groupNode && isGroup(groupNode)) {
|
|
11647
|
+
if (!(typeof effectivePreferredGroupAngle === "number" && Number.isFinite(effectivePreferredGroupAngle)) && typeof groupNode.angle === "number") {
|
|
11648
|
+
effectivePreferredGroupAngle = groupNode.angle;
|
|
11649
|
+
}
|
|
11650
|
+
if (!isValidLogicalGroupFrame(effectivePreferredGroupFrame)) {
|
|
11651
|
+
effectivePreferredGroupFrame = frameFromStoredGroupNode(groupNode, (pageNow == null ? void 0 : pageNow.children) ?? []);
|
|
11652
|
+
}
|
|
11653
|
+
}
|
|
11654
|
+
} catch {
|
|
11655
|
+
}
|
|
11656
|
+
}
|
|
11657
|
+
const rawPreferredGroupAngle = typeof effectivePreferredGroupAngle === "number" && Number.isFinite(effectivePreferredGroupAngle) ? effectivePreferredGroupAngle : typeof selection.__pixldocsGroupAngle === "number" && Number.isFinite(selection.__pixldocsGroupAngle) ? selection.__pixldocsGroupAngle : null;
|
|
11521
11658
|
const preferredAngle = rawPreferredGroupAngle != null ? normalizeAngle180(rawPreferredGroupAngle) : null;
|
|
11522
11659
|
let targetAngle = preferredAngle;
|
|
11523
|
-
const isLogicalGroupSelection = !!
|
|
11660
|
+
const isLogicalGroupSelection = !!logicalGroupId;
|
|
11524
11661
|
if (targetAngle == null && dominant && Math.abs(dominant.angle) > 0.5 && (isLogicalGroupSelection || kids.length === 1 || dominant.count >= 2 || dominant.count === kids.length)) {
|
|
11525
11662
|
targetAngle = dominant.angle;
|
|
11526
11663
|
}
|
|
11664
|
+
if (isLogicalGroupSelection && isValidLogicalGroupFrame(effectivePreferredGroupFrame) && targetAngle != null) {
|
|
11665
|
+
const contentFrame = orientedFrameFromWorldPoints(worldPoints, targetAngle);
|
|
11666
|
+
if (shouldRepairUnrotatedLogicalGroupFrame(effectivePreferredGroupFrame, contentFrame, targetAngle)) {
|
|
11667
|
+
effectivePreferredGroupFrame = contentFrame;
|
|
11668
|
+
} else if (!logicalFrameContainsWorldCenters(effectivePreferredGroupFrame, targetAngle, collectFabricObjectWorldCenters(kids))) {
|
|
11669
|
+
effectivePreferredGroupFrame = null;
|
|
11670
|
+
}
|
|
11671
|
+
}
|
|
11527
11672
|
if (targetAngle != null) {
|
|
11528
11673
|
const restoreKidsFromWorld = () => {
|
|
11529
11674
|
const invSelection = fabric__namespace.util.invertTransform(
|
|
@@ -11562,7 +11707,7 @@ function applyWarpAwareSelectionBorders(selection, preferredGroupAngle, preferre
|
|
|
11562
11707
|
targetAngle,
|
|
11563
11708
|
worldAngles
|
|
11564
11709
|
});
|
|
11565
|
-
const fixedFrame =
|
|
11710
|
+
const fixedFrame = effectivePreferredGroupFrame && Number.isFinite(effectivePreferredGroupFrame.left) && Number.isFinite(effectivePreferredGroupFrame.top) && Number.isFinite(effectivePreferredGroupFrame.width) && effectivePreferredGroupFrame.width > 0 && Number.isFinite(effectivePreferredGroupFrame.height) && effectivePreferredGroupFrame.height > 0 ? effectivePreferredGroupFrame : null;
|
|
11566
11711
|
selection.set({ angle: targetAngle, scaleX: 1, scaleY: 1, skewX: 0, skewY: 0 });
|
|
11567
11712
|
if (fixedFrame) {
|
|
11568
11713
|
selection.set({ width: fixedFrame.width, height: fixedFrame.height, originX: "center", originY: "center" });
|
|
@@ -11680,11 +11825,18 @@ const PageCanvas = react.forwardRef(
|
|
|
11680
11825
|
const pageNow = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId);
|
|
11681
11826
|
const groupNode = pageNow ? findNodeById(pageNow.children ?? [], groupId) : null;
|
|
11682
11827
|
let groupAngle = groupNode && isGroup(groupNode) && typeof groupNode.angle === "number" ? groupNode.angle : void 0;
|
|
11828
|
+
const members = selection.getObjects();
|
|
11829
|
+
if (groupAngle === void 0 && groupNode && isGroup(groupNode)) {
|
|
11830
|
+
const storedW = Number(groupNode.width);
|
|
11831
|
+
const storedH = Number(groupNode.height);
|
|
11832
|
+
if (storedW > 0 && storedH > 0) {
|
|
11833
|
+
groupAngle = 0;
|
|
11834
|
+
}
|
|
11835
|
+
}
|
|
11683
11836
|
if (groupAngle === void 0 && groupNode && isGroup(groupNode)) {
|
|
11684
11837
|
try {
|
|
11685
|
-
const kids = selection.getObjects();
|
|
11686
11838
|
const selectionMatrix = selection.calcTransformMatrix();
|
|
11687
|
-
const worldAngles =
|
|
11839
|
+
const worldAngles = members.map((kid) => normalizeAngle180(fabric__namespace.util.qrDecompose(
|
|
11688
11840
|
fabric__namespace.util.multiplyTransformMatrices(
|
|
11689
11841
|
selectionMatrix,
|
|
11690
11842
|
kid.calcOwnMatrix()
|
|
@@ -11700,15 +11852,50 @@ const PageCanvas = react.forwardRef(
|
|
|
11700
11852
|
const inferredAngle = (_a2 = buckets[0]) == null ? void 0 : _a2.angle;
|
|
11701
11853
|
if (typeof inferredAngle === "number" && Number.isFinite(inferredAngle) && Math.abs(inferredAngle) > 0.01) {
|
|
11702
11854
|
groupAngle = inferredAngle;
|
|
11703
|
-
useEditorStore.getState().updateNode(
|
|
11704
|
-
groupId,
|
|
11705
|
-
{ angle: inferredAngle },
|
|
11706
|
-
{ recordHistory: false, skipLayoutRecalc: true }
|
|
11707
|
-
);
|
|
11708
11855
|
}
|
|
11709
11856
|
} catch {
|
|
11710
11857
|
}
|
|
11711
11858
|
}
|
|
11859
|
+
let groupFrame = groupNode && isGroup(groupNode) ? frameFromStoredGroupNode(groupNode, (pageNow == null ? void 0 : pageNow.children) ?? []) : null;
|
|
11860
|
+
let groupFrameWasInferred = false;
|
|
11861
|
+
const memberWorldPoints = collectFabricObjectWorldPoints(members);
|
|
11862
|
+
const memberWorldCenters = collectFabricObjectWorldCenters(members);
|
|
11863
|
+
const contentFrame = typeof groupAngle === "number" && Number.isFinite(groupAngle) ? orientedFrameFromWorldPoints(memberWorldPoints, normalizeAngle180(groupAngle)) : null;
|
|
11864
|
+
if (shouldRepairUnrotatedLogicalGroupFrame(groupFrame, contentFrame, groupAngle)) {
|
|
11865
|
+
groupFrame = contentFrame;
|
|
11866
|
+
groupFrameWasInferred = true;
|
|
11867
|
+
} else if (groupFrame && !logicalFrameContainsWorldCenters(groupFrame, groupAngle, memberWorldCenters)) {
|
|
11868
|
+
groupFrame = null;
|
|
11869
|
+
}
|
|
11870
|
+
if (!groupFrame && groupNode && isGroup(groupNode) && typeof groupAngle === "number" && Number.isFinite(groupAngle)) {
|
|
11871
|
+
groupFrame = contentFrame ?? orientedFrameFromWorldPoints(memberWorldPoints, normalizeAngle180(groupAngle));
|
|
11872
|
+
groupFrameWasInferred = isValidLogicalGroupFrame(groupFrame);
|
|
11873
|
+
}
|
|
11874
|
+
if (groupNode && isGroup(groupNode)) {
|
|
11875
|
+
const updates = {};
|
|
11876
|
+
if (typeof groupAngle === "number" && Number.isFinite(groupAngle)) {
|
|
11877
|
+
const prevAngle = typeof groupNode.angle === "number" ? groupNode.angle : void 0;
|
|
11878
|
+
if (prevAngle === void 0 || Math.abs(normalizeAngle180(prevAngle - groupAngle)) > 0.01) {
|
|
11879
|
+
updates.angle = normalizeAngle180(groupAngle);
|
|
11880
|
+
}
|
|
11881
|
+
}
|
|
11882
|
+
if (isValidLogicalGroupFrame(groupFrame)) {
|
|
11883
|
+
const prevW = Number(groupNode.width);
|
|
11884
|
+
const prevH = Number(groupNode.height);
|
|
11885
|
+
if (!Number.isFinite(prevW) || Math.abs(prevW - groupFrame.width) > 0.5) updates.width = groupFrame.width;
|
|
11886
|
+
if (!Number.isFinite(prevH) || Math.abs(prevH - groupFrame.height) > 0.5) updates.height = groupFrame.height;
|
|
11887
|
+
if (groupFrameWasInferred) {
|
|
11888
|
+
const storePos = absoluteToStorePosition(groupFrame.left, groupFrame.top, groupId, (pageNow == null ? void 0 : pageNow.children) ?? []);
|
|
11889
|
+
const prevLeft = Number(groupNode.left ?? 0);
|
|
11890
|
+
const prevTop = Number(groupNode.top ?? 0);
|
|
11891
|
+
if (!Number.isFinite(prevLeft) || Math.abs(prevLeft - storePos.left) > 0.5) updates.left = storePos.left;
|
|
11892
|
+
if (!Number.isFinite(prevTop) || Math.abs(prevTop - storePos.top) > 0.5) updates.top = storePos.top;
|
|
11893
|
+
}
|
|
11894
|
+
}
|
|
11895
|
+
if (Object.keys(updates).length > 0) {
|
|
11896
|
+
useEditorStore.getState().updateNode(groupId, updates, { recordHistory: false, skipLayoutRecalc: true });
|
|
11897
|
+
}
|
|
11898
|
+
}
|
|
11712
11899
|
if (groupAngle !== void 0) {
|
|
11713
11900
|
selection.__pixldocsGroupAngle = groupAngle;
|
|
11714
11901
|
const aligned = selection.__pixldocsAlignedAngle;
|
|
@@ -11719,7 +11906,6 @@ const PageCanvas = react.forwardRef(
|
|
|
11719
11906
|
delete selection.__pixldocsGroupAngle;
|
|
11720
11907
|
}
|
|
11721
11908
|
selection.hasBorders = true;
|
|
11722
|
-
const members = selection.getObjects();
|
|
11723
11909
|
for (const prev of suppressGroupMemberBordersRef.current) {
|
|
11724
11910
|
if (members.includes(prev)) continue;
|
|
11725
11911
|
const origBorders = prev.__pixldocsOrigHasBorders;
|
|
@@ -11751,21 +11937,6 @@ const PageCanvas = react.forwardRef(
|
|
|
11751
11937
|
m.lockScalingY = false;
|
|
11752
11938
|
}
|
|
11753
11939
|
}
|
|
11754
|
-
const groupFrame = groupNode && isGroup(groupNode) ? (() => {
|
|
11755
|
-
try {
|
|
11756
|
-
const abs = getAbsoluteBounds(groupNode, (pageNow == null ? void 0 : pageNow.children) ?? []);
|
|
11757
|
-
const storedW = Number(groupNode.width);
|
|
11758
|
-
const storedH = Number(groupNode.height);
|
|
11759
|
-
return {
|
|
11760
|
-
left: abs.left,
|
|
11761
|
-
top: abs.top,
|
|
11762
|
-
width: Number.isFinite(storedW) && storedW > 0 ? storedW : abs.width,
|
|
11763
|
-
height: Number.isFinite(storedH) && storedH > 0 ? storedH : abs.height
|
|
11764
|
-
};
|
|
11765
|
-
} catch {
|
|
11766
|
-
return null;
|
|
11767
|
-
}
|
|
11768
|
-
})() : null;
|
|
11769
11940
|
applyWarpAwareSelectionBorders(selection, groupAngle, groupFrame);
|
|
11770
11941
|
}, [pageId]);
|
|
11771
11942
|
const pageBoundsOptions = react.useMemo(
|
|
@@ -13334,16 +13505,18 @@ const PageCanvas = react.forwardRef(
|
|
|
13334
13505
|
const groupNode = findNodeById(pageChildren2, groupId);
|
|
13335
13506
|
if (!groupNode) return;
|
|
13336
13507
|
const groupAbs = getAbsoluteBounds(groupNode, pageChildren2);
|
|
13508
|
+
const storedGroupFrame = groupNode && isGroup(groupNode) ? frameFromStoredGroupNode(groupNode, pageChildren2, pageBoundsOptions) : null;
|
|
13509
|
+
const groupFrame = storedGroupFrame ?? groupAbs;
|
|
13337
13510
|
const rect = active.getBoundingRect();
|
|
13338
13511
|
groupSelectionTransformStartRef.current = {
|
|
13339
13512
|
groupId,
|
|
13340
13513
|
selection: active,
|
|
13341
13514
|
selectionLeft: rect.left,
|
|
13342
13515
|
selectionTop: rect.top,
|
|
13343
|
-
groupLeft:
|
|
13344
|
-
groupTop:
|
|
13345
|
-
groupWidth:
|
|
13346
|
-
groupHeight:
|
|
13516
|
+
groupLeft: groupFrame.left,
|
|
13517
|
+
groupTop: groupFrame.top,
|
|
13518
|
+
groupWidth: groupFrame.width,
|
|
13519
|
+
groupHeight: groupFrame.height,
|
|
13347
13520
|
selectionAngle: ((active.angle ?? 0) % 360 + 360) % 360
|
|
13348
13521
|
};
|
|
13349
13522
|
logRotDriftSelectionSnapshot("transform-start", active, {
|
|
@@ -15480,13 +15653,37 @@ const PageCanvas = react.forwardRef(
|
|
|
15480
15653
|
360 - Math.abs(currentSelAngle - startSelAngle)
|
|
15481
15654
|
);
|
|
15482
15655
|
const hadRotation = isActiveSelection && activeObj && angleDelta > 0.01;
|
|
15483
|
-
if (hadRotation && activeObj instanceof fabric__namespace.ActiveSelection && activeGroupSelectionId === groupToMove.id) {
|
|
15484
|
-
|
|
15485
|
-
|
|
15486
|
-
|
|
15487
|
-
|
|
15488
|
-
|
|
15489
|
-
|
|
15656
|
+
if ((hadScale || hadRotation) && activeObj instanceof fabric__namespace.ActiveSelection && activeGroupSelectionId === groupToMove.id) {
|
|
15657
|
+
const groupTransformUpdates = {};
|
|
15658
|
+
if (hadRotation) {
|
|
15659
|
+
groupTransformUpdates.angle = normalizeAngle180(currentSelAngle);
|
|
15660
|
+
activeObj.__pixldocsGroupAngle = groupTransformUpdates.angle;
|
|
15661
|
+
}
|
|
15662
|
+
if (hadScale && (transformStart == null ? void 0 : transformStart.groupId) === groupToMove.id) {
|
|
15663
|
+
const center = activeObj.getCenterPoint();
|
|
15664
|
+
const nextWidth = Math.max(1, transformStart.groupWidth * Math.abs(activeObj.scaleX ?? 1));
|
|
15665
|
+
const nextHeight = Math.max(1, transformStart.groupHeight * Math.abs(activeObj.scaleY ?? 1));
|
|
15666
|
+
const storePos = absoluteToStorePosition(
|
|
15667
|
+
center.x - nextWidth / 2,
|
|
15668
|
+
center.y - nextHeight / 2,
|
|
15669
|
+
groupToMove.id,
|
|
15670
|
+
pageChildren2
|
|
15671
|
+
);
|
|
15672
|
+
groupTransformUpdates.left = storePos.left;
|
|
15673
|
+
groupTransformUpdates.top = storePos.top;
|
|
15674
|
+
groupTransformUpdates.width = nextWidth;
|
|
15675
|
+
groupTransformUpdates.height = nextHeight;
|
|
15676
|
+
} else if (!Number.isFinite(Number(groupToMove.width)) || !Number.isFinite(Number(groupToMove.height))) {
|
|
15677
|
+
groupTransformUpdates.width = (transformStart == null ? void 0 : transformStart.groupWidth) ?? groupAbs.width;
|
|
15678
|
+
groupTransformUpdates.height = (transformStart == null ? void 0 : transformStart.groupHeight) ?? groupAbs.height;
|
|
15679
|
+
}
|
|
15680
|
+
if (Object.keys(groupTransformUpdates).length > 0) {
|
|
15681
|
+
useEditorStore.getState().updateNode(
|
|
15682
|
+
groupToMove.id,
|
|
15683
|
+
groupTransformUpdates,
|
|
15684
|
+
{ recordHistory: false, skipLayoutRecalc: true }
|
|
15685
|
+
);
|
|
15686
|
+
}
|
|
15490
15687
|
}
|
|
15491
15688
|
if (!hadScale && !hadRotation && (Math.abs(deltaX) > 0.1 || Math.abs(deltaY) > 0.1)) {
|
|
15492
15689
|
const { updateNode: updateNodeStore, commitHistory: commitHistoryStore, getCurrentElements } = useEditorStore.getState();
|
|
@@ -25240,9 +25437,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
25240
25437
|
}
|
|
25241
25438
|
return svgString;
|
|
25242
25439
|
}
|
|
25243
|
-
const resolvedPackageVersion = "0.5.
|
|
25440
|
+
const resolvedPackageVersion = "0.5.397";
|
|
25244
25441
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
25245
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
25442
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.397";
|
|
25246
25443
|
const roundParityValue = (value) => {
|
|
25247
25444
|
if (typeof value !== "number") return value;
|
|
25248
25445
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -26056,7 +26253,7 @@ class PixldocsRenderer {
|
|
|
26056
26253
|
await this.waitForCanvasScene(container, cloned, i);
|
|
26057
26254
|
}
|
|
26058
26255
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
26059
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
26256
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-o6mqay90.cjs"));
|
|
26060
26257
|
const prepared = preparePagesForExport(
|
|
26061
26258
|
cloned.pages,
|
|
26062
26259
|
canvasWidth,
|
|
@@ -28376,7 +28573,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
28376
28573
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
28377
28574
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
28378
28575
|
try {
|
|
28379
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
28576
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-o6mqay90.cjs"));
|
|
28380
28577
|
try {
|
|
28381
28578
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
28382
28579
|
} catch {
|
|
@@ -28773,4 +28970,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
28773
28970
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
28774
28971
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
28775
28972
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
28776
|
-
//# sourceMappingURL=index-
|
|
28973
|
+
//# sourceMappingURL=index-BgYo0VtS.cjs.map
|