@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
|
@@ -11259,10 +11259,35 @@ const PageCanvas = react.forwardRef(
|
|
|
11259
11259
|
const [ready, setReady] = react.useState(false);
|
|
11260
11260
|
const [unlockRequestId, setUnlockRequestId] = react.useState(0);
|
|
11261
11261
|
const applyLogicalGroupSelectionVisualState = react.useCallback((selection, groupId) => {
|
|
11262
|
-
var _a2;
|
|
11262
|
+
var _a2, _b2;
|
|
11263
11263
|
selection.__pixldocsGroupSelection = groupId;
|
|
11264
11264
|
delete selection.__pixldocsLogicalGroupIds;
|
|
11265
11265
|
selection.hasBorders = true;
|
|
11266
|
+
try {
|
|
11267
|
+
const state = useEditorStore.getState();
|
|
11268
|
+
const pages = ((_a2 = state.canvas) == null ? void 0 : _a2.pages) ?? [];
|
|
11269
|
+
let groupNode = null;
|
|
11270
|
+
for (const page of pages) {
|
|
11271
|
+
const found = findNodeById(page.children ?? [], groupId);
|
|
11272
|
+
if (found && isGroup(found)) {
|
|
11273
|
+
groupNode = found;
|
|
11274
|
+
break;
|
|
11275
|
+
}
|
|
11276
|
+
}
|
|
11277
|
+
if (groupNode && !isStackLayoutMode(groupNode.layoutMode) && typeof groupNode.angle === "number" && Math.abs(groupNode.angle) > 0.01) {
|
|
11278
|
+
const currentAngle = ((selection.angle ?? 0) % 360 + 360) % 360;
|
|
11279
|
+
const targetAngle = ((groupNode.angle ?? 0) % 360 + 360) % 360;
|
|
11280
|
+
try {
|
|
11281
|
+
console.log("[ROT-DBG] restore AS angle", { groupId, currentAngle, targetAngle, childCount: selection.getObjects().length });
|
|
11282
|
+
} catch {
|
|
11283
|
+
}
|
|
11284
|
+
if (Math.abs(currentAngle - targetAngle) > 0.01) {
|
|
11285
|
+
selection.rotate(targetAngle);
|
|
11286
|
+
selection.setCoords();
|
|
11287
|
+
}
|
|
11288
|
+
}
|
|
11289
|
+
} catch {
|
|
11290
|
+
}
|
|
11266
11291
|
const members = selection.getObjects();
|
|
11267
11292
|
for (const prev of suppressGroupMemberBordersRef.current) {
|
|
11268
11293
|
if (members.includes(prev)) continue;
|
|
@@ -11286,7 +11311,7 @@ const PageCanvas = react.forwardRef(
|
|
|
11286
11311
|
if (m.__pixldocsOrigHasControls === void 0) m.__pixldocsOrigHasControls = m.hasControls;
|
|
11287
11312
|
m.hasBorders = false;
|
|
11288
11313
|
m.hasControls = false;
|
|
11289
|
-
if (m.__cropGroup || ((
|
|
11314
|
+
if (m.__cropGroup || ((_b2 = m._ct) == null ? void 0 : _b2.isCropGroup)) {
|
|
11290
11315
|
if (m.__pixldocsOrigLockScalingX === void 0) {
|
|
11291
11316
|
m.__pixldocsOrigLockScalingX = m.lockScalingX;
|
|
11292
11317
|
m.__pixldocsOrigLockScalingY = m.lockScalingY;
|
|
@@ -13869,6 +13894,12 @@ const PageCanvas = react.forwardRef(
|
|
|
13869
13894
|
if (didShift) didReflowTextChild = true;
|
|
13870
13895
|
}
|
|
13871
13896
|
if (isXSide && didReflowTextChild && typeof obj.triggerLayout === "function") {
|
|
13897
|
+
obj.setCoords();
|
|
13898
|
+
const cornersBefore = obj.aCoords;
|
|
13899
|
+
let fixedMidBefore = null;
|
|
13900
|
+
if (cornersBefore) {
|
|
13901
|
+
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 };
|
|
13902
|
+
}
|
|
13872
13903
|
try {
|
|
13873
13904
|
obj.triggerLayout();
|
|
13874
13905
|
} catch {
|
|
@@ -13877,11 +13908,22 @@ const PageCanvas = react.forwardRef(
|
|
|
13877
13908
|
obj._set("scaleX", asSx0);
|
|
13878
13909
|
obj._set("scaleY", asSy0);
|
|
13879
13910
|
obj.setCoords();
|
|
13880
|
-
const
|
|
13881
|
-
|
|
13882
|
-
|
|
13883
|
-
|
|
13884
|
-
|
|
13911
|
+
const cornersAfter = obj.aCoords;
|
|
13912
|
+
if (fixedMidBefore && cornersAfter) {
|
|
13913
|
+
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 };
|
|
13914
|
+
const dx = fixedMidBefore.x - fixedMidAfter.x;
|
|
13915
|
+
const dy = fixedMidBefore.y - fixedMidAfter.y;
|
|
13916
|
+
if (Math.abs(dx) > 0.01 || Math.abs(dy) > 0.01) {
|
|
13917
|
+
obj._set("left", (obj.left ?? 0) + dx);
|
|
13918
|
+
obj._set("top", (obj.top ?? 0) + dy);
|
|
13919
|
+
}
|
|
13920
|
+
} else {
|
|
13921
|
+
const afterRect = obj.getBoundingRect();
|
|
13922
|
+
const fixedLeft = asRect0.left;
|
|
13923
|
+
const fixedRight = asRect0.left + asRect0.width;
|
|
13924
|
+
const nextLeft = corner === "ml" ? (obj.left ?? 0) + (fixedRight - (afterRect.left + afterRect.width)) : (obj.left ?? 0) + (fixedLeft - afterRect.left);
|
|
13925
|
+
obj._set("left", nextLeft);
|
|
13926
|
+
}
|
|
13885
13927
|
} else {
|
|
13886
13928
|
obj._set("height", asH0);
|
|
13887
13929
|
obj._set("left", asLeft0);
|
|
@@ -14587,6 +14629,27 @@ const PageCanvas = react.forwardRef(
|
|
|
14587
14629
|
360 - Math.abs(currentSelAngle - startSelAngle)
|
|
14588
14630
|
);
|
|
14589
14631
|
const hadRotation = isActiveSelection && activeObj && angleDelta > 0.01;
|
|
14632
|
+
try {
|
|
14633
|
+
console.log("[ROT-DBG] object:modified", {
|
|
14634
|
+
isActiveSelection,
|
|
14635
|
+
isAS: activeObj instanceof fabric__namespace.ActiveSelection,
|
|
14636
|
+
groupToMoveId: groupToMove == null ? void 0 : groupToMove.id,
|
|
14637
|
+
groupToMoveLayout: groupToMove == null ? void 0 : groupToMove.layoutMode,
|
|
14638
|
+
groupSelMarker: activeObj == null ? void 0 : activeObj.__pixldocsGroupSelection,
|
|
14639
|
+
startSelAngle,
|
|
14640
|
+
currentSelAngle,
|
|
14641
|
+
angleDelta,
|
|
14642
|
+
hadRotation,
|
|
14643
|
+
hadScale,
|
|
14644
|
+
deltaX,
|
|
14645
|
+
deltaY,
|
|
14646
|
+
asScaleX: activeObj == null ? void 0 : activeObj.scaleX,
|
|
14647
|
+
asScaleY: activeObj == null ? void 0 : activeObj.scaleY,
|
|
14648
|
+
childCount: activeObj instanceof fabric__namespace.ActiveSelection ? activeObj.getObjects().length : 0,
|
|
14649
|
+
childAngles: activeObj instanceof fabric__namespace.ActiveSelection ? activeObj.getObjects().map((o) => Math.round(((o.angle ?? 0) + Number.EPSILON) * 100) / 100) : []
|
|
14650
|
+
});
|
|
14651
|
+
} catch {
|
|
14652
|
+
}
|
|
14590
14653
|
if (!hadScale && !hadRotation && (Math.abs(deltaX) > 0.1 || Math.abs(deltaY) > 0.1)) {
|
|
14591
14654
|
const { updateNode: updateNodeStore, commitHistory: commitHistoryStore, getCurrentElements } = useEditorStore.getState();
|
|
14592
14655
|
const newLeft = (groupToMove.left ?? 0) + deltaX;
|
|
@@ -14626,6 +14689,51 @@ const PageCanvas = react.forwardRef(
|
|
|
14626
14689
|
unlockEditsSoon();
|
|
14627
14690
|
return;
|
|
14628
14691
|
}
|
|
14692
|
+
if (hadRotation && !hadScale && isActiveSelection && activeObj instanceof fabric__namespace.ActiveSelection && !isStackLayoutMode(groupToMove.layoutMode)) {
|
|
14693
|
+
const groupSelectionId = activeObj.__pixldocsGroupSelection ?? groupToMove.id;
|
|
14694
|
+
const newAngle = ((activeObj.angle ?? 0) % 360 + 360) % 360;
|
|
14695
|
+
try {
|
|
14696
|
+
console.log("[ROT-DBG] persist group.angle", { groupId: groupToMove.id, newAngle, groupSelectionId });
|
|
14697
|
+
} catch {
|
|
14698
|
+
}
|
|
14699
|
+
const { updateNode: updateNodeStore, commitHistory: commitHistoryStore, getCurrentElements } = useEditorStore.getState();
|
|
14700
|
+
const rotPatch = { angle: newAngle === 0 ? void 0 : newAngle };
|
|
14701
|
+
if (Math.abs(deltaX) > 0.1) rotPatch.left = (groupToMove.left ?? 0) + deltaX;
|
|
14702
|
+
if (Math.abs(deltaY) > 0.1) rotPatch.top = (groupToMove.top ?? 0) + deltaY;
|
|
14703
|
+
updateNodeStore(groupToMove.id, rotPatch, { recordHistory: false, skipLayoutRecalc: true });
|
|
14704
|
+
commitHistoryStore();
|
|
14705
|
+
pendingGroupDrillInRef.current = null;
|
|
14706
|
+
fabricCanvas.__activeEditingGroupId = null;
|
|
14707
|
+
setDrilledGroupBounds(null);
|
|
14708
|
+
drilledGroupIdRef.current = null;
|
|
14709
|
+
if (groupSelectionId) {
|
|
14710
|
+
restoreGroupSelectionVisualState(activeObj, groupSelectionId);
|
|
14711
|
+
fabricCanvas.setActiveObject(activeObj);
|
|
14712
|
+
activeObj.setCoords();
|
|
14713
|
+
}
|
|
14714
|
+
selectElements([groupSelectionId], false, false);
|
|
14715
|
+
fabricCanvas.requestRenderAll();
|
|
14716
|
+
elementsRef.current = getCurrentElements();
|
|
14717
|
+
const rotTargets = activeObj.getObjects();
|
|
14718
|
+
for (const o of rotTargets) {
|
|
14719
|
+
const oid = getObjectId(o);
|
|
14720
|
+
if (oid && oid !== "__background__") {
|
|
14721
|
+
justModifiedIdsRef.current.add(oid);
|
|
14722
|
+
modifiedIdsThisRound.add(oid);
|
|
14723
|
+
}
|
|
14724
|
+
}
|
|
14725
|
+
setTimeout(() => modifiedIdsThisRound.forEach((id) => justModifiedIdsRef.current.delete(id)), 150);
|
|
14726
|
+
groupSelectionTransformStartRef.current = null;
|
|
14727
|
+
const rotSnapshot = {
|
|
14728
|
+
memberIds: rotTargets.map((o) => getObjectId(o)).filter((id) => !!id && id !== "__background__"),
|
|
14729
|
+
groupSelectionId,
|
|
14730
|
+
expiresAt: Date.now() + 1200
|
|
14731
|
+
};
|
|
14732
|
+
recentGroupSelectionRestoreRef.current = rotSnapshot;
|
|
14733
|
+
restorePreservedGroupSelectionSoon(rotSnapshot);
|
|
14734
|
+
unlockEditsSoon();
|
|
14735
|
+
return;
|
|
14736
|
+
}
|
|
14629
14737
|
}
|
|
14630
14738
|
}
|
|
14631
14739
|
const pendingCropGroupFrameBakes = [];
|
|
@@ -24211,9 +24319,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24211
24319
|
}
|
|
24212
24320
|
return svgString;
|
|
24213
24321
|
}
|
|
24214
|
-
const resolvedPackageVersion = "0.5.
|
|
24322
|
+
const resolvedPackageVersion = "0.5.308";
|
|
24215
24323
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24216
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24324
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.308";
|
|
24217
24325
|
const roundParityValue = (value) => {
|
|
24218
24326
|
if (typeof value !== "number") return value;
|
|
24219
24327
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25027,7 +25135,7 @@ class PixldocsRenderer {
|
|
|
25027
25135
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25028
25136
|
}
|
|
25029
25137
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25030
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
25138
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-CRUQe1BV.cjs"));
|
|
25031
25139
|
const prepared = preparePagesForExport(
|
|
25032
25140
|
cloned.pages,
|
|
25033
25141
|
canvasWidth,
|
|
@@ -27347,7 +27455,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
27347
27455
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
27348
27456
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
27349
27457
|
try {
|
|
27350
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
27458
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-CRUQe1BV.cjs"));
|
|
27351
27459
|
try {
|
|
27352
27460
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
27353
27461
|
} catch {
|
|
@@ -27744,4 +27852,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
27744
27852
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
27745
27853
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
27746
27854
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
27747
|
-
//# sourceMappingURL=index-
|
|
27855
|
+
//# sourceMappingURL=index-DvZ7xADZ.cjs.map
|