@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
|
@@ -13530,6 +13530,55 @@ const PageCanvas = react.forwardRef(
|
|
|
13530
13530
|
if (!found) return null;
|
|
13531
13531
|
return { left: minX, top: minY, right: maxX, bottom: maxY };
|
|
13532
13532
|
};
|
|
13533
|
+
const groupFabricOrientedBBox = (g) => {
|
|
13534
|
+
var _a2;
|
|
13535
|
+
const memberIds = new Set(getAllElementIds(g.children ?? []));
|
|
13536
|
+
if (memberIds.size === 0) return null;
|
|
13537
|
+
const members = [];
|
|
13538
|
+
for (const o of fabricCanvas.getObjects()) {
|
|
13539
|
+
const oid = getObjectId(o);
|
|
13540
|
+
if (oid && memberIds.has(oid)) members.push(o);
|
|
13541
|
+
}
|
|
13542
|
+
if (members.length === 0) return null;
|
|
13543
|
+
const a0 = ((members[0].angle ?? 0) % 360 + 360) % 360;
|
|
13544
|
+
const TOL = 0.5;
|
|
13545
|
+
for (const m of members) {
|
|
13546
|
+
const a = ((m.angle ?? 0) % 360 + 360) % 360;
|
|
13547
|
+
const diff = Math.min(Math.abs(a - a0), 360 - Math.abs(a - a0));
|
|
13548
|
+
if (diff > TOL) return null;
|
|
13549
|
+
}
|
|
13550
|
+
const rad = -a0 * Math.PI / 180;
|
|
13551
|
+
const cos = Math.cos(rad), sin = Math.sin(rad);
|
|
13552
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
13553
|
+
let found = false;
|
|
13554
|
+
for (const m of members) {
|
|
13555
|
+
(_a2 = m.setCoords) == null ? void 0 : _a2.call(m);
|
|
13556
|
+
const aC = m.aCoords;
|
|
13557
|
+
if (!aC) continue;
|
|
13558
|
+
for (const k of ["tl", "tr", "br", "bl"]) {
|
|
13559
|
+
const p = aC[k];
|
|
13560
|
+
if (!p) continue;
|
|
13561
|
+
const xr = p.x * cos - p.y * sin;
|
|
13562
|
+
const yr = p.x * sin + p.y * cos;
|
|
13563
|
+
if (xr < minX) minX = xr;
|
|
13564
|
+
if (yr < minY) minY = yr;
|
|
13565
|
+
if (xr > maxX) maxX = xr;
|
|
13566
|
+
if (yr > maxY) maxY = yr;
|
|
13567
|
+
found = true;
|
|
13568
|
+
}
|
|
13569
|
+
}
|
|
13570
|
+
if (!found) return null;
|
|
13571
|
+
const radBack = a0 * Math.PI / 180;
|
|
13572
|
+
const cb = Math.cos(radBack), sb = Math.sin(radBack);
|
|
13573
|
+
const toCanvas = (x, y) => ({ x: x * cb - y * sb, y: x * sb + y * cb });
|
|
13574
|
+
const corners = [
|
|
13575
|
+
toCanvas(minX, minY),
|
|
13576
|
+
toCanvas(maxX, minY),
|
|
13577
|
+
toCanvas(maxX, maxY),
|
|
13578
|
+
toCanvas(minX, maxY)
|
|
13579
|
+
];
|
|
13580
|
+
return { corners, angle: a0 };
|
|
13581
|
+
};
|
|
13533
13582
|
const pickGroupAtPointer = (px, py, children, activeEditingGroupId) => {
|
|
13534
13583
|
let pick = null;
|
|
13535
13584
|
for (const node of children) {
|
|
@@ -13776,6 +13825,21 @@ const PageCanvas = react.forwardRef(
|
|
|
13776
13825
|
const activeEditingGroupId = fabricCanvas.__activeEditingGroupId ?? null;
|
|
13777
13826
|
const groupPick = pickGroupAtPointer(pointer.x, pointer.y, childrenNow, activeEditingGroupId);
|
|
13778
13827
|
if (groupPick && !activeIds.has(groupPick.group.id)) {
|
|
13828
|
+
const oriented = groupFabricOrientedBBox(groupPick.group);
|
|
13829
|
+
if (oriented) {
|
|
13830
|
+
const pts = oriented.corners.map((p) => `${p.x},${p.y}`).join(" ");
|
|
13831
|
+
const xs = oriented.corners.map((p) => p.x);
|
|
13832
|
+
const ys = oriented.corners.map((p) => p.y);
|
|
13833
|
+
setHoverBounds({
|
|
13834
|
+
left: Math.min(...xs),
|
|
13835
|
+
top: Math.min(...ys),
|
|
13836
|
+
width: Math.max(...xs) - Math.min(...xs),
|
|
13837
|
+
height: Math.max(...ys) - Math.min(...ys),
|
|
13838
|
+
angle: oriented.angle,
|
|
13839
|
+
points: pts
|
|
13840
|
+
});
|
|
13841
|
+
return;
|
|
13842
|
+
}
|
|
13779
13843
|
const b = groupFabricUnionBBox(groupPick.group);
|
|
13780
13844
|
if (b) {
|
|
13781
13845
|
setHoverBounds({
|
|
@@ -13791,14 +13855,31 @@ const PageCanvas = react.forwardRef(
|
|
|
13791
13855
|
const isHoveringSelected = !!(tid && activeIds.has(tid));
|
|
13792
13856
|
if (t && tid && tid !== "__background__" && !isHoveringSelected) {
|
|
13793
13857
|
t.setCoords();
|
|
13794
|
-
const
|
|
13795
|
-
|
|
13796
|
-
|
|
13797
|
-
|
|
13798
|
-
|
|
13799
|
-
|
|
13800
|
-
|
|
13801
|
-
|
|
13858
|
+
const ang = ((t.angle ?? 0) % 360 + 360) % 360;
|
|
13859
|
+
const aC = t.aCoords;
|
|
13860
|
+
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)) {
|
|
13861
|
+
const corners = [aC.tl, aC.tr, aC.br, aC.bl];
|
|
13862
|
+
const pts = corners.map((p) => `${p.x},${p.y}`).join(" ");
|
|
13863
|
+
const xs = corners.map((p) => p.x);
|
|
13864
|
+
const ys = corners.map((p) => p.y);
|
|
13865
|
+
setHoverBounds({
|
|
13866
|
+
left: Math.min(...xs),
|
|
13867
|
+
top: Math.min(...ys),
|
|
13868
|
+
width: Math.max(...xs) - Math.min(...xs),
|
|
13869
|
+
height: Math.max(...ys) - Math.min(...ys),
|
|
13870
|
+
angle: ang,
|
|
13871
|
+
points: pts
|
|
13872
|
+
});
|
|
13873
|
+
} else {
|
|
13874
|
+
const br = t.getBoundingRect();
|
|
13875
|
+
setHoverBounds({
|
|
13876
|
+
left: br.left,
|
|
13877
|
+
top: br.top,
|
|
13878
|
+
width: br.width,
|
|
13879
|
+
height: br.height,
|
|
13880
|
+
angle: 0
|
|
13881
|
+
});
|
|
13882
|
+
}
|
|
13802
13883
|
} else {
|
|
13803
13884
|
setHoverBounds(null);
|
|
13804
13885
|
}
|
|
@@ -18750,7 +18831,18 @@ const PageCanvas = react.forwardRef(
|
|
|
18750
18831
|
className: "absolute inset-0 pointer-events-none",
|
|
18751
18832
|
style: { width: scaledWidth, height: scaledHeight },
|
|
18752
18833
|
viewBox: `0 0 ${canvasWidth} ${canvasHeight}`,
|
|
18753
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
18834
|
+
children: hoverBounds.points ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
18835
|
+
"polygon",
|
|
18836
|
+
{
|
|
18837
|
+
points: hoverBounds.points,
|
|
18838
|
+
fill: "none",
|
|
18839
|
+
stroke: SELECTION_PRIMARY,
|
|
18840
|
+
strokeWidth: 2,
|
|
18841
|
+
vectorEffect: "non-scaling-stroke",
|
|
18842
|
+
strokeDasharray: "0",
|
|
18843
|
+
opacity: 1
|
|
18844
|
+
}
|
|
18845
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
18754
18846
|
"rect",
|
|
18755
18847
|
{
|
|
18756
18848
|
x: hoverBounds.left,
|
|
@@ -24900,9 +24992,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24900
24992
|
}
|
|
24901
24993
|
return svgString;
|
|
24902
24994
|
}
|
|
24903
|
-
const resolvedPackageVersion = "0.5.
|
|
24995
|
+
const resolvedPackageVersion = "0.5.388";
|
|
24904
24996
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24905
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24997
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.388";
|
|
24906
24998
|
const roundParityValue = (value) => {
|
|
24907
24999
|
if (typeof value !== "number") return value;
|
|
24908
25000
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25716,7 +25808,7 @@ class PixldocsRenderer {
|
|
|
25716
25808
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25717
25809
|
}
|
|
25718
25810
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25719
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
25811
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BMKSimKF.cjs"));
|
|
25720
25812
|
const prepared = preparePagesForExport(
|
|
25721
25813
|
cloned.pages,
|
|
25722
25814
|
canvasWidth,
|
|
@@ -28036,7 +28128,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
28036
28128
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
28037
28129
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
28038
28130
|
try {
|
|
28039
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
28131
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BMKSimKF.cjs"));
|
|
28040
28132
|
try {
|
|
28041
28133
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
28042
28134
|
} catch {
|
|
@@ -28433,4 +28525,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
28433
28525
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
28434
28526
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
28435
28527
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
28436
|
-
//# sourceMappingURL=index-
|
|
28528
|
+
//# sourceMappingURL=index-CnSzRkFP.cjs.map
|