@pixldocs/canvas-renderer 0.5.391 → 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-C5CC51On.cjs → index-B0qSXTeJ.cjs} +44 -8
- package/dist/index-B0qSXTeJ.cjs.map +1 -0
- package/dist/{index-Cx-Z8HWW.js → index-BMosbEqF.js} +44 -8
- package/dist/index-BMosbEqF.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-C8_CSDHY.js → vectorPdfExport-CRmMt10E.js} +4 -4
- package/dist/{vectorPdfExport-C8_CSDHY.js.map → vectorPdfExport-CRmMt10E.js.map} +1 -1
- package/dist/{vectorPdfExport-B8BF2GBZ.cjs → vectorPdfExport-DhWvQzRg.cjs} +4 -4
- package/dist/{vectorPdfExport-B8BF2GBZ.cjs.map → vectorPdfExport-DhWvQzRg.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-C5CC51On.cjs.map +0 -1
- package/dist/index-Cx-Z8HWW.js.map +0 -1
|
@@ -11455,17 +11455,53 @@ 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 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
|
+
};
|
|
11458
11492
|
const ALL_SAME_TOL_DEG = 2;
|
|
11459
11493
|
const buckets = [];
|
|
11460
11494
|
for (const a of worldAngles) {
|
|
11461
11495
|
const b = buckets.find((x) => angleDelta(x.angle, a) <= ALL_SAME_TOL_DEG);
|
|
11462
11496
|
if (b) b.count++;
|
|
11463
|
-
else buckets.push({ angle: a, count: 1 });
|
|
11497
|
+
else buckets.push({ angle: a, count: 1, area: Number.POSITIVE_INFINITY });
|
|
11464
11498
|
}
|
|
11465
|
-
|
|
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));
|
|
11466
11501
|
const dominant = buckets[0];
|
|
11467
11502
|
let targetAngle = null;
|
|
11468
|
-
|
|
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)) {
|
|
11469
11505
|
targetAngle = dominant.angle;
|
|
11470
11506
|
}
|
|
11471
11507
|
if (targetAngle != null) {
|
|
@@ -25030,9 +25066,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
25030
25066
|
}
|
|
25031
25067
|
return svgString;
|
|
25032
25068
|
}
|
|
25033
|
-
const resolvedPackageVersion = "0.5.
|
|
25069
|
+
const resolvedPackageVersion = "0.5.392";
|
|
25034
25070
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
25035
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
25071
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.392";
|
|
25036
25072
|
const roundParityValue = (value) => {
|
|
25037
25073
|
if (typeof value !== "number") return value;
|
|
25038
25074
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25846,7 +25882,7 @@ class PixldocsRenderer {
|
|
|
25846
25882
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25847
25883
|
}
|
|
25848
25884
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25849
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
25885
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CRmMt10E.js");
|
|
25850
25886
|
const prepared = preparePagesForExport(
|
|
25851
25887
|
cloned.pages,
|
|
25852
25888
|
canvasWidth,
|
|
@@ -28166,7 +28202,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
28166
28202
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
28167
28203
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
28168
28204
|
try {
|
|
28169
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
28205
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CRmMt10E.js");
|
|
28170
28206
|
try {
|
|
28171
28207
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
28172
28208
|
} catch {
|
|
@@ -28566,4 +28602,4 @@ export {
|
|
|
28566
28602
|
buildTeaserBlurFlatKeys as y,
|
|
28567
28603
|
collectFontDescriptorsFromConfig as z
|
|
28568
28604
|
};
|
|
28569
|
-
//# sourceMappingURL=index-
|
|
28605
|
+
//# sourceMappingURL=index-BMosbEqF.js.map
|