@pixldocs/canvas-renderer 0.5.306 → 0.5.308
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-DG1oNkJx.js → index-C56kkT1g.js} +120 -12
- package/dist/index-C56kkT1g.js.map +1 -0
- package/dist/{index-Dtus6g8-.cjs → index-DvZ7xADZ.cjs} +120 -12
- package/dist/index-DvZ7xADZ.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-DlIHeeIS.cjs → vectorPdfExport-CRUQe1BV.cjs} +4 -4
- package/dist/{vectorPdfExport-DlIHeeIS.cjs.map → vectorPdfExport-CRUQe1BV.cjs.map} +1 -1
- package/dist/{vectorPdfExport-CBKunRKb.js → vectorPdfExport-D_Bu2WUi.js} +4 -4
- package/dist/{vectorPdfExport-CBKunRKb.js.map → vectorPdfExport-D_Bu2WUi.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-DG1oNkJx.js.map +0 -1
- package/dist/index-Dtus6g8-.cjs.map +0 -1
|
@@ -11241,10 +11241,35 @@ const PageCanvas = forwardRef(
|
|
|
11241
11241
|
const [ready, setReady] = useState(false);
|
|
11242
11242
|
const [unlockRequestId, setUnlockRequestId] = useState(0);
|
|
11243
11243
|
const applyLogicalGroupSelectionVisualState = useCallback((selection, groupId) => {
|
|
11244
|
-
var _a2;
|
|
11244
|
+
var _a2, _b2;
|
|
11245
11245
|
selection.__pixldocsGroupSelection = groupId;
|
|
11246
11246
|
delete selection.__pixldocsLogicalGroupIds;
|
|
11247
11247
|
selection.hasBorders = true;
|
|
11248
|
+
try {
|
|
11249
|
+
const state = useEditorStore.getState();
|
|
11250
|
+
const pages = ((_a2 = state.canvas) == null ? void 0 : _a2.pages) ?? [];
|
|
11251
|
+
let groupNode = null;
|
|
11252
|
+
for (const page of pages) {
|
|
11253
|
+
const found = findNodeById(page.children ?? [], groupId);
|
|
11254
|
+
if (found && isGroup(found)) {
|
|
11255
|
+
groupNode = found;
|
|
11256
|
+
break;
|
|
11257
|
+
}
|
|
11258
|
+
}
|
|
11259
|
+
if (groupNode && !isStackLayoutMode(groupNode.layoutMode) && typeof groupNode.angle === "number" && Math.abs(groupNode.angle) > 0.01) {
|
|
11260
|
+
const currentAngle = ((selection.angle ?? 0) % 360 + 360) % 360;
|
|
11261
|
+
const targetAngle = ((groupNode.angle ?? 0) % 360 + 360) % 360;
|
|
11262
|
+
try {
|
|
11263
|
+
console.log("[ROT-DBG] restore AS angle", { groupId, currentAngle, targetAngle, childCount: selection.getObjects().length });
|
|
11264
|
+
} catch {
|
|
11265
|
+
}
|
|
11266
|
+
if (Math.abs(currentAngle - targetAngle) > 0.01) {
|
|
11267
|
+
selection.rotate(targetAngle);
|
|
11268
|
+
selection.setCoords();
|
|
11269
|
+
}
|
|
11270
|
+
}
|
|
11271
|
+
} catch {
|
|
11272
|
+
}
|
|
11248
11273
|
const members = selection.getObjects();
|
|
11249
11274
|
for (const prev of suppressGroupMemberBordersRef.current) {
|
|
11250
11275
|
if (members.includes(prev)) continue;
|
|
@@ -11268,7 +11293,7 @@ const PageCanvas = forwardRef(
|
|
|
11268
11293
|
if (m.__pixldocsOrigHasControls === void 0) m.__pixldocsOrigHasControls = m.hasControls;
|
|
11269
11294
|
m.hasBorders = false;
|
|
11270
11295
|
m.hasControls = false;
|
|
11271
|
-
if (m.__cropGroup || ((
|
|
11296
|
+
if (m.__cropGroup || ((_b2 = m._ct) == null ? void 0 : _b2.isCropGroup)) {
|
|
11272
11297
|
if (m.__pixldocsOrigLockScalingX === void 0) {
|
|
11273
11298
|
m.__pixldocsOrigLockScalingX = m.lockScalingX;
|
|
11274
11299
|
m.__pixldocsOrigLockScalingY = m.lockScalingY;
|
|
@@ -13851,6 +13876,12 @@ const PageCanvas = forwardRef(
|
|
|
13851
13876
|
if (didShift) didReflowTextChild = true;
|
|
13852
13877
|
}
|
|
13853
13878
|
if (isXSide && didReflowTextChild && typeof obj.triggerLayout === "function") {
|
|
13879
|
+
obj.setCoords();
|
|
13880
|
+
const cornersBefore = obj.aCoords;
|
|
13881
|
+
let fixedMidBefore = null;
|
|
13882
|
+
if (cornersBefore) {
|
|
13883
|
+
fixedMidBefore = corner === "ml" ? { x: (cornersBefore.tr.x + cornersBefore.br.x) / 2, y: (cornersBefore.tr.y + cornersBefore.br.y) / 2 } : { x: (cornersBefore.tl.x + cornersBefore.bl.x) / 2, y: (cornersBefore.tl.y + cornersBefore.bl.y) / 2 };
|
|
13884
|
+
}
|
|
13854
13885
|
try {
|
|
13855
13886
|
obj.triggerLayout();
|
|
13856
13887
|
} catch {
|
|
@@ -13859,11 +13890,22 @@ const PageCanvas = forwardRef(
|
|
|
13859
13890
|
obj._set("scaleX", asSx0);
|
|
13860
13891
|
obj._set("scaleY", asSy0);
|
|
13861
13892
|
obj.setCoords();
|
|
13862
|
-
const
|
|
13863
|
-
|
|
13864
|
-
|
|
13865
|
-
|
|
13866
|
-
|
|
13893
|
+
const cornersAfter = obj.aCoords;
|
|
13894
|
+
if (fixedMidBefore && cornersAfter) {
|
|
13895
|
+
const fixedMidAfter = corner === "ml" ? { x: (cornersAfter.tr.x + cornersAfter.br.x) / 2, y: (cornersAfter.tr.y + cornersAfter.br.y) / 2 } : { x: (cornersAfter.tl.x + cornersAfter.bl.x) / 2, y: (cornersAfter.tl.y + cornersAfter.bl.y) / 2 };
|
|
13896
|
+
const dx = fixedMidBefore.x - fixedMidAfter.x;
|
|
13897
|
+
const dy = fixedMidBefore.y - fixedMidAfter.y;
|
|
13898
|
+
if (Math.abs(dx) > 0.01 || Math.abs(dy) > 0.01) {
|
|
13899
|
+
obj._set("left", (obj.left ?? 0) + dx);
|
|
13900
|
+
obj._set("top", (obj.top ?? 0) + dy);
|
|
13901
|
+
}
|
|
13902
|
+
} else {
|
|
13903
|
+
const afterRect = obj.getBoundingRect();
|
|
13904
|
+
const fixedLeft = asRect0.left;
|
|
13905
|
+
const fixedRight = asRect0.left + asRect0.width;
|
|
13906
|
+
const nextLeft = corner === "ml" ? (obj.left ?? 0) + (fixedRight - (afterRect.left + afterRect.width)) : (obj.left ?? 0) + (fixedLeft - afterRect.left);
|
|
13907
|
+
obj._set("left", nextLeft);
|
|
13908
|
+
}
|
|
13867
13909
|
} else {
|
|
13868
13910
|
obj._set("height", asH0);
|
|
13869
13911
|
obj._set("left", asLeft0);
|
|
@@ -14569,6 +14611,27 @@ const PageCanvas = forwardRef(
|
|
|
14569
14611
|
360 - Math.abs(currentSelAngle - startSelAngle)
|
|
14570
14612
|
);
|
|
14571
14613
|
const hadRotation = isActiveSelection && activeObj && angleDelta > 0.01;
|
|
14614
|
+
try {
|
|
14615
|
+
console.log("[ROT-DBG] object:modified", {
|
|
14616
|
+
isActiveSelection,
|
|
14617
|
+
isAS: activeObj instanceof fabric.ActiveSelection,
|
|
14618
|
+
groupToMoveId: groupToMove == null ? void 0 : groupToMove.id,
|
|
14619
|
+
groupToMoveLayout: groupToMove == null ? void 0 : groupToMove.layoutMode,
|
|
14620
|
+
groupSelMarker: activeObj == null ? void 0 : activeObj.__pixldocsGroupSelection,
|
|
14621
|
+
startSelAngle,
|
|
14622
|
+
currentSelAngle,
|
|
14623
|
+
angleDelta,
|
|
14624
|
+
hadRotation,
|
|
14625
|
+
hadScale,
|
|
14626
|
+
deltaX,
|
|
14627
|
+
deltaY,
|
|
14628
|
+
asScaleX: activeObj == null ? void 0 : activeObj.scaleX,
|
|
14629
|
+
asScaleY: activeObj == null ? void 0 : activeObj.scaleY,
|
|
14630
|
+
childCount: activeObj instanceof fabric.ActiveSelection ? activeObj.getObjects().length : 0,
|
|
14631
|
+
childAngles: activeObj instanceof fabric.ActiveSelection ? activeObj.getObjects().map((o) => Math.round(((o.angle ?? 0) + Number.EPSILON) * 100) / 100) : []
|
|
14632
|
+
});
|
|
14633
|
+
} catch {
|
|
14634
|
+
}
|
|
14572
14635
|
if (!hadScale && !hadRotation && (Math.abs(deltaX) > 0.1 || Math.abs(deltaY) > 0.1)) {
|
|
14573
14636
|
const { updateNode: updateNodeStore, commitHistory: commitHistoryStore, getCurrentElements } = useEditorStore.getState();
|
|
14574
14637
|
const newLeft = (groupToMove.left ?? 0) + deltaX;
|
|
@@ -14608,6 +14671,51 @@ const PageCanvas = forwardRef(
|
|
|
14608
14671
|
unlockEditsSoon();
|
|
14609
14672
|
return;
|
|
14610
14673
|
}
|
|
14674
|
+
if (hadRotation && !hadScale && isActiveSelection && activeObj instanceof fabric.ActiveSelection && !isStackLayoutMode(groupToMove.layoutMode)) {
|
|
14675
|
+
const groupSelectionId = activeObj.__pixldocsGroupSelection ?? groupToMove.id;
|
|
14676
|
+
const newAngle = ((activeObj.angle ?? 0) % 360 + 360) % 360;
|
|
14677
|
+
try {
|
|
14678
|
+
console.log("[ROT-DBG] persist group.angle", { groupId: groupToMove.id, newAngle, groupSelectionId });
|
|
14679
|
+
} catch {
|
|
14680
|
+
}
|
|
14681
|
+
const { updateNode: updateNodeStore, commitHistory: commitHistoryStore, getCurrentElements } = useEditorStore.getState();
|
|
14682
|
+
const rotPatch = { angle: newAngle === 0 ? void 0 : newAngle };
|
|
14683
|
+
if (Math.abs(deltaX) > 0.1) rotPatch.left = (groupToMove.left ?? 0) + deltaX;
|
|
14684
|
+
if (Math.abs(deltaY) > 0.1) rotPatch.top = (groupToMove.top ?? 0) + deltaY;
|
|
14685
|
+
updateNodeStore(groupToMove.id, rotPatch, { recordHistory: false, skipLayoutRecalc: true });
|
|
14686
|
+
commitHistoryStore();
|
|
14687
|
+
pendingGroupDrillInRef.current = null;
|
|
14688
|
+
fabricCanvas.__activeEditingGroupId = null;
|
|
14689
|
+
setDrilledGroupBounds(null);
|
|
14690
|
+
drilledGroupIdRef.current = null;
|
|
14691
|
+
if (groupSelectionId) {
|
|
14692
|
+
restoreGroupSelectionVisualState(activeObj, groupSelectionId);
|
|
14693
|
+
fabricCanvas.setActiveObject(activeObj);
|
|
14694
|
+
activeObj.setCoords();
|
|
14695
|
+
}
|
|
14696
|
+
selectElements([groupSelectionId], false, false);
|
|
14697
|
+
fabricCanvas.requestRenderAll();
|
|
14698
|
+
elementsRef.current = getCurrentElements();
|
|
14699
|
+
const rotTargets = activeObj.getObjects();
|
|
14700
|
+
for (const o of rotTargets) {
|
|
14701
|
+
const oid = getObjectId(o);
|
|
14702
|
+
if (oid && oid !== "__background__") {
|
|
14703
|
+
justModifiedIdsRef.current.add(oid);
|
|
14704
|
+
modifiedIdsThisRound.add(oid);
|
|
14705
|
+
}
|
|
14706
|
+
}
|
|
14707
|
+
setTimeout(() => modifiedIdsThisRound.forEach((id) => justModifiedIdsRef.current.delete(id)), 150);
|
|
14708
|
+
groupSelectionTransformStartRef.current = null;
|
|
14709
|
+
const rotSnapshot = {
|
|
14710
|
+
memberIds: rotTargets.map((o) => getObjectId(o)).filter((id) => !!id && id !== "__background__"),
|
|
14711
|
+
groupSelectionId,
|
|
14712
|
+
expiresAt: Date.now() + 1200
|
|
14713
|
+
};
|
|
14714
|
+
recentGroupSelectionRestoreRef.current = rotSnapshot;
|
|
14715
|
+
restorePreservedGroupSelectionSoon(rotSnapshot);
|
|
14716
|
+
unlockEditsSoon();
|
|
14717
|
+
return;
|
|
14718
|
+
}
|
|
14611
14719
|
}
|
|
14612
14720
|
}
|
|
14613
14721
|
const pendingCropGroupFrameBakes = [];
|
|
@@ -24193,9 +24301,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24193
24301
|
}
|
|
24194
24302
|
return svgString;
|
|
24195
24303
|
}
|
|
24196
|
-
const resolvedPackageVersion = "0.5.
|
|
24304
|
+
const resolvedPackageVersion = "0.5.308";
|
|
24197
24305
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24198
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24306
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.308";
|
|
24199
24307
|
const roundParityValue = (value) => {
|
|
24200
24308
|
if (typeof value !== "number") return value;
|
|
24201
24309
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25009,7 +25117,7 @@ class PixldocsRenderer {
|
|
|
25009
25117
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25010
25118
|
}
|
|
25011
25119
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25012
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
25120
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-D_Bu2WUi.js");
|
|
25013
25121
|
const prepared = preparePagesForExport(
|
|
25014
25122
|
cloned.pages,
|
|
25015
25123
|
canvasWidth,
|
|
@@ -27329,7 +27437,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
27329
27437
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
27330
27438
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
27331
27439
|
try {
|
|
27332
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
27440
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-D_Bu2WUi.js");
|
|
27333
27441
|
try {
|
|
27334
27442
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
27335
27443
|
} catch {
|
|
@@ -27729,4 +27837,4 @@ export {
|
|
|
27729
27837
|
buildTeaserBlurFlatKeys as y,
|
|
27730
27838
|
collectFontDescriptorsFromConfig as z
|
|
27731
27839
|
};
|
|
27732
|
-
//# sourceMappingURL=index-
|
|
27840
|
+
//# sourceMappingURL=index-C56kkT1g.js.map
|