@pixldocs/canvas-renderer 0.5.387 → 0.5.388
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-Dojo9KpB.js → index-CiGVJ3wk.js} +106 -14
- package/dist/index-CiGVJ3wk.js.map +1 -0
- package/dist/{index-C76ELpPn.cjs → index-CnSzRkFP.cjs} +106 -14
- package/dist/index-CnSzRkFP.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-C_LKrBRO.cjs → vectorPdfExport-BMKSimKF.cjs} +4 -4
- package/dist/{vectorPdfExport-C_LKrBRO.cjs.map → vectorPdfExport-BMKSimKF.cjs.map} +1 -1
- package/dist/{vectorPdfExport-DNhNOmXo.js → vectorPdfExport-txxMjll_.js} +4 -4
- package/dist/{vectorPdfExport-DNhNOmXo.js.map → vectorPdfExport-txxMjll_.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-C76ELpPn.cjs.map +0 -1
- package/dist/index-Dojo9KpB.js.map +0 -1
|
@@ -13512,6 +13512,55 @@ const PageCanvas = forwardRef(
|
|
|
13512
13512
|
if (!found) return null;
|
|
13513
13513
|
return { left: minX, top: minY, right: maxX, bottom: maxY };
|
|
13514
13514
|
};
|
|
13515
|
+
const groupFabricOrientedBBox = (g) => {
|
|
13516
|
+
var _a2;
|
|
13517
|
+
const memberIds = new Set(getAllElementIds(g.children ?? []));
|
|
13518
|
+
if (memberIds.size === 0) return null;
|
|
13519
|
+
const members = [];
|
|
13520
|
+
for (const o of fabricCanvas.getObjects()) {
|
|
13521
|
+
const oid = getObjectId(o);
|
|
13522
|
+
if (oid && memberIds.has(oid)) members.push(o);
|
|
13523
|
+
}
|
|
13524
|
+
if (members.length === 0) return null;
|
|
13525
|
+
const a0 = ((members[0].angle ?? 0) % 360 + 360) % 360;
|
|
13526
|
+
const TOL = 0.5;
|
|
13527
|
+
for (const m of members) {
|
|
13528
|
+
const a = ((m.angle ?? 0) % 360 + 360) % 360;
|
|
13529
|
+
const diff = Math.min(Math.abs(a - a0), 360 - Math.abs(a - a0));
|
|
13530
|
+
if (diff > TOL) return null;
|
|
13531
|
+
}
|
|
13532
|
+
const rad = -a0 * Math.PI / 180;
|
|
13533
|
+
const cos = Math.cos(rad), sin = Math.sin(rad);
|
|
13534
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
13535
|
+
let found = false;
|
|
13536
|
+
for (const m of members) {
|
|
13537
|
+
(_a2 = m.setCoords) == null ? void 0 : _a2.call(m);
|
|
13538
|
+
const aC = m.aCoords;
|
|
13539
|
+
if (!aC) continue;
|
|
13540
|
+
for (const k of ["tl", "tr", "br", "bl"]) {
|
|
13541
|
+
const p = aC[k];
|
|
13542
|
+
if (!p) continue;
|
|
13543
|
+
const xr = p.x * cos - p.y * sin;
|
|
13544
|
+
const yr = p.x * sin + p.y * cos;
|
|
13545
|
+
if (xr < minX) minX = xr;
|
|
13546
|
+
if (yr < minY) minY = yr;
|
|
13547
|
+
if (xr > maxX) maxX = xr;
|
|
13548
|
+
if (yr > maxY) maxY = yr;
|
|
13549
|
+
found = true;
|
|
13550
|
+
}
|
|
13551
|
+
}
|
|
13552
|
+
if (!found) return null;
|
|
13553
|
+
const radBack = a0 * Math.PI / 180;
|
|
13554
|
+
const cb = Math.cos(radBack), sb = Math.sin(radBack);
|
|
13555
|
+
const toCanvas = (x, y) => ({ x: x * cb - y * sb, y: x * sb + y * cb });
|
|
13556
|
+
const corners = [
|
|
13557
|
+
toCanvas(minX, minY),
|
|
13558
|
+
toCanvas(maxX, minY),
|
|
13559
|
+
toCanvas(maxX, maxY),
|
|
13560
|
+
toCanvas(minX, maxY)
|
|
13561
|
+
];
|
|
13562
|
+
return { corners, angle: a0 };
|
|
13563
|
+
};
|
|
13515
13564
|
const pickGroupAtPointer = (px, py, children, activeEditingGroupId) => {
|
|
13516
13565
|
let pick = null;
|
|
13517
13566
|
for (const node of children) {
|
|
@@ -13758,6 +13807,21 @@ const PageCanvas = forwardRef(
|
|
|
13758
13807
|
const activeEditingGroupId = fabricCanvas.__activeEditingGroupId ?? null;
|
|
13759
13808
|
const groupPick = pickGroupAtPointer(pointer.x, pointer.y, childrenNow, activeEditingGroupId);
|
|
13760
13809
|
if (groupPick && !activeIds.has(groupPick.group.id)) {
|
|
13810
|
+
const oriented = groupFabricOrientedBBox(groupPick.group);
|
|
13811
|
+
if (oriented) {
|
|
13812
|
+
const pts = oriented.corners.map((p) => `${p.x},${p.y}`).join(" ");
|
|
13813
|
+
const xs = oriented.corners.map((p) => p.x);
|
|
13814
|
+
const ys = oriented.corners.map((p) => p.y);
|
|
13815
|
+
setHoverBounds({
|
|
13816
|
+
left: Math.min(...xs),
|
|
13817
|
+
top: Math.min(...ys),
|
|
13818
|
+
width: Math.max(...xs) - Math.min(...xs),
|
|
13819
|
+
height: Math.max(...ys) - Math.min(...ys),
|
|
13820
|
+
angle: oriented.angle,
|
|
13821
|
+
points: pts
|
|
13822
|
+
});
|
|
13823
|
+
return;
|
|
13824
|
+
}
|
|
13761
13825
|
const b = groupFabricUnionBBox(groupPick.group);
|
|
13762
13826
|
if (b) {
|
|
13763
13827
|
setHoverBounds({
|
|
@@ -13773,14 +13837,31 @@ const PageCanvas = forwardRef(
|
|
|
13773
13837
|
const isHoveringSelected = !!(tid && activeIds.has(tid));
|
|
13774
13838
|
if (t && tid && tid !== "__background__" && !isHoveringSelected) {
|
|
13775
13839
|
t.setCoords();
|
|
13776
|
-
const
|
|
13777
|
-
|
|
13778
|
-
|
|
13779
|
-
|
|
13780
|
-
|
|
13781
|
-
|
|
13782
|
-
|
|
13783
|
-
|
|
13840
|
+
const ang = ((t.angle ?? 0) % 360 + 360) % 360;
|
|
13841
|
+
const aC = t.aCoords;
|
|
13842
|
+
if (ang > 0.5 && (aC == null ? void 0 : aC.tl) && (aC == null ? void 0 : aC.tr) && (aC == null ? void 0 : aC.br) && (aC == null ? void 0 : aC.bl)) {
|
|
13843
|
+
const corners = [aC.tl, aC.tr, aC.br, aC.bl];
|
|
13844
|
+
const pts = corners.map((p) => `${p.x},${p.y}`).join(" ");
|
|
13845
|
+
const xs = corners.map((p) => p.x);
|
|
13846
|
+
const ys = corners.map((p) => p.y);
|
|
13847
|
+
setHoverBounds({
|
|
13848
|
+
left: Math.min(...xs),
|
|
13849
|
+
top: Math.min(...ys),
|
|
13850
|
+
width: Math.max(...xs) - Math.min(...xs),
|
|
13851
|
+
height: Math.max(...ys) - Math.min(...ys),
|
|
13852
|
+
angle: ang,
|
|
13853
|
+
points: pts
|
|
13854
|
+
});
|
|
13855
|
+
} else {
|
|
13856
|
+
const br = t.getBoundingRect();
|
|
13857
|
+
setHoverBounds({
|
|
13858
|
+
left: br.left,
|
|
13859
|
+
top: br.top,
|
|
13860
|
+
width: br.width,
|
|
13861
|
+
height: br.height,
|
|
13862
|
+
angle: 0
|
|
13863
|
+
});
|
|
13864
|
+
}
|
|
13784
13865
|
} else {
|
|
13785
13866
|
setHoverBounds(null);
|
|
13786
13867
|
}
|
|
@@ -18732,7 +18813,18 @@ const PageCanvas = forwardRef(
|
|
|
18732
18813
|
className: "absolute inset-0 pointer-events-none",
|
|
18733
18814
|
style: { width: scaledWidth, height: scaledHeight },
|
|
18734
18815
|
viewBox: `0 0 ${canvasWidth} ${canvasHeight}`,
|
|
18735
|
-
children: /* @__PURE__ */ jsx(
|
|
18816
|
+
children: hoverBounds.points ? /* @__PURE__ */ jsx(
|
|
18817
|
+
"polygon",
|
|
18818
|
+
{
|
|
18819
|
+
points: hoverBounds.points,
|
|
18820
|
+
fill: "none",
|
|
18821
|
+
stroke: SELECTION_PRIMARY,
|
|
18822
|
+
strokeWidth: 2,
|
|
18823
|
+
vectorEffect: "non-scaling-stroke",
|
|
18824
|
+
strokeDasharray: "0",
|
|
18825
|
+
opacity: 1
|
|
18826
|
+
}
|
|
18827
|
+
) : /* @__PURE__ */ jsx(
|
|
18736
18828
|
"rect",
|
|
18737
18829
|
{
|
|
18738
18830
|
x: hoverBounds.left,
|
|
@@ -24882,9 +24974,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24882
24974
|
}
|
|
24883
24975
|
return svgString;
|
|
24884
24976
|
}
|
|
24885
|
-
const resolvedPackageVersion = "0.5.
|
|
24977
|
+
const resolvedPackageVersion = "0.5.388";
|
|
24886
24978
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24887
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24979
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.388";
|
|
24888
24980
|
const roundParityValue = (value) => {
|
|
24889
24981
|
if (typeof value !== "number") return value;
|
|
24890
24982
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25698,7 +25790,7 @@ class PixldocsRenderer {
|
|
|
25698
25790
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25699
25791
|
}
|
|
25700
25792
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25701
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
25793
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-txxMjll_.js");
|
|
25702
25794
|
const prepared = preparePagesForExport(
|
|
25703
25795
|
cloned.pages,
|
|
25704
25796
|
canvasWidth,
|
|
@@ -28018,7 +28110,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
28018
28110
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
28019
28111
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
28020
28112
|
try {
|
|
28021
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
28113
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-txxMjll_.js");
|
|
28022
28114
|
try {
|
|
28023
28115
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
28024
28116
|
} catch {
|
|
@@ -28418,4 +28510,4 @@ export {
|
|
|
28418
28510
|
buildTeaserBlurFlatKeys as y,
|
|
28419
28511
|
collectFontDescriptorsFromConfig as z
|
|
28420
28512
|
};
|
|
28421
|
-
//# sourceMappingURL=index-
|
|
28513
|
+
//# sourceMappingURL=index-CiGVJ3wk.js.map
|