@pixldocs/canvas-renderer 0.5.337 → 0.5.339
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-Ze4pswgN.cjs → index-BLwO7N0h.cjs} +58 -15
- package/dist/index-BLwO7N0h.cjs.map +1 -0
- package/dist/{index-B5OFG6Dl.js → index-DFhDFJ4X.js} +58 -15
- package/dist/index-DFhDFJ4X.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-11EJIk-M.cjs → vectorPdfExport-Dh2REogs.cjs} +4 -4
- package/dist/{vectorPdfExport-11EJIk-M.cjs.map → vectorPdfExport-Dh2REogs.cjs.map} +1 -1
- package/dist/{vectorPdfExport-CpYoH5k1.js → vectorPdfExport-GeBepP7g.js} +4 -4
- package/dist/{vectorPdfExport-CpYoH5k1.js.map → vectorPdfExport-GeBepP7g.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-B5OFG6Dl.js.map +0 -1
- package/dist/index-Ze4pswgN.cjs.map +0 -1
|
@@ -11342,10 +11342,20 @@ const PageCanvas = forwardRef(
|
|
|
11342
11342
|
const [ready, setReady] = useState(false);
|
|
11343
11343
|
const [unlockRequestId, setUnlockRequestId] = useState(0);
|
|
11344
11344
|
const applyLogicalGroupSelectionVisualState = useCallback((selection, groupId) => {
|
|
11345
|
-
var _a2;
|
|
11345
|
+
var _a2, _b2;
|
|
11346
11346
|
selection.__pixldocsGroupSelection = groupId;
|
|
11347
11347
|
delete selection.__pixldocsLogicalGroupIds;
|
|
11348
11348
|
selection.hasBorders = true;
|
|
11349
|
+
try {
|
|
11350
|
+
const pageChildren2 = ((_a2 = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _a2.children) ?? [];
|
|
11351
|
+
const groupNode = findNodeById(pageChildren2, groupId);
|
|
11352
|
+
const groupAngle = groupNode && isGroup(groupNode) ? Number(groupNode.angle ?? 0) : 0;
|
|
11353
|
+
if (Number.isFinite(groupAngle) && Math.abs(groupAngle) > 0.01) {
|
|
11354
|
+
selection.set({ angle: groupAngle, scaleX: 1, scaleY: 1, skewX: 0, skewY: 0 });
|
|
11355
|
+
selection.setCoords();
|
|
11356
|
+
}
|
|
11357
|
+
} catch {
|
|
11358
|
+
}
|
|
11349
11359
|
const members = selection.getObjects();
|
|
11350
11360
|
for (const prev of suppressGroupMemberBordersRef.current) {
|
|
11351
11361
|
if (members.includes(prev)) continue;
|
|
@@ -11369,7 +11379,7 @@ const PageCanvas = forwardRef(
|
|
|
11369
11379
|
if (m.__pixldocsOrigHasControls === void 0) m.__pixldocsOrigHasControls = m.hasControls;
|
|
11370
11380
|
m.hasBorders = false;
|
|
11371
11381
|
m.hasControls = false;
|
|
11372
|
-
if (m.__cropGroup || ((
|
|
11382
|
+
if (m.__cropGroup || ((_b2 = m._ct) == null ? void 0 : _b2.isCropGroup)) {
|
|
11373
11383
|
if (m.__pixldocsOrigLockScalingX === void 0) {
|
|
11374
11384
|
m.__pixldocsOrigLockScalingX = m.lockScalingX;
|
|
11375
11385
|
m.__pixldocsOrigLockScalingY = m.lockScalingY;
|
|
@@ -11379,7 +11389,7 @@ const PageCanvas = forwardRef(
|
|
|
11379
11389
|
}
|
|
11380
11390
|
}
|
|
11381
11391
|
applyWarpAwareSelectionBorders(selection);
|
|
11382
|
-
}, []);
|
|
11392
|
+
}, [pageId]);
|
|
11383
11393
|
const pageBoundsOptions = useMemo(
|
|
11384
11394
|
() => ({ pageContentWidth: canvasWidth, pageContentHeight: canvasHeight }),
|
|
11385
11395
|
[canvasWidth, canvasHeight]
|
|
@@ -13565,6 +13575,7 @@ const PageCanvas = forwardRef(
|
|
|
13565
13575
|
});
|
|
13566
13576
|
const markSimpleTransform = (e) => {
|
|
13567
13577
|
if (!isActiveRef.current) return;
|
|
13578
|
+
prepareGroupSelectionTransformStart(e.target);
|
|
13568
13579
|
markTransforming(e.target);
|
|
13569
13580
|
};
|
|
13570
13581
|
const getObjectFrameBoundsInSelection = (selection, obj, frameWidth, frameHeight) => {
|
|
@@ -14822,6 +14833,11 @@ const PageCanvas = forwardRef(
|
|
|
14822
14833
|
}
|
|
14823
14834
|
}
|
|
14824
14835
|
const isActiveSelectionSideResize = isActiveSelection && (activeSelectionResizeHandle === "ml" || activeSelectionResizeHandle === "mr" || activeSelectionResizeHandle === "mt" || activeSelectionResizeHandle === "mb");
|
|
14836
|
+
const normalizeAngle = (angle) => (angle % 360 + 360) % 360;
|
|
14837
|
+
const shortestAngleDelta = (a, b) => {
|
|
14838
|
+
const diff = Math.abs(normalizeAngle(a) - normalizeAngle(b));
|
|
14839
|
+
return Math.min(diff, 360 - diff);
|
|
14840
|
+
};
|
|
14825
14841
|
if (selectedElementIds.length > 0) {
|
|
14826
14842
|
const firstObj = activeObjects[0];
|
|
14827
14843
|
const firstId = getObjectId(firstObj);
|
|
@@ -14885,12 +14901,9 @@ const PageCanvas = forwardRef(
|
|
|
14885
14901
|
const deltaY = movedGroupTop - groupAbs.top;
|
|
14886
14902
|
const hadResizeHandle = isActiveSelection && !!activeSelectionResizeHandle;
|
|
14887
14903
|
const hadScale = isActiveSelection && activeObj && (hadResizeHandle || Math.abs((activeObj.scaleX ?? 1) - 1) > 0.01 || Math.abs((activeObj.scaleY ?? 1) - 1) > 0.01);
|
|
14888
|
-
const startSelAngle = ((
|
|
14889
|
-
const currentSelAngle = isActiveSelection && activeObj ? (
|
|
14890
|
-
const angleDelta =
|
|
14891
|
-
Math.abs(currentSelAngle - startSelAngle),
|
|
14892
|
-
360 - Math.abs(currentSelAngle - startSelAngle)
|
|
14893
|
-
);
|
|
14904
|
+
const startSelAngle = normalizeAngle((transformStart == null ? void 0 : transformStart.selectionAngle) ?? 0);
|
|
14905
|
+
const currentSelAngle = isActiveSelection && activeObj ? normalizeAngle(activeObj.angle ?? 0) : 0;
|
|
14906
|
+
const angleDelta = shortestAngleDelta(currentSelAngle, startSelAngle);
|
|
14894
14907
|
const hadRotation = isActiveSelection && activeObj && angleDelta > 0.01;
|
|
14895
14908
|
if (!isActiveSelectionSideResize && !hadScale && !hadRotation && (Math.abs(deltaX) > 0.1 || Math.abs(deltaY) > 0.1)) {
|
|
14896
14909
|
const { updateNode: updateNodeStore, commitHistory: commitHistoryStore, getCurrentElements } = useEditorStore.getState();
|
|
@@ -14933,6 +14946,35 @@ const PageCanvas = forwardRef(
|
|
|
14933
14946
|
unlockEditsSoon();
|
|
14934
14947
|
return;
|
|
14935
14948
|
}
|
|
14949
|
+
if (activeGroupSelectionId === groupToMove.id && hadRotation && !hadScale && !activeSelectionResizeHandle && activeObj instanceof fabric.ActiveSelection) {
|
|
14950
|
+
const { updateNode: updateNodeStore, commitHistory: commitHistoryStore, getCurrentElements } = useEditorStore.getState();
|
|
14951
|
+
const nextAngle = currentSelAngle;
|
|
14952
|
+
updateNodeStore(groupToMove.id, { angle: nextAngle }, { recordHistory: false, skipLayoutRecalc: true });
|
|
14953
|
+
commitHistoryStore();
|
|
14954
|
+
const groupSelectionId = activeGroupSelectionId;
|
|
14955
|
+
elementsRef.current = getCurrentElements();
|
|
14956
|
+
for (const obj of activeObjects) {
|
|
14957
|
+
const objId = getObjectId(obj);
|
|
14958
|
+
if (objId && objId !== "__background__") {
|
|
14959
|
+
justModifiedIdsRef.current.add(objId);
|
|
14960
|
+
modifiedIdsThisRound.add(objId);
|
|
14961
|
+
}
|
|
14962
|
+
}
|
|
14963
|
+
setTimeout(() => modifiedIdsThisRound.forEach((id) => justModifiedIdsRef.current.delete(id)), 150);
|
|
14964
|
+
groupSelectionTransformStartRef.current = null;
|
|
14965
|
+
activeSelectionMoveStartRef.current = null;
|
|
14966
|
+
activeSelectionResizeHandleRef.current = null;
|
|
14967
|
+
const rotateRestoreSnapshot = {
|
|
14968
|
+
memberIds: activeObjects.map((obj) => getObjectId(obj)).filter((id) => !!id && id !== "__background__"),
|
|
14969
|
+
groupSelectionId,
|
|
14970
|
+
expiresAt: Date.now() + 1200
|
|
14971
|
+
};
|
|
14972
|
+
recentGroupSelectionRestoreRef.current = rotateRestoreSnapshot;
|
|
14973
|
+
preserveActiveSelectionAfterTransformRef.current = rotateRestoreSnapshot;
|
|
14974
|
+
fabricCanvas.requestRenderAll();
|
|
14975
|
+
unlockEditsSoon();
|
|
14976
|
+
return;
|
|
14977
|
+
}
|
|
14936
14978
|
}
|
|
14937
14979
|
}
|
|
14938
14980
|
const pendingCropGroupFrameBakes = [];
|
|
@@ -15448,7 +15490,8 @@ const PageCanvas = forwardRef(
|
|
|
15448
15490
|
for (const gid of stackGroupsToReflow) {
|
|
15449
15491
|
useEditorStore.getState().reflowStackGroupInPage(pageId, gid);
|
|
15450
15492
|
}
|
|
15451
|
-
|
|
15493
|
+
const shouldRebuildActiveSelectionAfterPersist = activeObj instanceof fabric.ActiveSelection && (!!activeSelectionResizeHandle || pendingCropGroupFrameBakes.length > 0 || Math.abs((activeObj.scaleX ?? 1) - 1) > 1e-3 || Math.abs((activeObj.scaleY ?? 1) - 1) > 1e-3);
|
|
15494
|
+
if (activeObj instanceof fabric.ActiveSelection && activeObjects.length > 0 && shouldRebuildActiveSelectionAfterPersist) {
|
|
15452
15495
|
const wasGroupSel = activeObj.__pixldocsGroupSelection;
|
|
15453
15496
|
const membersToReselect = activeObjects.filter((o) => {
|
|
15454
15497
|
const oid = getObjectId(o);
|
|
@@ -24577,9 +24620,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24577
24620
|
}
|
|
24578
24621
|
return svgString;
|
|
24579
24622
|
}
|
|
24580
|
-
const resolvedPackageVersion = "0.5.
|
|
24623
|
+
const resolvedPackageVersion = "0.5.339";
|
|
24581
24624
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24582
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24625
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.339";
|
|
24583
24626
|
const roundParityValue = (value) => {
|
|
24584
24627
|
if (typeof value !== "number") return value;
|
|
24585
24628
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25393,7 +25436,7 @@ class PixldocsRenderer {
|
|
|
25393
25436
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25394
25437
|
}
|
|
25395
25438
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25396
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
25439
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-GeBepP7g.js");
|
|
25397
25440
|
const prepared = preparePagesForExport(
|
|
25398
25441
|
cloned.pages,
|
|
25399
25442
|
canvasWidth,
|
|
@@ -27713,7 +27756,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
27713
27756
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
27714
27757
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
27715
27758
|
try {
|
|
27716
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
27759
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-GeBepP7g.js");
|
|
27717
27760
|
try {
|
|
27718
27761
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
27719
27762
|
} catch {
|
|
@@ -28113,4 +28156,4 @@ export {
|
|
|
28113
28156
|
buildTeaserBlurFlatKeys as y,
|
|
28114
28157
|
collectFontDescriptorsFromConfig as z
|
|
28115
28158
|
};
|
|
28116
|
-
//# sourceMappingURL=index-
|
|
28159
|
+
//# sourceMappingURL=index-DFhDFJ4X.js.map
|