@pixldocs/canvas-renderer 0.5.136 → 0.5.138
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-DUHE7WhJ.cjs → index-CkbBhnZd.cjs} +18 -6
- package/dist/{index-DUHE7WhJ.cjs.map → index-CkbBhnZd.cjs.map} +1 -1
- package/dist/{index-BHa3ekoF.js → index-D-I6bYGU.js} +18 -6
- package/dist/{index-BHa3ekoF.js.map → index-D-I6bYGU.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-D3L64sAJ.js → vectorPdfExport-BGqNP_R0.js} +19 -15
- package/dist/vectorPdfExport-BGqNP_R0.js.map +1 -0
- package/dist/{vectorPdfExport-Bq-_OarH.cjs → vectorPdfExport-Bw9l0p9C.cjs} +19 -15
- package/dist/vectorPdfExport-Bw9l0p9C.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/vectorPdfExport-Bq-_OarH.cjs.map +0 -1
- package/dist/vectorPdfExport-D3L64sAJ.js.map +0 -1
|
@@ -15957,7 +15957,7 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
15957
15957
|
}
|
|
15958
15958
|
return svgString;
|
|
15959
15959
|
}
|
|
15960
|
-
const PACKAGE_VERSION = "0.5.
|
|
15960
|
+
const PACKAGE_VERSION = "0.5.138";
|
|
15961
15961
|
const roundParityValue = (value) => {
|
|
15962
15962
|
if (typeof value !== "number") return value;
|
|
15963
15963
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -15978,6 +15978,12 @@ function logJsonLine(tag, payload) {
|
|
|
15978
15978
|
console.log(tag, payload);
|
|
15979
15979
|
}
|
|
15980
15980
|
}
|
|
15981
|
+
function isFabricTextboxLike(obj) {
|
|
15982
|
+
return !!obj && (obj instanceof fabric__namespace.Textbox || obj.type === "textbox" || obj.type === "text" || typeof obj.getLineWidth === "function" && Array.isArray(obj._textLines));
|
|
15983
|
+
}
|
|
15984
|
+
function isFabricGroupLike(obj) {
|
|
15985
|
+
return !!obj && (obj instanceof fabric__namespace.Group || obj.type === "group" || Array.isArray(obj._objects) && typeof obj.getObjects === "function");
|
|
15986
|
+
}
|
|
15981
15987
|
let __underlineFixInstalled = false;
|
|
15982
15988
|
function installUnderlineFix(fab) {
|
|
15983
15989
|
var _a;
|
|
@@ -16376,7 +16382,7 @@ class PixldocsRenderer {
|
|
|
16376
16382
|
await this.waitForCanvasScene(container, cloned, i);
|
|
16377
16383
|
}
|
|
16378
16384
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
16379
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
16385
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-Bw9l0p9C.cjs"));
|
|
16380
16386
|
const prepared = preparePagesForExport(
|
|
16381
16387
|
cloned.pages,
|
|
16382
16388
|
canvasWidth,
|
|
@@ -16952,7 +16958,7 @@ class PixldocsRenderer {
|
|
|
16952
16958
|
const visit = (obj, groupPath = "") => {
|
|
16953
16959
|
var _a2;
|
|
16954
16960
|
if (!obj) return;
|
|
16955
|
-
if (obj
|
|
16961
|
+
if (isFabricTextboxLike(obj)) {
|
|
16956
16962
|
const lineWidths = getCanvasMeasuredTextboxLineWidths(obj);
|
|
16957
16963
|
sample.push({
|
|
16958
16964
|
id: getObjectId(obj),
|
|
@@ -16993,6 +16999,12 @@ class PixldocsRenderer {
|
|
|
16993
16999
|
const waitForPaint = () => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(() => r())));
|
|
16994
17000
|
const primeCharBounds = (obj) => {
|
|
16995
17001
|
if (obj instanceof fabric__namespace.Textbox) {
|
|
17002
|
+
try {
|
|
17003
|
+
obj.__lineWidths = [];
|
|
17004
|
+
obj.__lineHeights = [];
|
|
17005
|
+
obj.__charBounds = [];
|
|
17006
|
+
} catch {
|
|
17007
|
+
}
|
|
16996
17008
|
const lines = obj._textLines;
|
|
16997
17009
|
if (Array.isArray(lines)) {
|
|
16998
17010
|
for (let i = 0; i < lines.length; i++) {
|
|
@@ -17005,7 +17017,7 @@ class PixldocsRenderer {
|
|
|
17005
17017
|
obj.dirty = true;
|
|
17006
17018
|
return;
|
|
17007
17019
|
}
|
|
17008
|
-
if (obj
|
|
17020
|
+
if (isFabricGroupLike(obj)) {
|
|
17009
17021
|
obj.getObjects().forEach(primeCharBounds);
|
|
17010
17022
|
obj.dirty = true;
|
|
17011
17023
|
}
|
|
@@ -18468,7 +18480,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
18468
18480
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
18469
18481
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
18470
18482
|
try {
|
|
18471
|
-
const { bakeTextAnchorPositionsFromLiveSvg } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
18483
|
+
const { bakeTextAnchorPositionsFromLiveSvg } = await Promise.resolve().then(() => require("./vectorPdfExport-Bw9l0p9C.cjs"));
|
|
18472
18484
|
await bakeTextAnchorPositionsFromLiveSvg(svgToDraw);
|
|
18473
18485
|
} catch (e) {
|
|
18474
18486
|
console.warn("[canvas-renderer][pdf-export] anchor-bake pass failed (continuing):", e);
|
|
@@ -18810,4 +18822,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
18810
18822
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
18811
18823
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
18812
18824
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
18813
|
-
//# sourceMappingURL=index-
|
|
18825
|
+
//# sourceMappingURL=index-CkbBhnZd.cjs.map
|