@pixldocs/canvas-renderer 0.5.390 → 0.5.392
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-BAbK6GX5.cjs → index-B0qSXTeJ.cjs} +51 -9
- package/dist/index-B0qSXTeJ.cjs.map +1 -0
- package/dist/{index-ByJXwd5Y.js → index-BMosbEqF.js} +51 -9
- package/dist/index-BMosbEqF.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-p4K2EISX.js → vectorPdfExport-CRmMt10E.js} +4 -4
- package/dist/{vectorPdfExport-p4K2EISX.js.map → vectorPdfExport-CRmMt10E.js.map} +1 -1
- package/dist/{vectorPdfExport-3tLyCSst.cjs → vectorPdfExport-DhWvQzRg.cjs} +4 -4
- package/dist/{vectorPdfExport-3tLyCSst.cjs.map → vectorPdfExport-DhWvQzRg.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-BAbK6GX5.cjs.map +0 -1
- package/dist/index-ByJXwd5Y.js.map +0 -1
|
@@ -11455,12 +11455,54 @@ function applyWarpAwareSelectionBorders(selection) {
|
|
|
11455
11455
|
k.calcOwnMatrix()
|
|
11456
11456
|
));
|
|
11457
11457
|
const worldAngles = worldMatrices.map((m) => norm(fabric.util.qrDecompose(m).angle ?? 0));
|
|
11458
|
-
const
|
|
11458
|
+
const worldPoints = [];
|
|
11459
|
+
for (const k of kids) {
|
|
11460
|
+
try {
|
|
11461
|
+
k.setCoords();
|
|
11462
|
+
} catch {
|
|
11463
|
+
}
|
|
11464
|
+
const coords = typeof k.getCoords === "function" ? k.getCoords() : null;
|
|
11465
|
+
if (Array.isArray(coords) && coords.length) {
|
|
11466
|
+
worldPoints.push(...coords.map((p) => ({ x: p.x, y: p.y })));
|
|
11467
|
+
continue;
|
|
11468
|
+
}
|
|
11469
|
+
const aC = k.aCoords;
|
|
11470
|
+
if (aC) {
|
|
11471
|
+
for (const key of ["tl", "tr", "br", "bl"]) {
|
|
11472
|
+
const p = aC[key];
|
|
11473
|
+
if (p) worldPoints.push({ x: p.x, y: p.y });
|
|
11474
|
+
}
|
|
11475
|
+
}
|
|
11476
|
+
}
|
|
11477
|
+
const orientedAreaForAngle = (angle) => {
|
|
11478
|
+
if (worldPoints.length === 0) return Number.POSITIVE_INFINITY;
|
|
11479
|
+
const rad = -angle * Math.PI / 180;
|
|
11480
|
+
const cos = Math.cos(rad), sin = Math.sin(rad);
|
|
11481
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
11482
|
+
for (const p of worldPoints) {
|
|
11483
|
+
const xr = p.x * cos - p.y * sin;
|
|
11484
|
+
const yr = p.x * sin + p.y * cos;
|
|
11485
|
+
minX = Math.min(minX, xr);
|
|
11486
|
+
minY = Math.min(minY, yr);
|
|
11487
|
+
maxX = Math.max(maxX, xr);
|
|
11488
|
+
maxY = Math.max(maxY, yr);
|
|
11489
|
+
}
|
|
11490
|
+
return Math.max(1, (maxX - minX) * (maxY - minY));
|
|
11491
|
+
};
|
|
11459
11492
|
const ALL_SAME_TOL_DEG = 2;
|
|
11460
|
-
const
|
|
11493
|
+
const buckets = [];
|
|
11494
|
+
for (const a of worldAngles) {
|
|
11495
|
+
const b = buckets.find((x) => angleDelta(x.angle, a) <= ALL_SAME_TOL_DEG);
|
|
11496
|
+
if (b) b.count++;
|
|
11497
|
+
else buckets.push({ angle: a, count: 1, area: Number.POSITIVE_INFINITY });
|
|
11498
|
+
}
|
|
11499
|
+
for (const b of buckets) b.area = orientedAreaForAngle(b.angle);
|
|
11500
|
+
buckets.sort((a, b) => b.count - a.count || a.area - b.area || Math.abs(b.angle) - Math.abs(a.angle));
|
|
11501
|
+
const dominant = buckets[0];
|
|
11461
11502
|
let targetAngle = null;
|
|
11462
|
-
|
|
11463
|
-
|
|
11503
|
+
const isLogicalGroupSelection = !!selection.__pixldocsGroupSelection;
|
|
11504
|
+
if (dominant && Math.abs(dominant.angle) > 0.5 && (isLogicalGroupSelection || kids.length === 1 || dominant.count >= 2 || dominant.count === kids.length)) {
|
|
11505
|
+
targetAngle = dominant.angle;
|
|
11464
11506
|
}
|
|
11465
11507
|
if (targetAngle != null) {
|
|
11466
11508
|
const restoreKidsFromWorld = () => {
|
|
@@ -25024,9 +25066,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
25024
25066
|
}
|
|
25025
25067
|
return svgString;
|
|
25026
25068
|
}
|
|
25027
|
-
const resolvedPackageVersion = "0.5.
|
|
25069
|
+
const resolvedPackageVersion = "0.5.392";
|
|
25028
25070
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
25029
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
25071
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.392";
|
|
25030
25072
|
const roundParityValue = (value) => {
|
|
25031
25073
|
if (typeof value !== "number") return value;
|
|
25032
25074
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25840,7 +25882,7 @@ class PixldocsRenderer {
|
|
|
25840
25882
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25841
25883
|
}
|
|
25842
25884
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25843
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
25885
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CRmMt10E.js");
|
|
25844
25886
|
const prepared = preparePagesForExport(
|
|
25845
25887
|
cloned.pages,
|
|
25846
25888
|
canvasWidth,
|
|
@@ -28160,7 +28202,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
28160
28202
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
28161
28203
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
28162
28204
|
try {
|
|
28163
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
28205
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CRmMt10E.js");
|
|
28164
28206
|
try {
|
|
28165
28207
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
28166
28208
|
} catch {
|
|
@@ -28560,4 +28602,4 @@ export {
|
|
|
28560
28602
|
buildTeaserBlurFlatKeys as y,
|
|
28561
28603
|
collectFontDescriptorsFromConfig as z
|
|
28562
28604
|
};
|
|
28563
|
-
//# sourceMappingURL=index-
|
|
28605
|
+
//# sourceMappingURL=index-BMosbEqF.js.map
|