@pixldocs/canvas-renderer 0.5.392 → 0.5.393
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-B0qSXTeJ.cjs → index-B0Ej1RxQ.cjs} +46 -15
- package/dist/index-B0Ej1RxQ.cjs.map +1 -0
- package/dist/{index-BMosbEqF.js → index-CaUhUYZP.js} +46 -15
- package/dist/index-CaUhUYZP.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-DhWvQzRg.cjs → vectorPdfExport-BWhYgu3c.cjs} +4 -4
- package/dist/{vectorPdfExport-DhWvQzRg.cjs.map → vectorPdfExport-BWhYgu3c.cjs.map} +1 -1
- package/dist/{vectorPdfExport-CRmMt10E.js → vectorPdfExport-DBJQBWsb.js} +4 -4
- package/dist/{vectorPdfExport-CRmMt10E.js.map → vectorPdfExport-DBJQBWsb.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-B0qSXTeJ.cjs.map +0 -1
- package/dist/index-BMosbEqF.js.map +0 -1
|
@@ -13555,7 +13555,7 @@ const PageCanvas = forwardRef(
|
|
|
13555
13555
|
return { left: minX, top: minY, right: maxX, bottom: maxY };
|
|
13556
13556
|
};
|
|
13557
13557
|
const groupFabricOrientedBBox = (g) => {
|
|
13558
|
-
var _a2;
|
|
13558
|
+
var _a2, _b2;
|
|
13559
13559
|
const memberIds = new Set(getAllElementIds(g.children ?? []));
|
|
13560
13560
|
if (memberIds.size === 0) return null;
|
|
13561
13561
|
const members = [];
|
|
@@ -13564,25 +13564,56 @@ const PageCanvas = forwardRef(
|
|
|
13564
13564
|
if (oid && memberIds.has(oid)) members.push(o);
|
|
13565
13565
|
}
|
|
13566
13566
|
if (members.length === 0) return null;
|
|
13567
|
-
const TOL =
|
|
13567
|
+
const TOL = 2;
|
|
13568
|
+
const norm = (a) => {
|
|
13569
|
+
const n = (a % 360 + 360) % 360;
|
|
13570
|
+
return n > 180 ? n - 360 : n;
|
|
13571
|
+
};
|
|
13572
|
+
const angleDelta = (a, b) => {
|
|
13573
|
+
const d = Math.abs(norm(a) - norm(b));
|
|
13574
|
+
return Math.min(d, 360 - d);
|
|
13575
|
+
};
|
|
13576
|
+
const worldPoints = [];
|
|
13577
|
+
for (const m of members) {
|
|
13578
|
+
(_a2 = m.setCoords) == null ? void 0 : _a2.call(m);
|
|
13579
|
+
const aC = m.aCoords;
|
|
13580
|
+
if (!aC) continue;
|
|
13581
|
+
for (const k of ["tl", "tr", "br", "bl"]) {
|
|
13582
|
+
const p = aC[k];
|
|
13583
|
+
if (p) worldPoints.push({ x: p.x, y: p.y });
|
|
13584
|
+
}
|
|
13585
|
+
}
|
|
13586
|
+
const orientedAreaForAngle = (angle) => {
|
|
13587
|
+
if (worldPoints.length === 0) return Number.POSITIVE_INFINITY;
|
|
13588
|
+
const r = -angle * Math.PI / 180;
|
|
13589
|
+
const c = Math.cos(r), s = Math.sin(r);
|
|
13590
|
+
let nX = Infinity, nY = Infinity, xX = -Infinity, xY = -Infinity;
|
|
13591
|
+
for (const p of worldPoints) {
|
|
13592
|
+
const xr = p.x * c - p.y * s;
|
|
13593
|
+
const yr = p.x * s + p.y * c;
|
|
13594
|
+
if (xr < nX) nX = xr;
|
|
13595
|
+
if (yr < nY) nY = yr;
|
|
13596
|
+
if (xr > xX) xX = xr;
|
|
13597
|
+
if (yr > xY) xY = yr;
|
|
13598
|
+
}
|
|
13599
|
+
return Math.max(1, (xX - nX) * (xY - nY));
|
|
13600
|
+
};
|
|
13568
13601
|
const buckets = [];
|
|
13569
13602
|
for (const m of members) {
|
|
13570
|
-
const a = (
|
|
13571
|
-
const b = buckets.find((x) =>
|
|
13572
|
-
const d = Math.min(Math.abs(x.angle - a), 360 - Math.abs(x.angle - a));
|
|
13573
|
-
return d <= TOL;
|
|
13574
|
-
});
|
|
13603
|
+
const a = norm(m.angle ?? 0);
|
|
13604
|
+
const b = buckets.find((x) => angleDelta(x.angle, a) <= TOL);
|
|
13575
13605
|
if (b) b.count++;
|
|
13576
|
-
else buckets.push({ angle: a, count: 1 });
|
|
13606
|
+
else buckets.push({ angle: a, count: 1, area: Number.POSITIVE_INFINITY });
|
|
13577
13607
|
}
|
|
13578
|
-
|
|
13608
|
+
for (const b of buckets) b.area = orientedAreaForAngle(b.angle);
|
|
13609
|
+
buckets.sort((a, b) => b.count - a.count || a.area - b.area || Math.abs(b.angle) - Math.abs(a.angle));
|
|
13579
13610
|
const a0 = buckets[0].angle;
|
|
13580
13611
|
const rad = -a0 * Math.PI / 180;
|
|
13581
13612
|
const cos = Math.cos(rad), sin = Math.sin(rad);
|
|
13582
13613
|
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
13583
13614
|
let found = false;
|
|
13584
13615
|
for (const m of members) {
|
|
13585
|
-
(
|
|
13616
|
+
(_b2 = m.setCoords) == null ? void 0 : _b2.call(m);
|
|
13586
13617
|
const aC = m.aCoords;
|
|
13587
13618
|
if (!aC) continue;
|
|
13588
13619
|
for (const k of ["tl", "tr", "br", "bl"]) {
|
|
@@ -25066,9 +25097,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
25066
25097
|
}
|
|
25067
25098
|
return svgString;
|
|
25068
25099
|
}
|
|
25069
|
-
const resolvedPackageVersion = "0.5.
|
|
25100
|
+
const resolvedPackageVersion = "0.5.393";
|
|
25070
25101
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
25071
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
25102
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.393";
|
|
25072
25103
|
const roundParityValue = (value) => {
|
|
25073
25104
|
if (typeof value !== "number") return value;
|
|
25074
25105
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25882,7 +25913,7 @@ class PixldocsRenderer {
|
|
|
25882
25913
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25883
25914
|
}
|
|
25884
25915
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25885
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
25916
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DBJQBWsb.js");
|
|
25886
25917
|
const prepared = preparePagesForExport(
|
|
25887
25918
|
cloned.pages,
|
|
25888
25919
|
canvasWidth,
|
|
@@ -28202,7 +28233,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
28202
28233
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
28203
28234
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
28204
28235
|
try {
|
|
28205
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
28236
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DBJQBWsb.js");
|
|
28206
28237
|
try {
|
|
28207
28238
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
28208
28239
|
} catch {
|
|
@@ -28602,4 +28633,4 @@ export {
|
|
|
28602
28633
|
buildTeaserBlurFlatKeys as y,
|
|
28603
28634
|
collectFontDescriptorsFromConfig as z
|
|
28604
28635
|
};
|
|
28605
|
-
//# sourceMappingURL=index-
|
|
28636
|
+
//# sourceMappingURL=index-CaUhUYZP.js.map
|