@pixldocs/canvas-renderer 0.5.386 → 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-BBprK5c2.js → index-CiGVJ3wk.js} +111 -15
- package/dist/index-CiGVJ3wk.js.map +1 -0
- package/dist/{index-DPK4VKN5.cjs → index-CnSzRkFP.cjs} +111 -15
- package/dist/index-CnSzRkFP.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-Ch4wgY_V.cjs → vectorPdfExport-BMKSimKF.cjs} +4 -4
- package/dist/{vectorPdfExport-Ch4wgY_V.cjs.map → vectorPdfExport-BMKSimKF.cjs.map} +1 -1
- package/dist/{vectorPdfExport-CuXE8W_Q.js → vectorPdfExport-txxMjll_.js} +4 -4
- package/dist/{vectorPdfExport-CuXE8W_Q.js.map → vectorPdfExport-txxMjll_.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-BBprK5c2.js.map +0 -1
- package/dist/index-DPK4VKN5.cjs.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
|
}
|
|
@@ -14299,7 +14380,10 @@ const PageCanvas = forwardRef(
|
|
|
14299
14380
|
continue;
|
|
14300
14381
|
}
|
|
14301
14382
|
if (!(child instanceof fabric.Textbox)) continue;
|
|
14302
|
-
|
|
14383
|
+
if (child.__asLiveOrigAngle == null) {
|
|
14384
|
+
child.__asLiveOrigAngle = child.angle ?? 0;
|
|
14385
|
+
}
|
|
14386
|
+
const childAngleDeg = child.__asLiveOrigAngle;
|
|
14303
14387
|
const asSx = isXSide ? sAxis : 1;
|
|
14304
14388
|
const asSy = isXSide ? 1 : sAxis;
|
|
14305
14389
|
const theta = fabric.util.degreesToRadians(childAngleDeg);
|
|
@@ -14731,6 +14815,7 @@ const PageCanvas = forwardRef(
|
|
|
14731
14815
|
delete child.__asLiveOrigW;
|
|
14732
14816
|
delete child.__asLiveOrigH;
|
|
14733
14817
|
delete child.__asLiveRotSnap;
|
|
14818
|
+
delete child.__asLiveOrigAngle;
|
|
14734
14819
|
}
|
|
14735
14820
|
}
|
|
14736
14821
|
} catch {
|
|
@@ -18728,7 +18813,18 @@ const PageCanvas = forwardRef(
|
|
|
18728
18813
|
className: "absolute inset-0 pointer-events-none",
|
|
18729
18814
|
style: { width: scaledWidth, height: scaledHeight },
|
|
18730
18815
|
viewBox: `0 0 ${canvasWidth} ${canvasHeight}`,
|
|
18731
|
-
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(
|
|
18732
18828
|
"rect",
|
|
18733
18829
|
{
|
|
18734
18830
|
x: hoverBounds.left,
|
|
@@ -24878,9 +24974,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24878
24974
|
}
|
|
24879
24975
|
return svgString;
|
|
24880
24976
|
}
|
|
24881
|
-
const resolvedPackageVersion = "0.5.
|
|
24977
|
+
const resolvedPackageVersion = "0.5.388";
|
|
24882
24978
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24883
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24979
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.388";
|
|
24884
24980
|
const roundParityValue = (value) => {
|
|
24885
24981
|
if (typeof value !== "number") return value;
|
|
24886
24982
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25694,7 +25790,7 @@ class PixldocsRenderer {
|
|
|
25694
25790
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25695
25791
|
}
|
|
25696
25792
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25697
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
25793
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-txxMjll_.js");
|
|
25698
25794
|
const prepared = preparePagesForExport(
|
|
25699
25795
|
cloned.pages,
|
|
25700
25796
|
canvasWidth,
|
|
@@ -28014,7 +28110,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
28014
28110
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
28015
28111
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
28016
28112
|
try {
|
|
28017
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
28113
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-txxMjll_.js");
|
|
28018
28114
|
try {
|
|
28019
28115
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
28020
28116
|
} catch {
|
|
@@ -28414,4 +28510,4 @@ export {
|
|
|
28414
28510
|
buildTeaserBlurFlatKeys as y,
|
|
28415
28511
|
collectFontDescriptorsFromConfig as z
|
|
28416
28512
|
};
|
|
28417
|
-
//# sourceMappingURL=index-
|
|
28513
|
+
//# sourceMappingURL=index-CiGVJ3wk.js.map
|