@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
|
@@ -107,6 +107,7 @@ const createDefaultGroup = (partial) => ({
|
|
|
107
107
|
locked: false,
|
|
108
108
|
left: 0,
|
|
109
109
|
top: 0,
|
|
110
|
+
angle: 0,
|
|
110
111
|
...partial
|
|
111
112
|
});
|
|
112
113
|
const PAGE_BACKGROUND_ELEMENT_ID = "__pageBackground__";
|
|
@@ -829,9 +830,17 @@ function getNodeBounds(node, pageChildren, options) {
|
|
|
829
830
|
let width;
|
|
830
831
|
let height;
|
|
831
832
|
if (isGroup(node) && (pageChildren == null ? void 0 : pageChildren.length) !== void 0) {
|
|
832
|
-
const
|
|
833
|
-
|
|
834
|
-
|
|
833
|
+
const group = node;
|
|
834
|
+
const storedWidth = Number(group.width);
|
|
835
|
+
const storedHeight = Number(group.height);
|
|
836
|
+
if (!isStackLayoutMode(group.layoutMode) && storedWidth > 0 && storedHeight > 0) {
|
|
837
|
+
width = storedWidth;
|
|
838
|
+
height = storedHeight;
|
|
839
|
+
} else {
|
|
840
|
+
const size = groupBoundsFromChildren(group, pageChildren ?? []);
|
|
841
|
+
width = size.width;
|
|
842
|
+
height = size.height;
|
|
843
|
+
}
|
|
835
844
|
} else {
|
|
836
845
|
width = simpleWidth(node);
|
|
837
846
|
height = simpleHeight(node);
|
|
@@ -10506,6 +10515,115 @@ const normalizeAngle180 = (angle) => {
|
|
|
10506
10515
|
const n = (angle % 360 + 360) % 360;
|
|
10507
10516
|
return n > 180 ? n - 360 : n;
|
|
10508
10517
|
};
|
|
10518
|
+
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;
|
|
10519
|
+
const frameFromStoredGroupNode = (group, pageChildren, options) => {
|
|
10520
|
+
const width = Number(group.width);
|
|
10521
|
+
const height = Number(group.height);
|
|
10522
|
+
if (!Number.isFinite(width) || width <= 0 || !Number.isFinite(height) || height <= 0) return null;
|
|
10523
|
+
try {
|
|
10524
|
+
const abs = getAbsoluteBounds(group, pageChildren, options);
|
|
10525
|
+
return { left: abs.left, top: abs.top, width, height };
|
|
10526
|
+
} catch {
|
|
10527
|
+
return null;
|
|
10528
|
+
}
|
|
10529
|
+
};
|
|
10530
|
+
const orientedFrameFromWorldPoints = (points, angle) => {
|
|
10531
|
+
if (points.length === 0 || !Number.isFinite(angle)) return null;
|
|
10532
|
+
const rad = -angle * Math.PI / 180;
|
|
10533
|
+
const cos = Math.cos(rad);
|
|
10534
|
+
const sin = Math.sin(rad);
|
|
10535
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
10536
|
+
for (const p of points) {
|
|
10537
|
+
const xr = p.x * cos - p.y * sin;
|
|
10538
|
+
const yr = p.x * sin + p.y * cos;
|
|
10539
|
+
minX = Math.min(minX, xr);
|
|
10540
|
+
minY = Math.min(minY, yr);
|
|
10541
|
+
maxX = Math.max(maxX, xr);
|
|
10542
|
+
maxY = Math.max(maxY, yr);
|
|
10543
|
+
}
|
|
10544
|
+
if (![minX, minY, maxX, maxY].every(Number.isFinite)) return null;
|
|
10545
|
+
const width = Math.max(1, maxX - minX);
|
|
10546
|
+
const height = Math.max(1, maxY - minY);
|
|
10547
|
+
const centerXRot = minX + width / 2;
|
|
10548
|
+
const centerYRot = minY + height / 2;
|
|
10549
|
+
const back = angle * Math.PI / 180;
|
|
10550
|
+
const c = Math.cos(back);
|
|
10551
|
+
const s = Math.sin(back);
|
|
10552
|
+
const centerX = centerXRot * c - centerYRot * s;
|
|
10553
|
+
const centerY = centerXRot * s + centerYRot * c;
|
|
10554
|
+
return { left: centerX - width / 2, top: centerY - height / 2, width, height };
|
|
10555
|
+
};
|
|
10556
|
+
const collectFabricObjectWorldPoints = (objects) => {
|
|
10557
|
+
const points = [];
|
|
10558
|
+
for (const obj of objects) {
|
|
10559
|
+
try {
|
|
10560
|
+
obj.setCoords();
|
|
10561
|
+
} catch {
|
|
10562
|
+
}
|
|
10563
|
+
const coords = typeof obj.getCoords === "function" ? obj.getCoords() : null;
|
|
10564
|
+
if (Array.isArray(coords) && coords.length) {
|
|
10565
|
+
points.push(...coords.map((p) => ({ x: p.x, y: p.y })));
|
|
10566
|
+
continue;
|
|
10567
|
+
}
|
|
10568
|
+
const aC = obj.aCoords;
|
|
10569
|
+
if (!aC) continue;
|
|
10570
|
+
for (const key of ["tl", "tr", "br", "bl"]) {
|
|
10571
|
+
const p = aC[key];
|
|
10572
|
+
if (p) points.push({ x: p.x, y: p.y });
|
|
10573
|
+
}
|
|
10574
|
+
}
|
|
10575
|
+
return points;
|
|
10576
|
+
};
|
|
10577
|
+
const collectFabricObjectWorldCenters = (objects) => {
|
|
10578
|
+
var _a2;
|
|
10579
|
+
const centers = [];
|
|
10580
|
+
for (const obj of objects) {
|
|
10581
|
+
try {
|
|
10582
|
+
obj.setCoords();
|
|
10583
|
+
} catch {
|
|
10584
|
+
}
|
|
10585
|
+
const coords = typeof obj.getCoords === "function" ? obj.getCoords() : null;
|
|
10586
|
+
if (Array.isArray(coords) && coords.length >= 4) {
|
|
10587
|
+
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));
|
|
10588
|
+
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 });
|
|
10589
|
+
continue;
|
|
10590
|
+
}
|
|
10591
|
+
try {
|
|
10592
|
+
const center = (_a2 = obj.getCenterPoint) == null ? void 0 : _a2.call(obj);
|
|
10593
|
+
if (center && Number.isFinite(center.x) && Number.isFinite(center.y)) centers.push({ x: center.x, y: center.y });
|
|
10594
|
+
} catch {
|
|
10595
|
+
}
|
|
10596
|
+
}
|
|
10597
|
+
return centers;
|
|
10598
|
+
};
|
|
10599
|
+
const logicalFrameContainsWorldCenters = (frame, angle, centers) => {
|
|
10600
|
+
if (!isValidLogicalGroupFrame(frame) || centers.length === 0) return true;
|
|
10601
|
+
const a = typeof angle === "number" && Number.isFinite(angle) ? normalizeAngle180(angle) : 0;
|
|
10602
|
+
const cx = frame.left + frame.width / 2;
|
|
10603
|
+
const cy = frame.top + frame.height / 2;
|
|
10604
|
+
const rad = -a * Math.PI / 180;
|
|
10605
|
+
const c = Math.cos(rad);
|
|
10606
|
+
const s = Math.sin(rad);
|
|
10607
|
+
const tolerance = Math.max(8, Math.min(frame.width, frame.height) * 0.08);
|
|
10608
|
+
return centers.every((p) => {
|
|
10609
|
+
const dx = p.x - cx;
|
|
10610
|
+
const dy = p.y - cy;
|
|
10611
|
+
const localX = cx + dx * c - dy * s;
|
|
10612
|
+
const localY = cy + dx * s + dy * c;
|
|
10613
|
+
return localX >= frame.left - tolerance && localX <= frame.left + frame.width + tolerance && localY >= frame.top - tolerance && localY <= frame.top + frame.height + tolerance;
|
|
10614
|
+
});
|
|
10615
|
+
};
|
|
10616
|
+
const shouldRepairUnrotatedLogicalGroupFrame = (storedFrame, contentFrame, angle) => {
|
|
10617
|
+
if (!isValidLogicalGroupFrame(storedFrame) || !isValidLogicalGroupFrame(contentFrame)) return false;
|
|
10618
|
+
if (Math.abs(normalizeAngle180(typeof angle === "number" && Number.isFinite(angle) ? angle : 0)) > 0.5) return false;
|
|
10619
|
+
const storedArea = storedFrame.width * storedFrame.height;
|
|
10620
|
+
const contentArea = contentFrame.width * contentFrame.height;
|
|
10621
|
+
const areaRatio = storedArea / Math.max(1, contentArea);
|
|
10622
|
+
const dx = Math.abs(storedFrame.left + storedFrame.width / 2 - (contentFrame.left + contentFrame.width / 2));
|
|
10623
|
+
const dy = Math.abs(storedFrame.top + storedFrame.height / 2 - (contentFrame.top + contentFrame.height / 2));
|
|
10624
|
+
const driftTolerance = Math.max(12, Math.min(storedFrame.width, storedFrame.height) * 0.08);
|
|
10625
|
+
return areaRatio > 1.35 || dx > driftTolerance || dy > driftTolerance;
|
|
10626
|
+
};
|
|
10509
10627
|
let ensureCanvaControlRenders = () => {
|
|
10510
10628
|
};
|
|
10511
10629
|
try {
|
|
@@ -11499,13 +11617,40 @@ function applyWarpAwareSelectionBorders(selection, preferredGroupAngle, preferre
|
|
|
11499
11617
|
for (const b of buckets) b.area = orientedAreaForAngle(b.angle);
|
|
11500
11618
|
buckets.sort((a, b) => b.count - a.count || a.area - b.area || Math.abs(b.angle) - Math.abs(a.angle));
|
|
11501
11619
|
const dominant = buckets[0];
|
|
11502
|
-
|
|
11620
|
+
let effectivePreferredGroupAngle = preferredGroupAngle;
|
|
11621
|
+
let effectivePreferredGroupFrame = preferredGroupFrame;
|
|
11622
|
+
const logicalGroupId = selection.__pixldocsGroupSelection;
|
|
11623
|
+
if (logicalGroupId && (!(typeof effectivePreferredGroupAngle === "number" && Number.isFinite(effectivePreferredGroupAngle)) || !isValidLogicalGroupFrame(effectivePreferredGroupFrame))) {
|
|
11624
|
+
try {
|
|
11625
|
+
const stateNow = useEditorStore.getState();
|
|
11626
|
+
const pageNow = stateNow.canvas.pages.find((p) => p.id === stateNow.canvas.currentPageId);
|
|
11627
|
+
const groupNode = pageNow ? findNodeById(pageNow.children ?? [], logicalGroupId) : null;
|
|
11628
|
+
if (groupNode && isGroup(groupNode)) {
|
|
11629
|
+
if (!(typeof effectivePreferredGroupAngle === "number" && Number.isFinite(effectivePreferredGroupAngle)) && typeof groupNode.angle === "number") {
|
|
11630
|
+
effectivePreferredGroupAngle = groupNode.angle;
|
|
11631
|
+
}
|
|
11632
|
+
if (!isValidLogicalGroupFrame(effectivePreferredGroupFrame)) {
|
|
11633
|
+
effectivePreferredGroupFrame = frameFromStoredGroupNode(groupNode, (pageNow == null ? void 0 : pageNow.children) ?? []);
|
|
11634
|
+
}
|
|
11635
|
+
}
|
|
11636
|
+
} catch {
|
|
11637
|
+
}
|
|
11638
|
+
}
|
|
11639
|
+
const rawPreferredGroupAngle = typeof effectivePreferredGroupAngle === "number" && Number.isFinite(effectivePreferredGroupAngle) ? effectivePreferredGroupAngle : typeof selection.__pixldocsGroupAngle === "number" && Number.isFinite(selection.__pixldocsGroupAngle) ? selection.__pixldocsGroupAngle : null;
|
|
11503
11640
|
const preferredAngle = rawPreferredGroupAngle != null ? normalizeAngle180(rawPreferredGroupAngle) : null;
|
|
11504
11641
|
let targetAngle = preferredAngle;
|
|
11505
|
-
const isLogicalGroupSelection = !!
|
|
11642
|
+
const isLogicalGroupSelection = !!logicalGroupId;
|
|
11506
11643
|
if (targetAngle == null && dominant && Math.abs(dominant.angle) > 0.5 && (isLogicalGroupSelection || kids.length === 1 || dominant.count >= 2 || dominant.count === kids.length)) {
|
|
11507
11644
|
targetAngle = dominant.angle;
|
|
11508
11645
|
}
|
|
11646
|
+
if (isLogicalGroupSelection && isValidLogicalGroupFrame(effectivePreferredGroupFrame) && targetAngle != null) {
|
|
11647
|
+
const contentFrame = orientedFrameFromWorldPoints(worldPoints, targetAngle);
|
|
11648
|
+
if (shouldRepairUnrotatedLogicalGroupFrame(effectivePreferredGroupFrame, contentFrame, targetAngle)) {
|
|
11649
|
+
effectivePreferredGroupFrame = contentFrame;
|
|
11650
|
+
} else if (!logicalFrameContainsWorldCenters(effectivePreferredGroupFrame, targetAngle, collectFabricObjectWorldCenters(kids))) {
|
|
11651
|
+
effectivePreferredGroupFrame = null;
|
|
11652
|
+
}
|
|
11653
|
+
}
|
|
11509
11654
|
if (targetAngle != null) {
|
|
11510
11655
|
const restoreKidsFromWorld = () => {
|
|
11511
11656
|
const invSelection = fabric.util.invertTransform(
|
|
@@ -11544,7 +11689,7 @@ function applyWarpAwareSelectionBorders(selection, preferredGroupAngle, preferre
|
|
|
11544
11689
|
targetAngle,
|
|
11545
11690
|
worldAngles
|
|
11546
11691
|
});
|
|
11547
|
-
const fixedFrame =
|
|
11692
|
+
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;
|
|
11548
11693
|
selection.set({ angle: targetAngle, scaleX: 1, scaleY: 1, skewX: 0, skewY: 0 });
|
|
11549
11694
|
if (fixedFrame) {
|
|
11550
11695
|
selection.set({ width: fixedFrame.width, height: fixedFrame.height, originX: "center", originY: "center" });
|
|
@@ -11662,11 +11807,18 @@ const PageCanvas = forwardRef(
|
|
|
11662
11807
|
const pageNow = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId);
|
|
11663
11808
|
const groupNode = pageNow ? findNodeById(pageNow.children ?? [], groupId) : null;
|
|
11664
11809
|
let groupAngle = groupNode && isGroup(groupNode) && typeof groupNode.angle === "number" ? groupNode.angle : void 0;
|
|
11810
|
+
const members = selection.getObjects();
|
|
11811
|
+
if (groupAngle === void 0 && groupNode && isGroup(groupNode)) {
|
|
11812
|
+
const storedW = Number(groupNode.width);
|
|
11813
|
+
const storedH = Number(groupNode.height);
|
|
11814
|
+
if (storedW > 0 && storedH > 0) {
|
|
11815
|
+
groupAngle = 0;
|
|
11816
|
+
}
|
|
11817
|
+
}
|
|
11665
11818
|
if (groupAngle === void 0 && groupNode && isGroup(groupNode)) {
|
|
11666
11819
|
try {
|
|
11667
|
-
const kids = selection.getObjects();
|
|
11668
11820
|
const selectionMatrix = selection.calcTransformMatrix();
|
|
11669
|
-
const worldAngles =
|
|
11821
|
+
const worldAngles = members.map((kid) => normalizeAngle180(fabric.util.qrDecompose(
|
|
11670
11822
|
fabric.util.multiplyTransformMatrices(
|
|
11671
11823
|
selectionMatrix,
|
|
11672
11824
|
kid.calcOwnMatrix()
|
|
@@ -11682,15 +11834,50 @@ const PageCanvas = forwardRef(
|
|
|
11682
11834
|
const inferredAngle = (_a2 = buckets[0]) == null ? void 0 : _a2.angle;
|
|
11683
11835
|
if (typeof inferredAngle === "number" && Number.isFinite(inferredAngle) && Math.abs(inferredAngle) > 0.01) {
|
|
11684
11836
|
groupAngle = inferredAngle;
|
|
11685
|
-
useEditorStore.getState().updateNode(
|
|
11686
|
-
groupId,
|
|
11687
|
-
{ angle: inferredAngle },
|
|
11688
|
-
{ recordHistory: false, skipLayoutRecalc: true }
|
|
11689
|
-
);
|
|
11690
11837
|
}
|
|
11691
11838
|
} catch {
|
|
11692
11839
|
}
|
|
11693
11840
|
}
|
|
11841
|
+
let groupFrame = groupNode && isGroup(groupNode) ? frameFromStoredGroupNode(groupNode, (pageNow == null ? void 0 : pageNow.children) ?? []) : null;
|
|
11842
|
+
let groupFrameWasInferred = false;
|
|
11843
|
+
const memberWorldPoints = collectFabricObjectWorldPoints(members);
|
|
11844
|
+
const memberWorldCenters = collectFabricObjectWorldCenters(members);
|
|
11845
|
+
const contentFrame = typeof groupAngle === "number" && Number.isFinite(groupAngle) ? orientedFrameFromWorldPoints(memberWorldPoints, normalizeAngle180(groupAngle)) : null;
|
|
11846
|
+
if (shouldRepairUnrotatedLogicalGroupFrame(groupFrame, contentFrame, groupAngle)) {
|
|
11847
|
+
groupFrame = contentFrame;
|
|
11848
|
+
groupFrameWasInferred = true;
|
|
11849
|
+
} else if (groupFrame && !logicalFrameContainsWorldCenters(groupFrame, groupAngle, memberWorldCenters)) {
|
|
11850
|
+
groupFrame = null;
|
|
11851
|
+
}
|
|
11852
|
+
if (!groupFrame && groupNode && isGroup(groupNode) && typeof groupAngle === "number" && Number.isFinite(groupAngle)) {
|
|
11853
|
+
groupFrame = contentFrame ?? orientedFrameFromWorldPoints(memberWorldPoints, normalizeAngle180(groupAngle));
|
|
11854
|
+
groupFrameWasInferred = isValidLogicalGroupFrame(groupFrame);
|
|
11855
|
+
}
|
|
11856
|
+
if (groupNode && isGroup(groupNode)) {
|
|
11857
|
+
const updates = {};
|
|
11858
|
+
if (typeof groupAngle === "number" && Number.isFinite(groupAngle)) {
|
|
11859
|
+
const prevAngle = typeof groupNode.angle === "number" ? groupNode.angle : void 0;
|
|
11860
|
+
if (prevAngle === void 0 || Math.abs(normalizeAngle180(prevAngle - groupAngle)) > 0.01) {
|
|
11861
|
+
updates.angle = normalizeAngle180(groupAngle);
|
|
11862
|
+
}
|
|
11863
|
+
}
|
|
11864
|
+
if (isValidLogicalGroupFrame(groupFrame)) {
|
|
11865
|
+
const prevW = Number(groupNode.width);
|
|
11866
|
+
const prevH = Number(groupNode.height);
|
|
11867
|
+
if (!Number.isFinite(prevW) || Math.abs(prevW - groupFrame.width) > 0.5) updates.width = groupFrame.width;
|
|
11868
|
+
if (!Number.isFinite(prevH) || Math.abs(prevH - groupFrame.height) > 0.5) updates.height = groupFrame.height;
|
|
11869
|
+
if (groupFrameWasInferred) {
|
|
11870
|
+
const storePos = absoluteToStorePosition(groupFrame.left, groupFrame.top, groupId, (pageNow == null ? void 0 : pageNow.children) ?? []);
|
|
11871
|
+
const prevLeft = Number(groupNode.left ?? 0);
|
|
11872
|
+
const prevTop = Number(groupNode.top ?? 0);
|
|
11873
|
+
if (!Number.isFinite(prevLeft) || Math.abs(prevLeft - storePos.left) > 0.5) updates.left = storePos.left;
|
|
11874
|
+
if (!Number.isFinite(prevTop) || Math.abs(prevTop - storePos.top) > 0.5) updates.top = storePos.top;
|
|
11875
|
+
}
|
|
11876
|
+
}
|
|
11877
|
+
if (Object.keys(updates).length > 0) {
|
|
11878
|
+
useEditorStore.getState().updateNode(groupId, updates, { recordHistory: false, skipLayoutRecalc: true });
|
|
11879
|
+
}
|
|
11880
|
+
}
|
|
11694
11881
|
if (groupAngle !== void 0) {
|
|
11695
11882
|
selection.__pixldocsGroupAngle = groupAngle;
|
|
11696
11883
|
const aligned = selection.__pixldocsAlignedAngle;
|
|
@@ -11701,7 +11888,6 @@ const PageCanvas = forwardRef(
|
|
|
11701
11888
|
delete selection.__pixldocsGroupAngle;
|
|
11702
11889
|
}
|
|
11703
11890
|
selection.hasBorders = true;
|
|
11704
|
-
const members = selection.getObjects();
|
|
11705
11891
|
for (const prev of suppressGroupMemberBordersRef.current) {
|
|
11706
11892
|
if (members.includes(prev)) continue;
|
|
11707
11893
|
const origBorders = prev.__pixldocsOrigHasBorders;
|
|
@@ -11733,21 +11919,6 @@ const PageCanvas = forwardRef(
|
|
|
11733
11919
|
m.lockScalingY = false;
|
|
11734
11920
|
}
|
|
11735
11921
|
}
|
|
11736
|
-
const groupFrame = groupNode && isGroup(groupNode) ? (() => {
|
|
11737
|
-
try {
|
|
11738
|
-
const abs = getAbsoluteBounds(groupNode, (pageNow == null ? void 0 : pageNow.children) ?? []);
|
|
11739
|
-
const storedW = Number(groupNode.width);
|
|
11740
|
-
const storedH = Number(groupNode.height);
|
|
11741
|
-
return {
|
|
11742
|
-
left: abs.left,
|
|
11743
|
-
top: abs.top,
|
|
11744
|
-
width: Number.isFinite(storedW) && storedW > 0 ? storedW : abs.width,
|
|
11745
|
-
height: Number.isFinite(storedH) && storedH > 0 ? storedH : abs.height
|
|
11746
|
-
};
|
|
11747
|
-
} catch {
|
|
11748
|
-
return null;
|
|
11749
|
-
}
|
|
11750
|
-
})() : null;
|
|
11751
11922
|
applyWarpAwareSelectionBorders(selection, groupAngle, groupFrame);
|
|
11752
11923
|
}, [pageId]);
|
|
11753
11924
|
const pageBoundsOptions = useMemo(
|
|
@@ -13316,16 +13487,18 @@ const PageCanvas = forwardRef(
|
|
|
13316
13487
|
const groupNode = findNodeById(pageChildren2, groupId);
|
|
13317
13488
|
if (!groupNode) return;
|
|
13318
13489
|
const groupAbs = getAbsoluteBounds(groupNode, pageChildren2);
|
|
13490
|
+
const storedGroupFrame = groupNode && isGroup(groupNode) ? frameFromStoredGroupNode(groupNode, pageChildren2, pageBoundsOptions) : null;
|
|
13491
|
+
const groupFrame = storedGroupFrame ?? groupAbs;
|
|
13319
13492
|
const rect = active.getBoundingRect();
|
|
13320
13493
|
groupSelectionTransformStartRef.current = {
|
|
13321
13494
|
groupId,
|
|
13322
13495
|
selection: active,
|
|
13323
13496
|
selectionLeft: rect.left,
|
|
13324
13497
|
selectionTop: rect.top,
|
|
13325
|
-
groupLeft:
|
|
13326
|
-
groupTop:
|
|
13327
|
-
groupWidth:
|
|
13328
|
-
groupHeight:
|
|
13498
|
+
groupLeft: groupFrame.left,
|
|
13499
|
+
groupTop: groupFrame.top,
|
|
13500
|
+
groupWidth: groupFrame.width,
|
|
13501
|
+
groupHeight: groupFrame.height,
|
|
13329
13502
|
selectionAngle: ((active.angle ?? 0) % 360 + 360) % 360
|
|
13330
13503
|
};
|
|
13331
13504
|
logRotDriftSelectionSnapshot("transform-start", active, {
|
|
@@ -15462,13 +15635,37 @@ const PageCanvas = forwardRef(
|
|
|
15462
15635
|
360 - Math.abs(currentSelAngle - startSelAngle)
|
|
15463
15636
|
);
|
|
15464
15637
|
const hadRotation = isActiveSelection && activeObj && angleDelta > 0.01;
|
|
15465
|
-
if (hadRotation && activeObj instanceof fabric.ActiveSelection && activeGroupSelectionId === groupToMove.id) {
|
|
15466
|
-
|
|
15467
|
-
|
|
15468
|
-
|
|
15469
|
-
|
|
15470
|
-
|
|
15471
|
-
|
|
15638
|
+
if ((hadScale || hadRotation) && activeObj instanceof fabric.ActiveSelection && activeGroupSelectionId === groupToMove.id) {
|
|
15639
|
+
const groupTransformUpdates = {};
|
|
15640
|
+
if (hadRotation) {
|
|
15641
|
+
groupTransformUpdates.angle = normalizeAngle180(currentSelAngle);
|
|
15642
|
+
activeObj.__pixldocsGroupAngle = groupTransformUpdates.angle;
|
|
15643
|
+
}
|
|
15644
|
+
if (hadScale && (transformStart == null ? void 0 : transformStart.groupId) === groupToMove.id) {
|
|
15645
|
+
const center = activeObj.getCenterPoint();
|
|
15646
|
+
const nextWidth = Math.max(1, transformStart.groupWidth * Math.abs(activeObj.scaleX ?? 1));
|
|
15647
|
+
const nextHeight = Math.max(1, transformStart.groupHeight * Math.abs(activeObj.scaleY ?? 1));
|
|
15648
|
+
const storePos = absoluteToStorePosition(
|
|
15649
|
+
center.x - nextWidth / 2,
|
|
15650
|
+
center.y - nextHeight / 2,
|
|
15651
|
+
groupToMove.id,
|
|
15652
|
+
pageChildren2
|
|
15653
|
+
);
|
|
15654
|
+
groupTransformUpdates.left = storePos.left;
|
|
15655
|
+
groupTransformUpdates.top = storePos.top;
|
|
15656
|
+
groupTransformUpdates.width = nextWidth;
|
|
15657
|
+
groupTransformUpdates.height = nextHeight;
|
|
15658
|
+
} else if (!Number.isFinite(Number(groupToMove.width)) || !Number.isFinite(Number(groupToMove.height))) {
|
|
15659
|
+
groupTransformUpdates.width = (transformStart == null ? void 0 : transformStart.groupWidth) ?? groupAbs.width;
|
|
15660
|
+
groupTransformUpdates.height = (transformStart == null ? void 0 : transformStart.groupHeight) ?? groupAbs.height;
|
|
15661
|
+
}
|
|
15662
|
+
if (Object.keys(groupTransformUpdates).length > 0) {
|
|
15663
|
+
useEditorStore.getState().updateNode(
|
|
15664
|
+
groupToMove.id,
|
|
15665
|
+
groupTransformUpdates,
|
|
15666
|
+
{ recordHistory: false, skipLayoutRecalc: true }
|
|
15667
|
+
);
|
|
15668
|
+
}
|
|
15472
15669
|
}
|
|
15473
15670
|
if (!hadScale && !hadRotation && (Math.abs(deltaX) > 0.1 || Math.abs(deltaY) > 0.1)) {
|
|
15474
15671
|
const { updateNode: updateNodeStore, commitHistory: commitHistoryStore, getCurrentElements } = useEditorStore.getState();
|
|
@@ -25222,9 +25419,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
25222
25419
|
}
|
|
25223
25420
|
return svgString;
|
|
25224
25421
|
}
|
|
25225
|
-
const resolvedPackageVersion = "0.5.
|
|
25422
|
+
const resolvedPackageVersion = "0.5.397";
|
|
25226
25423
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
25227
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
25424
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.397";
|
|
25228
25425
|
const roundParityValue = (value) => {
|
|
25229
25426
|
if (typeof value !== "number") return value;
|
|
25230
25427
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -26038,7 +26235,7 @@ class PixldocsRenderer {
|
|
|
26038
26235
|
await this.waitForCanvasScene(container, cloned, i);
|
|
26039
26236
|
}
|
|
26040
26237
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
26041
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
26238
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-EYMFI-uk.js");
|
|
26042
26239
|
const prepared = preparePagesForExport(
|
|
26043
26240
|
cloned.pages,
|
|
26044
26241
|
canvasWidth,
|
|
@@ -28358,7 +28555,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
28358
28555
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
28359
28556
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
28360
28557
|
try {
|
|
28361
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
28558
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-EYMFI-uk.js");
|
|
28362
28559
|
try {
|
|
28363
28560
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
28364
28561
|
} catch {
|
|
@@ -28758,4 +28955,4 @@ export {
|
|
|
28758
28955
|
buildTeaserBlurFlatKeys as y,
|
|
28759
28956
|
collectFontDescriptorsFromConfig as z
|
|
28760
28957
|
};
|
|
28761
|
-
//# sourceMappingURL=index-
|
|
28958
|
+
//# sourceMappingURL=index-CqOZyZpi.js.map
|