@pixldocs/canvas-renderer 0.5.480 → 0.5.482
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-BvNexoyT.cjs → index-D3HaA3of.cjs} +23 -14
- package/dist/index-D3HaA3of.cjs.map +1 -0
- package/dist/{index-Bdt_4Ak_.js → index-OZhXWoy2.js} +23 -14
- package/dist/index-OZhXWoy2.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-CwvZ-BD6.js → vectorPdfExport-BnwNy_o1.js} +4 -4
- package/dist/{vectorPdfExport-CwvZ-BD6.js.map → vectorPdfExport-BnwNy_o1.js.map} +1 -1
- package/dist/{vectorPdfExport-8y-rUG9Q.cjs → vectorPdfExport-VJIOnRbU.cjs} +4 -4
- package/dist/{vectorPdfExport-8y-rUG9Q.cjs.map → vectorPdfExport-VJIOnRbU.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-Bdt_4Ak_.js.map +0 -1
- package/dist/index-BvNexoyT.cjs.map +0 -1
|
@@ -819,6 +819,12 @@ function getNodeLeft(node) {
|
|
|
819
819
|
function getNodeTop(node) {
|
|
820
820
|
return typeof node.top === "number" ? node.top : 0;
|
|
821
821
|
}
|
|
822
|
+
function getStackMainAnchorOffset(node, mainSize) {
|
|
823
|
+
const anchor = node.stackAnchor;
|
|
824
|
+
if (anchor === "center") return mainSize / 2;
|
|
825
|
+
if (anchor === "end") return mainSize;
|
|
826
|
+
return 0;
|
|
827
|
+
}
|
|
822
828
|
function resolveStackGroupEffectivePositions(group, pageChildren, options) {
|
|
823
829
|
const mode = group.layoutMode ?? "absolute";
|
|
824
830
|
if (!isStackLayoutMode(mode)) return /* @__PURE__ */ new Map();
|
|
@@ -842,14 +848,16 @@ function resolveStackGroupEffectivePositions(group, pageChildren, options) {
|
|
|
842
848
|
const placedIds = [];
|
|
843
849
|
for (let i = 0; i < kids.length; i++) {
|
|
844
850
|
const child = kids[i];
|
|
845
|
-
const storedTop =
|
|
851
|
+
const storedTop = 0;
|
|
846
852
|
const storedLeft = getNodeLeft(child);
|
|
847
853
|
const mTop = child.marginTop ?? 0;
|
|
848
854
|
const mLeft = child.marginLeft ?? 0;
|
|
849
855
|
const hugAdjust = getVerticalHugTextAdjust(group, child);
|
|
850
856
|
const hugTopOffset = hugAdjust ? hugAdjust.topOffset : 0;
|
|
857
|
+
const h = hugAdjust ? hugAdjust.glyphHeight : sizes.get(child.id).height;
|
|
858
|
+
const anchorOffset = getStackMainAnchorOffset(child, h);
|
|
851
859
|
const visualTop = !firstSeen ? padTop + storedTop + mTop : prevBottom + gap + storedTop + mTop;
|
|
852
|
-
const effectiveTop =
|
|
860
|
+
const effectiveTop = visualTop - anchorOffset - hugTopOffset;
|
|
853
861
|
if (firstSeen && hugTopOffset > 0 && placedIds.length > 0) {
|
|
854
862
|
for (const placedId of placedIds) {
|
|
855
863
|
const placed = out.get(placedId);
|
|
@@ -858,7 +866,6 @@ function resolveStackGroupEffectivePositions(group, pageChildren, options) {
|
|
|
858
866
|
}
|
|
859
867
|
firstSeen = true;
|
|
860
868
|
out.set(child.id, { top: effectiveTop, left: padLeft + storedLeft + mLeft });
|
|
861
|
-
const h = hugAdjust ? hugAdjust.glyphHeight : sizes.get(child.id).height;
|
|
862
869
|
prevBottom = effectiveTop + hugTopOffset + h + (child.marginBottom ?? 0);
|
|
863
870
|
placedIds.push(child.id);
|
|
864
871
|
}
|
|
@@ -867,14 +874,15 @@ function resolveStackGroupEffectivePositions(group, pageChildren, options) {
|
|
|
867
874
|
let firstSeen = false;
|
|
868
875
|
for (let i = 0; i < kids.length; i++) {
|
|
869
876
|
const child = kids[i];
|
|
870
|
-
const storedLeft =
|
|
877
|
+
const storedLeft = 0;
|
|
871
878
|
const storedTop = getNodeTop(child);
|
|
872
879
|
const mTop = child.marginTop ?? 0;
|
|
873
880
|
const mLeft = child.marginLeft ?? 0;
|
|
874
|
-
const
|
|
881
|
+
const w = sizes.get(child.id).width;
|
|
882
|
+
const anchorOffset = getStackMainAnchorOffset(child, w);
|
|
883
|
+
const effectiveLeft = (!firstSeen ? padLeft + storedLeft + mLeft : prevRight + gap + storedLeft + mLeft) - anchorOffset;
|
|
875
884
|
firstSeen = true;
|
|
876
885
|
out.set(child.id, { top: padTop + storedTop + mTop, left: effectiveLeft });
|
|
877
|
-
const w = sizes.get(child.id).width;
|
|
878
886
|
prevRight = effectiveLeft + w + (child.marginRight ?? 0);
|
|
879
887
|
}
|
|
880
888
|
}
|
|
@@ -980,13 +988,14 @@ function resolveStackGroupEffectivePositions(group, pageChildren, options) {
|
|
|
980
988
|
const pos = out.get(child.id);
|
|
981
989
|
if (!pos) continue;
|
|
982
990
|
const startMain = cursor + marginStart;
|
|
991
|
+
const anchorOffset = getStackMainAnchorOffset(child, main);
|
|
983
992
|
if (isVertical) {
|
|
984
993
|
const hugAdjust = getVerticalHugTextAdjust(group, child);
|
|
985
|
-
out.set(child.id, { top: startMain - ((hugAdjust == null ? void 0 : hugAdjust.topOffset) ?? 0), left: pos.left });
|
|
994
|
+
out.set(child.id, { top: startMain - anchorOffset - ((hugAdjust == null ? void 0 : hugAdjust.topOffset) ?? 0), left: pos.left });
|
|
986
995
|
} else {
|
|
987
|
-
out.set(child.id, { top: pos.top, left: startMain });
|
|
996
|
+
out.set(child.id, { top: pos.top, left: startMain - anchorOffset });
|
|
988
997
|
}
|
|
989
|
-
cursor = startMain + main + marginEnd + gap + extraGap;
|
|
998
|
+
cursor = startMain - anchorOffset + main + marginEnd + gap + extraGap;
|
|
990
999
|
}
|
|
991
1000
|
}
|
|
992
1001
|
}
|
|
@@ -26384,9 +26393,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
26384
26393
|
}
|
|
26385
26394
|
return svgString;
|
|
26386
26395
|
}
|
|
26387
|
-
const resolvedPackageVersion = "0.5.
|
|
26396
|
+
const resolvedPackageVersion = "0.5.482";
|
|
26388
26397
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
26389
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
26398
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.482";
|
|
26390
26399
|
const roundParityValue = (value) => {
|
|
26391
26400
|
if (typeof value !== "number") return value;
|
|
26392
26401
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -27200,7 +27209,7 @@ class PixldocsRenderer {
|
|
|
27200
27209
|
await this.waitForCanvasScene(container, cloned, i);
|
|
27201
27210
|
}
|
|
27202
27211
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
27203
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
27212
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-VJIOnRbU.cjs"));
|
|
27204
27213
|
const prepared = preparePagesForExport(
|
|
27205
27214
|
cloned.pages,
|
|
27206
27215
|
canvasWidth,
|
|
@@ -29520,7 +29529,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29520
29529
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29521
29530
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29522
29531
|
try {
|
|
29523
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
29532
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-VJIOnRbU.cjs"));
|
|
29524
29533
|
try {
|
|
29525
29534
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29526
29535
|
} catch {
|
|
@@ -29834,4 +29843,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
29834
29843
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
29835
29844
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
29836
29845
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
29837
|
-
//# sourceMappingURL=index-
|
|
29846
|
+
//# sourceMappingURL=index-D3HaA3of.cjs.map
|