@johnmorrisdotca/kyogijo-stadiums 0.35.0 → 0.37.0
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/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/dist/crowd.d.ts +3 -1
- package/dist/crowd.draw.js +11 -1
- package/dist/crowd.js +1 -0
- package/dist/draw.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/mow.d.ts +4 -2
- package/dist/mow.js +46 -2
- package/dist/multi.draw.js +2 -1
- package/dist/multi.turn.js +1 -1
- package/dist/multi.types.d.ts +2 -1
- package/dist/strings.d.ts +1 -1
- package/dist/strings.js +2 -2
- package/dist/surfaces/soccer.js +4 -4
- package/dist/turn-entry.d.ts +1 -0
- package/dist/turn.kit.d.ts +2 -2
- package/dist/turn.model.js +1 -1
- package/dist/turn.style.js +3 -0
- package/dist/types.d.ts +25 -2
- package/dist/uprights.js +2 -0
- package/dist/venue.boards.d.ts +107 -0
- package/dist/venue.boards.js +267 -0
- package/dist/venue.d.ts +8 -1
- package/dist/venue.js +40 -11
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,20 @@ All notable changes to this project are written here. The format follows
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.37.0] - 2026-10-20
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **LED boards** (`boards`, [the LED boards](./docs/venues.md#led-boards), `src/venue.boards.ts`): the ribbon boards along the fascia between the seating levels, and a scoreboard hung over the middle of the playing surface, for every real venue (the thirty-two arenas of the NHL, BC Place, Lumen Field, Korakuen Hall and the ballparks), for the usual stands, in a district, and, as `stadium: { boards }`, round a tournament hall. `venue: { boards: true | { ribbon, scoreboard, colors, pattern, score } }` in the 3D view, `crowd: { boards }` in the plan (and read by the 3D view where `venue.boards` says nothing); off by default, and a drawing without it is exactly what it was. The content is generic and ours: panels of colour in `bands`, `blocks`, `chevrons` or `waves`, and a plain score in seven-segment digits (paths, no font); the colours are the asker's, else the crowd's `home` and `away`, else amber, blue and white (any other string than a hex, `rgb()`, `hsl()` or a name is ignored). In 3D a ribbon is the top 3.8 feet of the suite level's wall, a plane of its own (the walk below it is the walk less that strip; a venue with one level has its ribbon on the front of that level), and the scoreboard is four faces with the score on each, a ring of display under them, a cap and a strut, hung over the surface by a fifth of its longer side and sized by it (an arena's is about 28 by 19 feet). A ballpark has no scoreboard over the field, a hall has the layout's own (only ribbons there), and a score drawing's own scoreboard replaces the venue's. Every lit shape carries the class `u-led` (`ky-cr-led` in the plan) over a dark housing, for a lighting layer to make glow; the planes are the kinds `ribbon` and `hung-board` (uprights `ribbon-boards` and `hung-board`, said in words in English and Japanese). `turn.update(options, { venue: { boards } })` changes them while the view turns. New exports: `LedBoardOptions` and `LedBoardPattern`. About 17 KB of source in the one new module (`dist/venue.boards.js`), a ribbon of a 32-arena venue being a few dozen planes.
|
|
15
|
+
- **An LED boards switch on the demo** (kept in the address as `boards=1`): a button in the bar over the venues page's view and the home page's featured arena, which draws it in the plan and in 3D and, in 3D, changes it without stopping or sending back the turn; a checkbox on the stadiums, tournament layouts and district pages.
|
|
16
|
+
|
|
17
|
+
## [0.36.0] - 2026-10-20
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- **A diamond mowing pattern** (`stripePattern: "diamonds"`, `菱形` in the demo): the crosshatch of a ballpark's outfield, as in a photograph of T-Mobile Park. On a ballpark it is squares of 30 feet with their sides along the foul lines, from home plate out, lighter and darker alternately (two passes of 45-degree stripes crossing); on a football field and a soccer pitch it is squares of a band turned 45 degrees, one of them centred on the turf so that both ends are mown alike, whatever the size. It is cut to the fair ground or to the turf by a clip path. The infield grass stays one tone, and a separate infield pattern is not offered: the pattern is the outfield's. [Theming](./docs/theming.md), the gallery's mowing sections.
|
|
22
|
+
- **The demo's Mowing choice is for every grass sport**: a football field and a ballpark have it too (it was the soccer pitch's alone), with Diamonds among the choices; the soccer section of the home page shows the diamonds as one more card.
|
|
23
|
+
|
|
10
24
|
## [0.35.0] - 2026-10-20
|
|
11
25
|
|
|
12
26
|
### Added
|
package/README.md
CHANGED
|
@@ -581,7 +581,7 @@ console.log(layout.needs.length, layout.needs.width);
|
|
|
581
581
|
|
|
582
582
|
### The real venues
|
|
583
583
|
|
|
584
|
-
`crowd: { real: true }` draws an NHL arena in its building: the outline from OpenStreetMap, the rink lying along the building where it says so, and a plausible bowl of the seats, tiers and roof the sources give. All thirty-two arenas of the league, division by division ([the real venues](./docs/venues.md)). In 3D the demo's [venues page](https://johnmorrisdotca.github.io/kyogijo-stadiums/venues.html) turns while the pointer is over it, with the stands, walls, roof, building, markings and labels switched on the view while it turns.
|
|
584
|
+
`crowd: { real: true }` draws an NHL arena in its building: the outline from OpenStreetMap, the rink lying along the building where it says so, and a plausible bowl of the seats, tiers and roof the sources give. All thirty-two arenas of the league, division by division ([the real venues](./docs/venues.md)). `boards: true` adds LED ribbon boards and a hung scoreboard, generic content ([LED boards](./docs/venues.md#led-boards)). In 3D the demo's [venues page](https://johnmorrisdotca.github.io/kyogijo-stadiums/venues.html) turns while the pointer is over it, with the stands, walls, roof, LED boards, building, markings and labels switched on the view while it turns.
|
|
585
585
|
|
|
586
586
|
```ts
|
|
587
587
|
import { drawKyogijo } from "@johnmorrisdotca/kyogijo-stadiums";
|
package/dist/crowd.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CrowdShape, Side, Sport, SurfaceOptions } from "./types.ts";
|
|
1
|
+
import type { CrowdShape, LedBoardOptions, Side, Sport, SurfaceOptions } from "./types.ts";
|
|
2
2
|
export type Pt = [number, number];
|
|
3
3
|
export type Box = {
|
|
4
4
|
x: number;
|
|
@@ -188,6 +188,8 @@ export interface Crowd {
|
|
|
188
188
|
/** Whether the seats are drawn (a real venue's building is, without them, when this is false). */
|
|
189
189
|
stands: boolean;
|
|
190
190
|
detail: "auto" | "fine" | "plain";
|
|
191
|
+
/** The LED boards as asked (`resolveBoards` reads them), or `undefined` for none. */
|
|
192
|
+
boards: boolean | LedBoardOptions | undefined;
|
|
191
193
|
}
|
|
192
194
|
/** The crowd the options ask for, or `undefined` for none. */
|
|
193
195
|
export declare function resolveCrowd(value: SurfaceOptions["crowd"]): Crowd | undefined;
|
package/dist/crowd.draw.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// All of it is patterns, paths and rectangles, which every renderer of the package reads. The tiles are made from a seed with a generator of our own, so the same options give
|
|
4
4
|
// the same crowd. Written for this package; no photograph or other drawing was copied.
|
|
5
5
|
import { el, num } from "./format.js";
|
|
6
|
+
import { hangsOver, planRibbons, planScoreboard, resolveBoards } from "./venue.boards.js";
|
|
6
7
|
import { NORTH_AT, generator, outlinePath } from "./crowd.js";
|
|
7
8
|
/** The width and the height of a tile of the crowd, in feet, and the seats' pitch. */
|
|
8
9
|
const TILE = 14.4;
|
|
@@ -210,6 +211,12 @@ export function drawCrowd(stands, o) {
|
|
|
210
211
|
body += el("path", { d: outlinePath(ring.region), fill: "none", stroke: "#000", "stroke-opacity": 0.16, "stroke-width": 18 });
|
|
211
212
|
}
|
|
212
213
|
}
|
|
214
|
+
// The LED boards: a lit line along the front of the upper tiers, and the scoreboard over the middle of the surface (over it, in `over`).
|
|
215
|
+
const boards = resolveBoards(crowd.boards, { home: crowd.home, away: crowd.away });
|
|
216
|
+
if (boards?.ribbon === true)
|
|
217
|
+
body += planRibbons(stands, boards);
|
|
218
|
+
if (boards?.scoreboard === true && hangsOver(stands.sport))
|
|
219
|
+
over += planScoreboard(stands.box, boards);
|
|
213
220
|
for (const [x0, y0, x1, y1] of stands.covers)
|
|
214
221
|
body += el("rect", { class: o.ground, x: n1(x0), y: n1(y0), width: n1(x1 - x0), height: n1(y1 - y0) });
|
|
215
222
|
for (const g of stands.gaps) {
|
|
@@ -255,4 +262,7 @@ export const KYOGIJO_CROWD_STYLE = `
|
|
|
255
262
|
.kyogijo .ky-cr-north-n{fill:none;stroke:var(--ky-cr-rim);stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
|
|
256
263
|
.kyogijo .ky-cr-plaza{fill:var(--ky-apron);stroke:var(--ky-apron);stroke-width:8;stroke-linejoin:round}
|
|
257
264
|
.kyogijo .ky-cr-ez{fill:var(--ky-line);fill-opacity:.16}
|
|
258
|
-
.kyogijo .ky-cr-yard{stroke:var(--ky-line);stroke-opacity:.5;fill:none}
|
|
265
|
+
.kyogijo .ky-cr-yard{stroke:var(--ky-line);stroke-opacity:.5;fill:none}
|
|
266
|
+
.kyogijo .ky-cr-led-bed{fill:#0b0f14}
|
|
267
|
+
.kyogijo .ky-cr-led-line{fill:none;stroke:#0b0f14;stroke-linejoin:round}
|
|
268
|
+
.kyogijo .ky-cr-led{stroke-linecap:butt}`.trim();
|
package/dist/crowd.js
CHANGED
|
@@ -34,6 +34,7 @@ export function resolveCrowd(value) {
|
|
|
34
34
|
real: o.real === true,
|
|
35
35
|
stands: o.stands !== false,
|
|
36
36
|
detail: o.detail === "fine" || o.detail === "plain" ? o.detail : "auto",
|
|
37
|
+
boards: o.boards === true || (typeof o.boards === "object" && o.boards !== null) ? o.boards : undefined,
|
|
37
38
|
};
|
|
38
39
|
}
|
|
39
40
|
/** How full the stands are: a density, else attendance over capacity (the ground's, else the model's seats), else 0.85. */
|
package/dist/draw.js
CHANGED
|
@@ -222,7 +222,7 @@ const safeLength = (value) => {
|
|
|
222
222
|
return Number.isFinite(value) && value > 0 ? num(value) : undefined;
|
|
223
223
|
return typeof value === "string" && /^\d+(?:\.\d+)?(?:px|%|em|rem|vw|vh)?$/.test(value.trim()) ? value.trim() : undefined;
|
|
224
224
|
};
|
|
225
|
-
const PATTERNS = ["bands", "wide", "narrow", "lengthwise", "checks", "diagonal", "circles", "rings", "fan", "none"];
|
|
225
|
+
const PATTERNS = ["bands", "wide", "narrow", "lengthwise", "checks", "diagonal", "diamonds", "circles", "rings", "fan", "none"];
|
|
226
226
|
const GOALS = ["box", "line", "strip", "none"];
|
|
227
227
|
/** The pitch the options ask for: a `pitch` of the caller's, else the size a `ground` publishes, else none (the international pitch). */
|
|
228
228
|
export function pitchOf(o) {
|
package/dist/index.d.ts
CHANGED
|
@@ -76,4 +76,4 @@ export type { SoccerPitchClass, SoccerPitchId, SoccerSize, SoccerSpec } from "./
|
|
|
76
76
|
export { SOCCER_PROVIDER_IDS, SOCCER_PROVIDERS, frameMatrix, rescale, soccerFrame, soccerLandmarks } from "./surfaces/soccer-providers.ts";
|
|
77
77
|
export type { Rescaler, SoccerFrame, SoccerProvider, SoccerProviderId } from "./surfaces/soccer-providers.ts";
|
|
78
78
|
export { VERSION } from "./version.ts";
|
|
79
|
-
export type { AxesOptions, Box, Colors, CourtStyle, CrowdOptions, CrowdShape, Detail, DirectionOptions, BudoSport, FieldSport, FieldStyle, Fence, GoalInfo, GoalStyle, HardwoodOptions, Language, NetStyle, LineDash, LineWidth, LookName, Orientation, PoolSport, PoolStyle, QuirkName, QuirkOptions, RangeBox, PageantOptions, PageantStyle, RangeName, RangeNamed, ScoreOptions, Side, Size, Sport, StatusWord, StripePattern, SurfaceOptions, Team, TeamMark, Theme, WallOptions, } from "./types.ts";
|
|
79
|
+
export type { AxesOptions, Box, Colors, CourtStyle, CrowdOptions, LedBoardOptions, LedBoardPattern, CrowdShape, Detail, DirectionOptions, BudoSport, FieldSport, FieldStyle, Fence, GoalInfo, GoalStyle, HardwoodOptions, Language, NetStyle, LineDash, LineWidth, LookName, Orientation, PoolSport, PoolStyle, QuirkName, QuirkOptions, RangeBox, PageantOptions, PageantStyle, RangeName, RangeNamed, ScoreOptions, Side, Size, Sport, StatusWord, StripePattern, SurfaceOptions, Team, TeamMark, Theme, WallOptions, } from "./types.ts";
|
package/dist/mow.d.ts
CHANGED
|
@@ -18,7 +18,8 @@ export declare const oddCells: (length: number, cell: number) => number;
|
|
|
18
18
|
/**
|
|
19
19
|
* The lighter tone of a pattern on a rectangle of turf. `band` is the width of the usual stripe, along x; `wide` and `narrow` are twice and half of it.
|
|
20
20
|
* `bands` run across the turf (side by side along x), `lengthwise` along it, `checks` are squares of about `band`, `diagonal` are 45-degree stripes
|
|
21
|
-
* `band` wide across,
|
|
21
|
+
* `band` wide across, `diamonds` are the squares of `checks` turned 45 degrees (the crosshatch of a ballpark's outfield: two passes of 45-degree stripes, `band` wide
|
|
22
|
+
* across, crossing), laid so that a diamond is centred on the turf and both ends are mown alike, and `circles` are rings `band` wide about the middle. A pattern that is not one of these (`none`, `rings`, `fan`) has no tone here.
|
|
22
23
|
*/
|
|
23
24
|
export declare function mowTurf(pattern: StripePattern, turf: Turf, band: number): Mown;
|
|
24
25
|
/** A ballpark's fair ground, as the field of its stripes: how far it reaches either side of the line to centre field and how far out. */
|
|
@@ -30,7 +31,8 @@ export interface Park {
|
|
|
30
31
|
/**
|
|
31
32
|
* The lighter tone of a pattern on a ballpark: coordinates are the field's screen frame (x across, y minus the distance out from home plate). `band` is
|
|
32
33
|
* 30 feet, the width of a stripe of the usual rings. `bands` run across the field at fixed distances out from home, `lengthwise` along the line to centre
|
|
33
|
-
* field, `checks` are squares, `diagonal` run at 45 degrees, `
|
|
34
|
+
* field, `checks` are squares, `diagonal` run at 45 degrees, `diamonds` are squares of `band` with their sides along the foul lines (two passes of stripes parallel to the
|
|
35
|
+
* lines, crossing, from home plate out), `fan` is wedges out from home plate, 6 degrees each. `rings` and `circles` are the park's own
|
|
34
36
|
* arcs about home plate (drawn by the field itself) and `none` is plain, so they have no tone here. The path runs past the fence and must be cut to the fair ground.
|
|
35
37
|
*/
|
|
36
38
|
export declare function mowPark(pattern: StripePattern, park: Park, band?: number): Mown;
|
package/dist/mow.js
CHANGED
|
@@ -5,6 +5,10 @@ import { num } from "./format.js";
|
|
|
5
5
|
const NONE = { path: "", clip: false, evenodd: false };
|
|
6
6
|
/** An odd whole number of cells nearest to a length over a cell: odd, so that both ends of the turf are mown alike. */
|
|
7
7
|
export const oddCells = (length, cell) => Math.max(3, 2 * Math.round((length / cell - 1) / 2) + 1);
|
|
8
|
+
/** A convex polygon from its corners, as a closed subpath. */
|
|
9
|
+
const poly = (corners) => `M${corners.map(([px, py]) => `${num(px)} ${num(py)}`).join("L")}z`;
|
|
10
|
+
/** The corners of the square of a lattice turned a quarter of a right angle: the cell between `a0` and `a1` along the first axis `(ex, ey)` and `b0` and `b1` along the second, from the origin `(ox, oy)`. */
|
|
11
|
+
const lattice = (ox, oy, ex, ey, fx, fy, a0, a1, b0, b1) => [[a0, b0], [a1, b0], [a1, b1], [a0, b1]].map(([a, b]) => [ox + a * ex + b * fx, oy + a * ey + b * fy]);
|
|
8
12
|
const box = (x, y, w, h) => `M${num(x)} ${num(y)}h${num(w)}v${num(h)}h${num(-w)}z`;
|
|
9
13
|
/** An annulus between two radii about a centre, as two circles of one path. */
|
|
10
14
|
const ring = (cx, cy, inner, outer) => {
|
|
@@ -14,7 +18,8 @@ const ring = (cx, cy, inner, outer) => {
|
|
|
14
18
|
/**
|
|
15
19
|
* The lighter tone of a pattern on a rectangle of turf. `band` is the width of the usual stripe, along x; `wide` and `narrow` are twice and half of it.
|
|
16
20
|
* `bands` run across the turf (side by side along x), `lengthwise` along it, `checks` are squares of about `band`, `diagonal` are 45-degree stripes
|
|
17
|
-
* `band` wide across,
|
|
21
|
+
* `band` wide across, `diamonds` are the squares of `checks` turned 45 degrees (the crosshatch of a ballpark's outfield: two passes of 45-degree stripes, `band` wide
|
|
22
|
+
* across, crossing), laid so that a diamond is centred on the turf and both ends are mown alike, and `circles` are rings `band` wide about the middle. A pattern that is not one of these (`none`, `rings`, `fan`) has no tone here.
|
|
18
23
|
*/
|
|
19
24
|
export function mowTurf(pattern, turf, band) {
|
|
20
25
|
const { x, y, w, h } = turf;
|
|
@@ -49,6 +54,26 @@ export function mowTurf(pattern, turf, band) {
|
|
|
49
54
|
parts.push(`M${num(a)} ${num(y + h)}L${num(a + h)} ${num(y)}L${num(a + h + across)} ${num(y)}L${num(a + across)} ${num(y + h)}z`);
|
|
50
55
|
return { path: parts.join(""), clip: true, evenodd: false };
|
|
51
56
|
}
|
|
57
|
+
case "diamonds": {
|
|
58
|
+
// A lattice of squares of side `band` turned 45 degrees, one square centred on the turf: both ends of the turf then have the same tone, whatever its size.
|
|
59
|
+
const cx = x + w / 2;
|
|
60
|
+
const cy = y + h / 2;
|
|
61
|
+
const r = Math.SQRT1_2;
|
|
62
|
+
const reach = Math.ceil((Math.hypot(w, h) / 2) / band) + 1;
|
|
63
|
+
for (let i = -reach; i <= reach; i += 1) {
|
|
64
|
+
for (let j = -reach; j <= reach; j += 1) {
|
|
65
|
+
if (Math.abs(i + j) % 2 !== 1)
|
|
66
|
+
continue;
|
|
67
|
+
const corners = lattice(cx, cy, r, r, -r, r, (i - 0.5) * band, (i + 0.5) * band, (j - 0.5) * band, (j + 0.5) * band);
|
|
68
|
+
const xs = corners.map((c) => c[0]);
|
|
69
|
+
const ys = corners.map((c) => c[1]);
|
|
70
|
+
if (Math.max(...xs) <= x || Math.min(...xs) >= x + w || Math.max(...ys) <= y || Math.min(...ys) >= y + h)
|
|
71
|
+
continue;
|
|
72
|
+
parts.push(poly(corners));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return { path: parts.join(""), clip: true, evenodd: false };
|
|
76
|
+
}
|
|
52
77
|
case "circles": {
|
|
53
78
|
const cx = x + w / 2;
|
|
54
79
|
const cy = y + h / 2;
|
|
@@ -64,7 +89,8 @@ export function mowTurf(pattern, turf, band) {
|
|
|
64
89
|
/**
|
|
65
90
|
* The lighter tone of a pattern on a ballpark: coordinates are the field's screen frame (x across, y minus the distance out from home plate). `band` is
|
|
66
91
|
* 30 feet, the width of a stripe of the usual rings. `bands` run across the field at fixed distances out from home, `lengthwise` along the line to centre
|
|
67
|
-
* field, `checks` are squares, `diagonal` run at 45 degrees, `
|
|
92
|
+
* field, `checks` are squares, `diagonal` run at 45 degrees, `diamonds` are squares of `band` with their sides along the foul lines (two passes of stripes parallel to the
|
|
93
|
+
* lines, crossing, from home plate out), `fan` is wedges out from home plate, 6 degrees each. `rings` and `circles` are the park's own
|
|
68
94
|
* arcs about home plate (drawn by the field itself) and `none` is plain, so they have no tone here. The path runs past the fence and must be cut to the fair ground.
|
|
69
95
|
*/
|
|
70
96
|
export function mowPark(pattern, park, band = 30) {
|
|
@@ -96,6 +122,24 @@ export function mowPark(pattern, park, band = 30) {
|
|
|
96
122
|
parts.push(`M${num(a)} 0L${num(a + reach)} ${num(-reach)}L${num(a + reach + across)} ${num(-reach)}L${num(a + across)} 0z`);
|
|
97
123
|
return { path: parts.join(""), clip: true, evenodd: false };
|
|
98
124
|
}
|
|
125
|
+
case "diamonds": {
|
|
126
|
+
// The foul lines are the axes: a cell is `band` along each, from home plate, and the cells either side of a corner alternate.
|
|
127
|
+
const r = Math.SQRT1_2;
|
|
128
|
+
const last = Math.ceil((reach * Math.SQRT2) / band) + 1;
|
|
129
|
+
for (let i = 0; i < last; i += 1) {
|
|
130
|
+
for (let j = 0; j < last; j += 1) {
|
|
131
|
+
if ((i + j) % 2 !== 1)
|
|
132
|
+
continue;
|
|
133
|
+
const corners = lattice(0, 0, r, -r, -r, -r, i * band, (i + 1) * band, j * band, (j + 1) * band);
|
|
134
|
+
const xs = corners.map((c) => c[0]);
|
|
135
|
+
const ys = corners.map((c) => c[1]);
|
|
136
|
+
if (Math.max(...xs) < umin - band || Math.min(...xs) > umax + band || Math.min(...ys) > band || Math.max(...ys) < -reach)
|
|
137
|
+
continue;
|
|
138
|
+
parts.push(poly(corners));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return { path: parts.join(""), clip: true, evenodd: false };
|
|
142
|
+
}
|
|
99
143
|
case "fan": {
|
|
100
144
|
const step = (6 * Math.PI) / 180;
|
|
101
145
|
const R = reach * 1.5;
|
package/dist/multi.draw.js
CHANGED
|
@@ -15,6 +15,7 @@ import { outlineOf } from "./outline.js";
|
|
|
15
15
|
import { fill } from "./strings.js";
|
|
16
16
|
import { textWidth } from "./text.js";
|
|
17
17
|
import { uprightsFor } from "./uprights.js";
|
|
18
|
+
import { hallBoards } from "./venue.boards.js";
|
|
18
19
|
import { VERSION } from "./version.js";
|
|
19
20
|
const metres = (ft) => ft / FEET_PER_METRE;
|
|
20
21
|
const clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
|
|
@@ -267,7 +268,7 @@ export function multiDrawing(options, raise, uprights = true) {
|
|
|
267
268
|
}
|
|
268
269
|
if (stadium !== undefined) {
|
|
269
270
|
const standsLike = venue?.standsLike ?? spec.sport;
|
|
270
|
-
const crowd = resolveCrowd({ gaps: false, awayEnd: "none", roof: stadium.roof, shape: stadium.shape, density: stadium.density, detail: stadium.detail === "plain" ? "plain" : "fine" });
|
|
271
|
+
const crowd = resolveCrowd({ gaps: false, awayEnd: "none", roof: stadium.roof, shape: stadium.shape, density: stadium.density, detail: stadium.detail === "plain" ? "plain" : "fine", boards: hallBoards(stadium.boards) });
|
|
271
272
|
const stands = layoutOf({ sport: standsLike, box: wide, crowd, awaySide: "right", arena: venue?.shape === "octagon" });
|
|
272
273
|
const wall = venue?.shape === "octagon" ? el("path", { class: "ky-mu-wall", d: octagonD(hall.w / 2, hall.w / 2, hall.w / 2) }) : el("rect", { class: "ky-mu-wall", x: 0, y: 0, width: num(hall.w), height: num(hall.h), rx: 0.5 });
|
|
273
274
|
if (raise)
|
package/dist/multi.turn.js
CHANGED
|
@@ -177,7 +177,7 @@ export function buildMultiTurn(options, settings = {}) {
|
|
|
177
177
|
let crowdStyle = "";
|
|
178
178
|
if (drawn.stands !== undefined && keep("stands")) {
|
|
179
179
|
const roof = typeof settings.venue === "object" && settings.venue.roof !== undefined ? settings.venue.roof : typeof options.stadium === "object" && options.stadium.roof === true;
|
|
180
|
-
const venue = standsVenueOf(drawn.stands.stands, drawn.stands.crowd, { sport: drawn.stands.standsLike }, { fill: true, ...(typeof settings.venue === "object" ? settings.venue : {}), roof, id }, 0);
|
|
180
|
+
const venue = standsVenueOf(drawn.stands.stands, drawn.stands.crowd, { sport: drawn.stands.standsLike }, { fill: true, ...(typeof settings.venue === "object" ? settings.venue : {}), roof, id, noCentre: true }, 0);
|
|
181
181
|
items.push(...venue.items.filter((item) => item.kind !== "roof" || roof));
|
|
182
182
|
defs = venue.defs;
|
|
183
183
|
crowdStyle = "--ky-cr-home:#8b94a3;--ky-cr-away:#8b94a3";
|
package/dist/multi.types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Sport, SurfaceOptions } from "./types.ts";
|
|
1
|
+
import type { LedBoardOptions, Sport, SurfaceOptions } from "./types.ts";
|
|
2
2
|
/** The unit a layout's lengths are written in: the one its rulebook prints. */
|
|
3
3
|
export type MultiUnit = "m" | "ft";
|
|
4
4
|
/** A length along the layout (`x`, left to right) and across it (`y`, top to bottom). */
|
|
@@ -247,6 +247,7 @@ export interface MultiOptions {
|
|
|
247
247
|
roof?: boolean;
|
|
248
248
|
shape?: "bowl" | "sides";
|
|
249
249
|
detail?: "fine" | "plain";
|
|
250
|
+
boards?: boolean | LedBoardOptions;
|
|
250
251
|
};
|
|
251
252
|
/** The empty places for the event's words and marks, and the boards: on by default; `false` draws neither. */
|
|
252
253
|
slots?: boolean;
|
package/dist/strings.d.ts
CHANGED
|
@@ -1046,7 +1046,7 @@ export interface KyogijoWords {
|
|
|
1046
1046
|
item: string;
|
|
1047
1047
|
itemSag: string;
|
|
1048
1048
|
/** The names of what stands on the surface, by kind. */
|
|
1049
|
-
parts: Record<"scoreboard" | "net" | "antennae" | "goalposts" | "netposts" | "hoop" | "goal" | "boards" | "stumps" | "pylons" | "flags" | "fence" | "backstop" | "foul-poles" | "table-legs" | "walls" | "starting-blocks" | "backstroke-flags" | "false-start-rope" | "springboards" | "platforms" | "judges-stand" | "hurdles" | "steeplechase" | "high-jump" | "pole-vault" | "cage" | "padding" | "rink-boards" | "mound" | "azuchi" | "targets" | "stands" | "wall-seats" | "roof" | "gallery" | "dais" | "banner" | "shrine" | "mat-edge" | "surrounds" | "officials" | "judges" | "deck" | "cage-fence" | "cage-posts" | "ring-ropes" | "ring-posts", string>;
|
|
1049
|
+
parts: Record<"scoreboard" | "net" | "antennae" | "goalposts" | "netposts" | "hoop" | "goal" | "boards" | "stumps" | "pylons" | "flags" | "fence" | "backstop" | "foul-poles" | "table-legs" | "walls" | "starting-blocks" | "backstroke-flags" | "false-start-rope" | "springboards" | "platforms" | "judges-stand" | "hurdles" | "steeplechase" | "high-jump" | "pole-vault" | "cage" | "padding" | "rink-boards" | "mound" | "azuchi" | "targets" | "stands" | "wall-seats" | "roof" | "gallery" | "dais" | "banner" | "shrine" | "mat-edge" | "surrounds" | "officials" | "judges" | "deck" | "cage-fence" | "cage-posts" | "ring-ropes" | "ring-posts" | "ribbon-boards" | "hung-board", string>;
|
|
1050
1050
|
};
|
|
1051
1051
|
/** The names of the zones that `zoneAt` answers with (rules.ts), by id. */
|
|
1052
1052
|
rules: Record<RuleId, string>;
|
package/dist/strings.js
CHANGED
|
@@ -455,7 +455,7 @@ export const KYOGIJO_STRINGS = {
|
|
|
455
455
|
announce: "{name} view", announceAngle: "Turned to {yaw} degrees, seen from {pitch} degrees above the floor.",
|
|
456
456
|
flat: "This browser cannot draw the 3D view, so the flat drawing is shown.",
|
|
457
457
|
standing: "Standing on it, in the 3D view: {list}.", item: "{name} {h}", itemSag: "{name} {h} at the posts, {low} at the middle",
|
|
458
|
-
parts: { scoreboard: "scoreboard (lower edge)", net: "net", antennae: "antennae", goalposts: "goal posts", netposts: "net posts", hoop: "baskets", goal: "goals", boards: "boards and glass", stumps: "stumps", pylons: "pylons", flags: "corner flags", fence: "fence", backstop: "backstop", "foul-poles": "foul poles", "table-legs": "table top", walls: "walls", "starting-blocks": "starting blocks", "backstroke-flags": "backstroke flags", "false-start-rope": "false start rope", springboards: "springboards", platforms: "platforms", "judges-stand": "judges' stand", hurdles: "hurdles", steeplechase: "steeplechase barriers", "high-jump": "high jump uprights and bar", "pole-vault": "pole vault uprights and bar", cage: "discus and hammer cage", padding: "padding", "rink-boards": "boards", mound: "clay mound", azuchi: "azuchi", targets: "targets", stands: "stands", "wall-seats": "seats on top of the wall", roof: "roof", gallery: "gallery", dais: "dais", banner: "banner", shrine: "shrine", "mat-edge": "mat thickness", surrounds: "surrounds", officials: "umpires' chairs and score tables", judges: "name cards on the judges' table", deck: "platform", "cage-fence": "fence", "cage-posts": "padded posts", "ring-ropes": "ropes", "ring-posts": "corner posts" },
|
|
458
|
+
parts: { scoreboard: "scoreboard (lower edge)", net: "net", antennae: "antennae", goalposts: "goal posts", netposts: "net posts", hoop: "baskets", goal: "goals", boards: "boards and glass", stumps: "stumps", pylons: "pylons", flags: "corner flags", fence: "fence", backstop: "backstop", "foul-poles": "foul poles", "table-legs": "table top", walls: "walls", "starting-blocks": "starting blocks", "backstroke-flags": "backstroke flags", "false-start-rope": "false start rope", springboards: "springboards", platforms: "platforms", "judges-stand": "judges' stand", hurdles: "hurdles", steeplechase: "steeplechase barriers", "high-jump": "high jump uprights and bar", "pole-vault": "pole vault uprights and bar", cage: "discus and hammer cage", padding: "padding", "rink-boards": "boards", mound: "clay mound", azuchi: "azuchi", targets: "targets", stands: "stands", "wall-seats": "seats on top of the wall", roof: "roof", gallery: "gallery", dais: "dais", banner: "banner", shrine: "shrine", "mat-edge": "mat thickness", surrounds: "surrounds", officials: "umpires' chairs and score tables", judges: "name cards on the judges' table", deck: "platform", "cage-fence": "fence", "cage-posts": "padded posts", "ring-ropes": "ropes", "ring-posts": "corner posts", "ribbon-boards": "LED ribbon boards", "hung-board": "centre-hung scoreboard" },
|
|
459
459
|
},
|
|
460
460
|
rules: {
|
|
461
461
|
"defensive-zone": "Defensive zone",
|
|
@@ -1014,7 +1014,7 @@ export const KYOGIJO_STRINGS = {
|
|
|
1014
1014
|
announce: "{name}の視点", announceAngle: "向きは{yaw}度、見下ろす角度は{pitch}度です。",
|
|
1015
1015
|
flat: "このブラウザーでは3D表示ができないため、平面の図を表示しています。",
|
|
1016
1016
|
standing: "3D表示で立って見えるもの:{list}。", item: "{name} {h}", itemSag: "{name} 支柱の位置で{h}(中央は{low})",
|
|
1017
|
-
parts: { scoreboard: "スコアボードの下端", net: "ネット", antennae: "アンテナ", goalposts: "ゴールポスト", netposts: "支柱", hoop: "バスケットゴール", goal: "ゴール", boards: "ボードとガラス", stumps: "ウィケットのスタンプ", pylons: "パイロン", flags: "コーナーフラッグ", fence: "外野フェンス", backstop: "バックネット", "foul-poles": "ファウルポール", "table-legs": "天板", walls: "壁", "starting-blocks": "スタート台", "backstroke-flags": "背泳ぎ用フラッグ", "false-start-rope": "フォルススタートロープ", springboards: "飛板", platforms: "固定台", "judges-stand": "ジャッジ台", hurdles: "ハードル", steeplechase: "障害物", "high-jump": "走高跳の支柱とバー", "pole-vault": "棒高跳の支柱とバー", cage: "円盤投・ハンマー投の囲い", padding: "防護マット", "rink-boards": "フェンス", mound: "土の台", azuchi: "安土", targets: "的", stands: "スタンド", "wall-seats": "壁の上の観客席", roof: "屋根", gallery: "見学席", dais: "上座の台", banner: "垂れ幕", shrine: "神棚", "mat-edge": "畳の厚み", surrounds: "競技エリアのフェンス", officials: "審判席と記録台", judges: "審判員席の名札", deck: "台", "cage-fence": "金網", "cage-posts": "パッド付き支柱", "ring-ropes": "ロープ", "ring-posts": "コーナーポスト" },
|
|
1017
|
+
parts: { scoreboard: "スコアボードの下端", net: "ネット", antennae: "アンテナ", goalposts: "ゴールポスト", netposts: "支柱", hoop: "バスケットゴール", goal: "ゴール", boards: "ボードとガラス", stumps: "ウィケットのスタンプ", pylons: "パイロン", flags: "コーナーフラッグ", fence: "外野フェンス", backstop: "バックネット", "foul-poles": "ファウルポール", "table-legs": "天板", walls: "壁", "starting-blocks": "スタート台", "backstroke-flags": "背泳ぎ用フラッグ", "false-start-rope": "フォルススタートロープ", springboards: "飛板", platforms: "固定台", "judges-stand": "ジャッジ台", hurdles: "ハードル", steeplechase: "障害物", "high-jump": "走高跳の支柱とバー", "pole-vault": "棒高跳の支柱とバー", cage: "円盤投・ハンマー投の囲い", padding: "防護マット", "rink-boards": "フェンス", mound: "土の台", azuchi: "安土", targets: "的", stands: "スタンド", "wall-seats": "壁の上の観客席", roof: "屋根", gallery: "見学席", dais: "上座の台", banner: "垂れ幕", shrine: "神棚", "mat-edge": "畳の厚み", surrounds: "競技エリアのフェンス", officials: "審判席と記録台", judges: "審判員席の名札", deck: "台", "cage-fence": "金網", "cage-posts": "パッド付き支柱", "ring-ropes": "ロープ", "ring-posts": "コーナーポスト", "ribbon-boards": "LEDリボンビジョン", "hung-board": "センタービジョン(吊り下げ式スコアボード)" },
|
|
1018
1018
|
},
|
|
1019
1019
|
rules: {
|
|
1020
1020
|
"defensive-zone": "ディフェンディングゾーン",
|
package/dist/surfaces/soccer.js
CHANGED
|
@@ -13,10 +13,10 @@ const BANDS = { bands: 19, wide: 9, narrow: 39 };
|
|
|
13
13
|
function stripes(pattern, L, W, id) {
|
|
14
14
|
if (pattern === "none")
|
|
15
15
|
return { path: "", defs: "" };
|
|
16
|
-
if (pattern === "circles") {
|
|
17
|
-
// Rings about the middle, as wide as a usual band, cut to the pitch.
|
|
18
|
-
const mown = mowTurf(
|
|
19
|
-
return { path: mown.path, defs: `<clipPath id="${id}-turf"><rect x="0" y="0" width="${n(L)}" height="${n(W)}"/></clipPath>`, evenodd:
|
|
16
|
+
if (pattern === "circles" || pattern === "diamonds") {
|
|
17
|
+
// Rings about the middle, or squares turned 45 degrees about it, as wide as a usual band, cut to the pitch.
|
|
18
|
+
const mown = mowTurf(pattern, { x: 0, y: 0, w: L, h: W }, L / BANDS.bands);
|
|
19
|
+
return { path: mown.path, defs: `<clipPath id="${id}-turf"><rect x="0" y="0" width="${n(L)}" height="${n(W)}"/></clipPath>`, evenodd: mown.evenodd };
|
|
20
20
|
}
|
|
21
21
|
const rect = (x, y, w, h) => `M${n(x)} ${n(y)}h${n(w)}v${n(h)}h${n(-w)}z`;
|
|
22
22
|
const parts = [];
|
package/dist/turn-entry.d.ts
CHANGED
|
@@ -13,4 +13,5 @@ export { describeUprights, heightUnit, planesOf, uprightsFor } from "./uprights.
|
|
|
13
13
|
export type { UprightOptions, Uprights } from "./uprights.ts";
|
|
14
14
|
export { ROOF } from "./venue.ts";
|
|
15
15
|
export type { Venue, VenueBuild, VenueSettings } from "./venue.ts";
|
|
16
|
+
export type { LedBoardOptions, LedBoardPattern } from "./types.ts";
|
|
16
17
|
export type { Plane, PartKind, Upright, UprightKind, V3 } from "./turn.kit.ts";
|
package/dist/turn.kit.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** A point or a direction: x, y, z in feet. */
|
|
2
2
|
export type V3 = readonly [number, number, number];
|
|
3
3
|
/** What a plane is a part of: it is the class of its element (`ky-up-<kind>`) and what a test finds it by. */
|
|
4
|
-
export type PartKind = "post" | "net" | "tape" | "antenna" | "board" | "glass" | "rim" | "stanchion" | "frame" | "goal" | "flag" | "stump" | "leg" | "table" | "pylon" | "wall" | "screen" | "pole" | "ground" | "target" | "seats" | "concourse" | "fascia" | "roof" | "banner" | "platform" | "rail" | "matedge" | "shrine" | "surround" | "chair" | "desk" | "card" | "sign" | "apron" | "bench" | "floor";
|
|
4
|
+
export type PartKind = "post" | "net" | "tape" | "antenna" | "board" | "glass" | "rim" | "stanchion" | "frame" | "goal" | "flag" | "stump" | "leg" | "table" | "pylon" | "wall" | "screen" | "pole" | "ground" | "target" | "seats" | "concourse" | "fascia" | "roof" | "banner" | "platform" | "rail" | "matedge" | "shrine" | "surround" | "chair" | "desk" | "card" | "sign" | "apron" | "bench" | "floor" | "ribbon" | "hung-board";
|
|
5
5
|
/** One flat rectangle. Its own x runs along `u` (its whole length) and its own y along `v`; `o` is the corner both start from. `svg` is what is drawn on it, in feet along `u` and `v`. */
|
|
6
6
|
export interface Plane {
|
|
7
7
|
/** A name that says what it is and where: `net`, `post-left`, `goal-right-back`. */
|
|
@@ -42,7 +42,7 @@ export interface Plane {
|
|
|
42
42
|
group?: number;
|
|
43
43
|
}
|
|
44
44
|
/** What stands on the surface as a thing a reader would name: a net, a basket, a goal, a pair of posts. */
|
|
45
|
-
export type UprightKind = "scoreboard" | "net" | "antennae" | "goalposts" | "netposts" | "hoop" | "goal" | "boards" | "stumps" | "pylons" | "flags" | "fence" | "backstop" | "foul-poles" | "table-legs" | "walls" | "starting-blocks" | "backstroke-flags" | "false-start-rope" | "springboards" | "platforms" | "judges-stand" | "hurdles" | "steeplechase" | "high-jump" | "pole-vault" | "cage" | "padding" | "rink-boards" | "mound" | "azuchi" | "targets" | "stands" | "wall-seats" | "roof" | "gallery" | "dais" | "banner" | "shrine" | "mat-edge" | "surrounds" | "officials" | "judges" | "deck" | "cage-fence" | "cage-posts" | "ring-ropes" | "ring-posts";
|
|
45
|
+
export type UprightKind = "scoreboard" | "net" | "antennae" | "goalposts" | "netposts" | "hoop" | "goal" | "boards" | "stumps" | "pylons" | "flags" | "fence" | "backstop" | "foul-poles" | "table-legs" | "walls" | "starting-blocks" | "backstroke-flags" | "false-start-rope" | "springboards" | "platforms" | "judges-stand" | "hurdles" | "steeplechase" | "high-jump" | "pole-vault" | "cage" | "padding" | "rink-boards" | "mound" | "azuchi" | "targets" | "stands" | "wall-seats" | "roof" | "gallery" | "dais" | "banner" | "shrine" | "mat-edge" | "surrounds" | "officials" | "judges" | "deck" | "cage-fence" | "cage-posts" | "ring-ropes" | "ring-posts" | "ribbon-boards" | "hung-board";
|
|
46
46
|
/** A thing that stands on the surface: where, how high, and the planes it is made of. */
|
|
47
47
|
export interface Upright {
|
|
48
48
|
id: string;
|
package/dist/turn.model.js
CHANGED
|
@@ -23,7 +23,7 @@ export function floorOptions(options) {
|
|
|
23
23
|
}
|
|
24
24
|
const VIEWBOX = /viewBox="(-?[\d.]+) (-?[\d.]+) ([\d.]+) ([\d.]+)"/;
|
|
25
25
|
/** The kinds of thing the venue makes. */
|
|
26
|
-
const VENUE_KINDS = ["stands", "wall-seats", "roof", "gallery", "dais", "banner", "shrine", "mat-edge", "walls"];
|
|
26
|
+
const VENUE_KINDS = ["stands", "wall-seats", "roof", "gallery", "dais", "banner", "shrine", "mat-edge", "walls", "ribbon-boards", "hung-board"];
|
|
27
27
|
/** The sport and look a floor drawing says it is painted in (`data-sport` and `data-look` on its root), for the planes round it to be painted in the same. */
|
|
28
28
|
function lookOf(floor) {
|
|
29
29
|
const found = /^<svg[^>]*\sdata-sport="([\w-]+)" data-look="([\w-]+)"/.exec(floor);
|
package/dist/turn.style.js
CHANGED
|
@@ -86,6 +86,9 @@ export const KYOGIJO_TURN_STYLE = `
|
|
|
86
86
|
.ky-turn .u-penb-side{fill:color-mix(in srgb,var(--ky-up-glass,#bcd2e0) 80%,#5d7a8f);filter:brightness(.72)}
|
|
87
87
|
.ky-turn .u-teamb{fill:color-mix(in srgb,var(--ky-up-wood,#8a6a47) 80%,#2a2f36)}
|
|
88
88
|
.ky-turn .u-teamb-side{fill:color-mix(in srgb,var(--ky-up-wood,#8a6a47) 80%,#2a2f36);filter:brightness(.7)}
|
|
89
|
+
/* LED boards: the housing and the screen are dark; the lit parts (class u-led) carry their own colours, and are what a lighting layer makes glow. */
|
|
90
|
+
.ky-turn .u-led-bed{fill:#0b0f14}
|
|
91
|
+
.ky-turn .u-led-screen{fill:#06121d}
|
|
89
92
|
.ky-turn .u-back{fill:color-mix(in srgb,var(--ky-up-fascia) 66%,var(--ky-cr-bed))}
|
|
90
93
|
.ky-turn .u-backrib{stroke:var(--ky-cr-bed);stroke-width:.7;stroke-opacity:.7}
|
|
91
94
|
.ky-turn .u-coping{fill:color-mix(in srgb,var(--ky-up-fascia) 70%,var(--ky-cr-conc))}
|
package/dist/types.d.ts
CHANGED
|
@@ -73,11 +73,11 @@ export interface Placement {
|
|
|
73
73
|
/** How much of the surface's markings are drawn. `simple` leaves out the small ones, such as hash marks. */
|
|
74
74
|
export type Detail = "full" | "simple";
|
|
75
75
|
/**
|
|
76
|
-
* How grass is mown: bands across the surface (the usual), wide ones or narrow ones, along it, in checks, on the diagonal, in rings round the
|
|
76
|
+
* How grass is mown: bands across the surface (the usual), wide ones or narrow ones, along it, in checks, on the diagonal, in diamonds (the checks turned 45 degrees: a ballpark outfield's crosshatch, its sides along the foul lines), in rings round the
|
|
77
77
|
* middle (`circles`), or `none`. A ballpark is mown in `rings` by default (arcs about home plate) and may also be mown in a `fan` (wedges out from
|
|
78
78
|
* home plate). A football field and a ballpark take the same options as a soccer pitch; a surface that is not grass ignores them.
|
|
79
79
|
*/
|
|
80
|
-
export type StripePattern = "bands" | "wide" | "narrow" | "lengthwise" | "checks" | "diagonal" | "circles" | "rings" | "fan" | "none";
|
|
80
|
+
export type StripePattern = "bands" | "wide" | "narrow" | "lengthwise" | "checks" | "diagonal" | "diamonds" | "circles" | "rings" | "fan" | "none";
|
|
81
81
|
/**
|
|
82
82
|
* How a goal is drawn, seen from above. A soccer goal: the net as a box behind the goal line, a line on it, a solid strip, or not at all.
|
|
83
83
|
* A hockey net: the same four (`box` is the open frame behind the goal line, `strip` a filled net). A basketball basket: `box` is the backboard,
|
|
@@ -274,6 +274,24 @@ export type SheetShow = "sheet" | "half" | "house" | "folded";
|
|
|
274
274
|
export type SheetEnd = Side | "top" | "bottom";
|
|
275
275
|
/** The shape of a venue's stands round the playing surface. */
|
|
276
276
|
export type CrowdShape = "bowl" | "sides" | "horseshoe" | "grandstand";
|
|
277
|
+
/** The patterns a ribbon board shows: `bands` (two bands of colour, in panels), `blocks` (a block of colour to a panel), `chevrons` (arrows running along it) or `waves`. */
|
|
278
|
+
export type LedBoardPattern = "bands" | "blocks" | "chevrons" | "waves";
|
|
279
|
+
/**
|
|
280
|
+
* The LED boards of a venue (`crowd.boards`, or `venue.boards` of the 3D view): the ribbon boards along the fascia between the seating levels, and a scoreboard hung over the playing surface. The content is generic: bands of colour,
|
|
281
|
+
* abstract patterns and a plain score, never a logo, a sponsor or text from a real board. `true` is both, in the package's own colours. Off by default.
|
|
282
|
+
*/
|
|
283
|
+
export interface LedBoardOptions {
|
|
284
|
+
/** The ribbon boards along the fascia between the levels (the front of the single level of a hall that has one). On by default. */
|
|
285
|
+
ribbon?: boolean;
|
|
286
|
+
/** The scoreboard hung over the middle of the playing surface, four sided, with a ring of display under it. On by default, and left out of a ballpark (whose scoreboard stands behind the outfield). */
|
|
287
|
+
scoreboard?: boolean;
|
|
288
|
+
/** One to three colours of the lights, as CSS colours (`#e03c31`, `rgb(...)`, a name). The crowd's `home` and `away` colours when left out and the crowd has them, else amber, blue and white. */
|
|
289
|
+
colors?: readonly string[];
|
|
290
|
+
/** What the ribbon boards show. `bands` by default. */
|
|
291
|
+
pattern?: LedBoardPattern;
|
|
292
|
+
/** The plain score on the scoreboard: home, then away, whole numbers 0 to 99. 0 and 0 by default. */
|
|
293
|
+
score?: readonly [number, number];
|
|
294
|
+
}
|
|
277
295
|
/**
|
|
278
296
|
* The stands and the crowd round a surface (`crowd`). Every part is optional. `true` is the sport's usual venue, 85 percent full, with an away end, drawn in detail.
|
|
279
297
|
* See `docs/crowd.md`.
|
|
@@ -324,6 +342,11 @@ export interface CrowdOptions {
|
|
|
324
342
|
wallSeats?: boolean;
|
|
325
343
|
/** How much is drawn: `fine` (the crowd as heads and shoulders, empty seats, aisles), `plain` (blocks of colour), or `auto` (`plain` for `detail: "simple"` or a `width` under 480 pixels). */
|
|
326
344
|
detail?: "auto" | "fine" | "plain";
|
|
345
|
+
/**
|
|
346
|
+
* LED boards: ribbon boards along the front of the upper tiers (drawn as a lit line in the flat plan, raised on the fascia of the suite level in the 3D view, where `venue.boards` says the same and wins) and a scoreboard over the
|
|
347
|
+
* middle of the surface. `true` for both in the package's colours, or `{ ribbon, scoreboard, colors, pattern, score }`. Generic content only. Off by default. See `docs/boards.md`.
|
|
348
|
+
*/
|
|
349
|
+
boards?: boolean | LedBoardOptions;
|
|
327
350
|
}
|
|
328
351
|
/**
|
|
329
352
|
* The parts of a surface a drawing can be cropped to (`range`). Football: `red-zone`, `between-the-20s`, `end-zone`, `field-of-play`, `own-half`, `opponent-half`.
|
package/dist/uprights.js
CHANGED
|
@@ -141,6 +141,8 @@ export function uprightsFor(o, settings = {}) {
|
|
|
141
141
|
// The score, hung up: the badge on a board that turns to face the eye.
|
|
142
142
|
const scored = o.home !== undefined && o.away !== undefined && o.size !== "badge";
|
|
143
143
|
if (scored && settings.score !== "floor" && area !== undefined) {
|
|
144
|
+
// The score has a board of its own: the venue's hung scoreboard does not stand beside it.
|
|
145
|
+
items = items.filter((item) => item.kind !== "hung-board");
|
|
144
146
|
const board = scoreboard(drawKyogijo({ ...o, size: "badge", style: "none", id: `${drawingId(o)}-board` }), sport, area, thin);
|
|
145
147
|
if (board !== undefined)
|
|
146
148
|
items.push(board);
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { type CrowdStands, type Pt, type StandRing } from "./crowd.ts";
|
|
2
|
+
import { type Plane } from "./turn.kit.ts";
|
|
3
|
+
import type { LedBoardOptions, LedBoardPattern } from "./types.ts";
|
|
4
|
+
/** The boards a venue has, with every part's value. */
|
|
5
|
+
export interface Boards {
|
|
6
|
+
ribbon: boolean;
|
|
7
|
+
scoreboard: boolean;
|
|
8
|
+
/** Three colours of light (a ribbon's bands and chevrons take them in turn). */
|
|
9
|
+
colors: [string, string, string];
|
|
10
|
+
pattern: LedBoardPattern;
|
|
11
|
+
score: [number, number];
|
|
12
|
+
}
|
|
13
|
+
/** The package's own colours of light: amber, blue and a white with a little blue in it. */
|
|
14
|
+
export declare const BOARD_COLORS: readonly [string, string, string];
|
|
15
|
+
export declare const BOARD_PATTERNS: readonly LedBoardPattern[];
|
|
16
|
+
/** The sizes of the boards, in feet (ours: the usual ones, no plan of a real board). */
|
|
17
|
+
export declare const BOARD: {
|
|
18
|
+
/** How tall a ribbon is, and how long one of its panels. */
|
|
19
|
+
readonly ribbon: 3.8;
|
|
20
|
+
readonly panel: 9;
|
|
21
|
+
/** The scoreboard's share of the surface's length and width, its least and most, and how far its lower edge hangs over the surface (a share of the surface's longer side, least and most). */
|
|
22
|
+
readonly share: {
|
|
23
|
+
readonly w: 0.14;
|
|
24
|
+
readonly d: 0.22;
|
|
25
|
+
};
|
|
26
|
+
readonly wide: readonly [18, 52];
|
|
27
|
+
readonly deep: readonly [12, 30];
|
|
28
|
+
readonly hang: {
|
|
29
|
+
readonly share: 0.2;
|
|
30
|
+
readonly least: 28;
|
|
31
|
+
readonly most: 70;
|
|
32
|
+
};
|
|
33
|
+
/** The ring of display under the main board, its inset on each side, and the strut it hangs from. */
|
|
34
|
+
readonly ring: {
|
|
35
|
+
readonly rise: readonly [2.5, 4.5];
|
|
36
|
+
readonly inset: 0.06;
|
|
37
|
+
};
|
|
38
|
+
readonly strut: 9;
|
|
39
|
+
};
|
|
40
|
+
export declare const safeColor: (value: unknown) => string | undefined;
|
|
41
|
+
/** The boards a `boards` option asks for (the crowd's `home` and `away` are the colours when it names none), or `undefined` for none. */
|
|
42
|
+
export declare function resolveBoards(ask: boolean | LedBoardOptions | undefined | null, team?: {
|
|
43
|
+
home?: string;
|
|
44
|
+
away?: string;
|
|
45
|
+
}): Boards | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* A ribbon on a quad `[a, b, c, d]` of a plane (a and b along its lower edge, d and c along its upper): a dark housing with panels of light in it, in the pattern asked. `run` is how far along the ribbon this quad starts, in feet,
|
|
48
|
+
* so that the panels carry on in the colour they were from one quad to the next. A quad that is not a quad is the housing alone.
|
|
49
|
+
*/
|
|
50
|
+
export declare function ledStrip(corners: readonly Pt[], look: Pick<Boards, "colors" | "pattern">, run?: number): string;
|
|
51
|
+
/** The ribbon on a wall, `length` feet long and `height` feet high: the same strip, on a rectangle (its lower edge is the wall's lower edge). */
|
|
52
|
+
export declare const ledWall: (length: number, height: number, look: Pick<Boards, "colors" | "pattern">, run?: number) => string;
|
|
53
|
+
/** A walk between two tiers: the tier below it, the one above and the walk's own outlines. */
|
|
54
|
+
export interface TierLink {
|
|
55
|
+
c: CrowdStands["concourses"][number];
|
|
56
|
+
before: StandRing;
|
|
57
|
+
after: StandRing;
|
|
58
|
+
}
|
|
59
|
+
/** The walks between the tiers of a stands model, each with the tier it leaves and the tier it leads to. */
|
|
60
|
+
export declare function tierLinks(stands: CrowdStands): TierLink[];
|
|
61
|
+
/** The share of a plane of `rise` feet over a slope `g` (rise per foot across) that a ribbon of `BOARD.ribbon` feet takes at its top; 0 for a plane too flat to be a facade. */
|
|
62
|
+
export declare function ribbonShare(rise: number, g: number): number;
|
|
63
|
+
/** The size of the scoreboard over a surface of `w` by `h` feet (its long side along the surface's), and how high its lower edge hangs. */
|
|
64
|
+
export declare function boardSize(w: number, h: number): {
|
|
65
|
+
w: number;
|
|
66
|
+
d: number;
|
|
67
|
+
hang: number;
|
|
68
|
+
};
|
|
69
|
+
/** Whether a sport has a scoreboard hung over its surface: a ballpark's stands behind the outfield, so it has none here. */
|
|
70
|
+
export declare const hangsOver: (sport: string | undefined) => boolean;
|
|
71
|
+
/**
|
|
72
|
+
* The scoreboard hung over the middle of a surface: a four sided board with its score on every face, a ring of display under it, a cap on top and a strut up to the rafters. `box` is the surface, `lift` how high the surface stands.
|
|
73
|
+
* Its faces look outwards, each the right way round for an eye outside it.
|
|
74
|
+
*/
|
|
75
|
+
export declare function centreBoard(id: string, box: {
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
w: number;
|
|
79
|
+
h: number;
|
|
80
|
+
}, lift: number, look: Boards): Plane[];
|
|
81
|
+
/** The size of the scoreboard in the flat plan, from the surface's box. */
|
|
82
|
+
export declare const planBoard: (box: {
|
|
83
|
+
x: number;
|
|
84
|
+
y: number;
|
|
85
|
+
w: number;
|
|
86
|
+
h: number;
|
|
87
|
+
}) => {
|
|
88
|
+
x: number;
|
|
89
|
+
y: number;
|
|
90
|
+
w: number;
|
|
91
|
+
d: number;
|
|
92
|
+
};
|
|
93
|
+
/** The ribbon boards in the flat plan: a lit line along the front of every tier that has a walk below it (the front of the tiers there is no walk to, where the venue has one level), panels of the colours in turn. */
|
|
94
|
+
export declare function planRibbons(stands: CrowdStands, look: Boards): string;
|
|
95
|
+
/** The scoreboard in the flat plan, as the board hangs over the surface seen from above: its dark cap with a line of light round it and its four edges' colours. */
|
|
96
|
+
export declare function planScoreboard(box: {
|
|
97
|
+
x: number;
|
|
98
|
+
y: number;
|
|
99
|
+
w: number;
|
|
100
|
+
h: number;
|
|
101
|
+
}, look: Boards): string;
|
|
102
|
+
/** How tall the ribbon on the front of a tier is, for a front `top` feet high: the usual ribbon, or less where the front is low. */
|
|
103
|
+
export declare const ribbonHigh: (top: number) => number;
|
|
104
|
+
/** The ribbon on the top of a wall that stands over the line from `a` to `b` and is `top` feet high (the front of a tier): a wall of its own, as tall as `ribbonHigh` says. `run` is how far along the ribbon the wall starts. */
|
|
105
|
+
export declare const fasciaRibbon: (id: string, a: Pt, b: Pt, top: number, look: Boards, run: number) => Plane;
|
|
106
|
+
/** A hall's boards as its stadium asks for them: the layout has scoreboards of its own, so the hall has the ribbons and no scoreboard hung over its middle. */
|
|
107
|
+
export declare const hallBoards: (ask: boolean | LedBoardOptions | undefined) => boolean | LedBoardOptions | undefined;
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
// The LED boards of a venue: the ribbon boards along the fascia between the seating levels, and the scoreboard hung over the middle of the playing surface, in the flat plan and in 3D. The content is generic and ours: panels
|
|
2
|
+
// of colour in bands, blocks, chevrons or waves, and a plain score in seven-segment digits (paths, so that no font is needed): never a logo, a sponsor or a line of text from a real board. The colours are the asker's, else
|
|
3
|
+
// the crowd's home and away colours, else the package's own amber, blue and white. Every lit shape carries the class `u-led` (`ky-cr-led` in the plan), so that a lighting layer can make it glow. Pure: data in, planes and markup out.
|
|
4
|
+
import { outlinePath } from "./crowd.js";
|
|
5
|
+
import { el } from "./format.js";
|
|
6
|
+
import { bar, flat, n, plane, wall } from "./turn.kit.js";
|
|
7
|
+
/** The package's own colours of light: amber, blue and a white with a little blue in it. */
|
|
8
|
+
export const BOARD_COLORS = ["#ffb020", "#2bc4ff", "#f4f7ff"];
|
|
9
|
+
export const BOARD_PATTERNS = ["bands", "blocks", "chevrons", "waves"];
|
|
10
|
+
/** The sizes of the boards, in feet (ours: the usual ones, no plan of a real board). */
|
|
11
|
+
export const BOARD = {
|
|
12
|
+
/** How tall a ribbon is, and how long one of its panels. */
|
|
13
|
+
ribbon: 3.8,
|
|
14
|
+
panel: 9,
|
|
15
|
+
/** The scoreboard's share of the surface's length and width, its least and most, and how far its lower edge hangs over the surface (a share of the surface's longer side, least and most). */
|
|
16
|
+
share: { w: 0.14, d: 0.22 },
|
|
17
|
+
wide: [18, 52],
|
|
18
|
+
deep: [12, 30],
|
|
19
|
+
hang: { share: 0.2, least: 28, most: 70 },
|
|
20
|
+
/** The ring of display under the main board, its inset on each side, and the strut it hangs from. */
|
|
21
|
+
ring: { rise: [2.5, 4.5], inset: 0.06 },
|
|
22
|
+
strut: 9,
|
|
23
|
+
};
|
|
24
|
+
/** A CSS colour that is safe to write into an attribute: a hex, `rgb()`, `hsl()` or a plain name. */
|
|
25
|
+
const COLOR = /^(#[0-9a-f]{3,8}|(?:rgb|hsl)a?\([\d\s.,%/-]{3,40}\)|[a-z]{3,24})$/i;
|
|
26
|
+
export const safeColor = (value) => (typeof value === "string" && COLOR.test(value.trim()) ? value.trim() : undefined);
|
|
27
|
+
/** The boards a `boards` option asks for (the crowd's `home` and `away` are the colours when it names none), or `undefined` for none. */
|
|
28
|
+
export function resolveBoards(ask, team = {}) {
|
|
29
|
+
if (ask === undefined || ask === null || ask === false)
|
|
30
|
+
return undefined;
|
|
31
|
+
const o = ask === true ? {} : ask;
|
|
32
|
+
const given = (Array.isArray(o.colors) ? o.colors : [team.home, team.away]).map(safeColor).filter((c) => c !== undefined).slice(0, 3);
|
|
33
|
+
const colors = [0, 1, 2].map((i) => given[i] ?? (given.length > 0 ? (i === 2 ? given[0] : BOARD_COLORS[2]) : BOARD_COLORS[i]));
|
|
34
|
+
const whole = (v) => (typeof v === "number" && Number.isFinite(v) ? Math.min(99, Math.max(0, Math.trunc(v))) : 0);
|
|
35
|
+
const boards = {
|
|
36
|
+
ribbon: o.ribbon !== false,
|
|
37
|
+
scoreboard: o.scoreboard !== false,
|
|
38
|
+
colors,
|
|
39
|
+
pattern: BOARD_PATTERNS.includes(o.pattern) ? o.pattern : "bands",
|
|
40
|
+
score: [whole(o.score?.[0]), whole(o.score?.[1])],
|
|
41
|
+
};
|
|
42
|
+
return boards.ribbon || boards.scoreboard ? boards : undefined;
|
|
43
|
+
}
|
|
44
|
+
const lerp = (a, b, t) => [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t];
|
|
45
|
+
const clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
|
|
46
|
+
const at = (p) => `${n(p[0])} ${n(p[1])}`;
|
|
47
|
+
const loop = (pts) => `M${pts.map(at).join("L")}Z`;
|
|
48
|
+
/**
|
|
49
|
+
* A ribbon on a quad `[a, b, c, d]` of a plane (a and b along its lower edge, d and c along its upper): a dark housing with panels of light in it, in the pattern asked. `run` is how far along the ribbon this quad starts, in feet,
|
|
50
|
+
* so that the panels carry on in the colour they were from one quad to the next. A quad that is not a quad is the housing alone.
|
|
51
|
+
*/
|
|
52
|
+
export function ledStrip(corners, look, run = 0) {
|
|
53
|
+
const bed = `<path class="u-led-bed" d="${loop(corners)}"/>`;
|
|
54
|
+
if (corners.length !== 4)
|
|
55
|
+
return bed;
|
|
56
|
+
const [a, b, c, d] = corners;
|
|
57
|
+
const across = (s, t) => lerp(lerp(a, b, s), lerp(d, c, s), t);
|
|
58
|
+
const long = Math.hypot(b[0] - a[0], b[1] - a[1]);
|
|
59
|
+
const panels = Math.max(1, Math.round(long / BOARD.panel));
|
|
60
|
+
const first = Math.floor(run / BOARD.panel);
|
|
61
|
+
const lit = new Map();
|
|
62
|
+
const paint = (color, shape) => {
|
|
63
|
+
const list = lit.get(color) ?? [];
|
|
64
|
+
list.push(shape);
|
|
65
|
+
lit.set(color, list);
|
|
66
|
+
};
|
|
67
|
+
const [lo, hi] = [0.14, 0.86];
|
|
68
|
+
const gap = Math.min(0.06, 0.4 / panels);
|
|
69
|
+
if (look.pattern === "waves") {
|
|
70
|
+
// Three waves along the whole quad, one in each colour, a little apart.
|
|
71
|
+
const steps = Math.max(8, Math.round(long / 1.2));
|
|
72
|
+
look.colors.forEach((color, w) => {
|
|
73
|
+
const pts = Array.from({ length: steps + 1 }, (_, k) => {
|
|
74
|
+
const s = k / steps;
|
|
75
|
+
return across(s, 0.5 + 0.3 * Math.sin(((run + s * long) / BOARD.panel) * Math.PI * 1.2 + (w * 2 * Math.PI) / 3));
|
|
76
|
+
});
|
|
77
|
+
paint(color, `M${pts.map(at).join("L")}`);
|
|
78
|
+
});
|
|
79
|
+
const waves = [...lit].map(([color, shapes]) => `<path class="u-led" fill="none" stroke="${color}" stroke-width="${n(BOARD.ribbon * 0.2)}" stroke-linecap="round" stroke-linejoin="round" d="${shapes.join("")}"/>`);
|
|
80
|
+
return bed + waves.join("");
|
|
81
|
+
}
|
|
82
|
+
for (let i = 0; i < panels; i += 1) {
|
|
83
|
+
const k = first + i;
|
|
84
|
+
const [s0, s1] = [i / panels + gap / 2, (i + 1) / panels - gap / 2];
|
|
85
|
+
const mine = look.colors[k % 3];
|
|
86
|
+
const other = look.colors[(k + 1) % 3];
|
|
87
|
+
if (look.pattern === "blocks") {
|
|
88
|
+
paint(mine, loop([across(s0, lo), across(s1, lo), across(s1, hi), across(s0, hi)]));
|
|
89
|
+
}
|
|
90
|
+
else if (look.pattern === "chevrons") {
|
|
91
|
+
// An arrow along the ribbon: a thick chevron pointing the way the run goes, in this panel's colour.
|
|
92
|
+
const w = s1 - s0;
|
|
93
|
+
const cell = (x, t) => across(s0 + x * w, lo + t * (hi - lo));
|
|
94
|
+
paint(mine, loop([cell(0, 0), cell(0.55, 0), cell(1, 0.5), cell(0.55, 1), cell(0, 1), cell(0.45, 0.5)]));
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
const mid = (lo + hi) / 2;
|
|
98
|
+
paint(mine, loop([across(s0, lo), across(s1, lo), across(s1, mid - 0.03), across(s0, mid - 0.03)]));
|
|
99
|
+
paint(other, loop([across(s0, mid + 0.03), across(s1, mid + 0.03), across(s1, hi), across(s0, hi)]));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return bed + [...lit].map(([color, shapes]) => `<path class="u-led" fill="${color}" d="${shapes.join("")}"/>`).join("");
|
|
103
|
+
}
|
|
104
|
+
/** The ribbon on a wall, `length` feet long and `height` feet high: the same strip, on a rectangle (its lower edge is the wall's lower edge). */
|
|
105
|
+
export const ledWall = (length, height, look, run = 0) => ledStrip([[0, height], [length, height], [length, 0], [0, 0]], look, run);
|
|
106
|
+
/** The walks between the tiers of a stands model, each with the tier it leaves and the tier it leads to. */
|
|
107
|
+
export function tierLinks(stands) {
|
|
108
|
+
const links = [];
|
|
109
|
+
stands.concourses.forEach((c, ci) => {
|
|
110
|
+
let at = stands.rings.findIndex((r) => r.hole === c.region);
|
|
111
|
+
if (at < 1)
|
|
112
|
+
at = Math.min(ci + 1, stands.rings.length - 1);
|
|
113
|
+
const [before, after] = [stands.rings[at - 1], stands.rings[at]];
|
|
114
|
+
if (before !== undefined && after !== undefined)
|
|
115
|
+
links.push({ c, before, after });
|
|
116
|
+
});
|
|
117
|
+
return links;
|
|
118
|
+
}
|
|
119
|
+
/** The share of a plane of `rise` feet over a slope `g` (rise per foot across) that a ribbon of `BOARD.ribbon` feet takes at its top; 0 for a plane too flat to be a facade. */
|
|
120
|
+
export function ribbonShare(rise, g) {
|
|
121
|
+
if (g < 0.25 || rise < BOARD.ribbon)
|
|
122
|
+
return 0;
|
|
123
|
+
const slant = (rise / g) * Math.hypot(1, g);
|
|
124
|
+
return clamp(BOARD.ribbon / slant, 0.06, 0.4);
|
|
125
|
+
}
|
|
126
|
+
// ---- The scoreboard. ----
|
|
127
|
+
/** The size of the scoreboard over a surface of `w` by `h` feet (its long side along the surface's), and how high its lower edge hangs. */
|
|
128
|
+
export function boardSize(w, h) {
|
|
129
|
+
const pick = (share, [lo, hi], side) => clamp(side * share, Math.min(lo, side * 0.6), hi);
|
|
130
|
+
return { w: pick(BOARD.share.w, BOARD.wide, w), d: pick(BOARD.share.d, BOARD.deep, h), hang: clamp(Math.max(w, h) * BOARD.hang.share, BOARD.hang.least, BOARD.hang.most) };
|
|
131
|
+
}
|
|
132
|
+
/** Whether a sport has a scoreboard hung over its surface: a ballpark's stands behind the outfield, so it has none here. */
|
|
133
|
+
export const hangsOver = (sport) => sport !== "mlb";
|
|
134
|
+
/** The segments of a seven-segment digit, a to g, that are lit for each digit. */
|
|
135
|
+
const SEGMENTS = ["abcdef", "bc", "abged", "abgcd", "fgbc", "afgcd", "afgedc", "abc", "abcdefg", "abcdfg"];
|
|
136
|
+
/** A number of one or two digits in seven segments, `high` feet tall, from (x, y) at its top left: the path and the width it takes. */
|
|
137
|
+
function digits(value, x, y, high) {
|
|
138
|
+
const text = String(Math.min(99, Math.max(0, Math.trunc(value))));
|
|
139
|
+
const w = high * 0.56;
|
|
140
|
+
const t = high * 0.13;
|
|
141
|
+
const half = high / 2;
|
|
142
|
+
const rects = {
|
|
143
|
+
a: [t * 0.6, 0, w - t * 1.2, t],
|
|
144
|
+
b: [w - t, t * 0.6, t, half - t * 0.9],
|
|
145
|
+
c: [w - t, half + t * 0.3, t, half - t * 0.9],
|
|
146
|
+
d: [t * 0.6, high - t, w - t * 1.2, t],
|
|
147
|
+
e: [0, half + t * 0.3, t, half - t * 0.9],
|
|
148
|
+
f: [0, t * 0.6, t, half - t * 0.9],
|
|
149
|
+
g: [t * 0.6, half - t / 2, w - t * 1.2, t],
|
|
150
|
+
};
|
|
151
|
+
let d = "";
|
|
152
|
+
[...text].forEach((ch, i) => {
|
|
153
|
+
for (const s of SEGMENTS[Number(ch)]) {
|
|
154
|
+
const [rx, ry, rw, rh] = rects[s];
|
|
155
|
+
d += `M${n(x + i * (w + t) + rx)} ${n(y + ry)}h${n(rw)}v${n(rh)}h${n(-rw)}z`;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
return { d, width: text.length * w + (text.length - 1) * t };
|
|
159
|
+
}
|
|
160
|
+
/** The face of the main board, `w` by `h` feet: a dark screen with a band of light along its top and bottom, a block of colour at each end, and the score between them. */
|
|
161
|
+
function boardFace(w, h, look) {
|
|
162
|
+
const [c0, c1, c2] = look.colors;
|
|
163
|
+
const edge = Math.min(0.5, h * 0.06);
|
|
164
|
+
const band = h * 0.1;
|
|
165
|
+
let svg = `<rect class="u-led-bed" width="${n(w)}" height="${n(h)}"/><rect class="u-led-screen" x="${n(edge)}" y="${n(edge)}" width="${n(w - 2 * edge)}" height="${n(h - 2 * edge)}"/>`;
|
|
166
|
+
svg += `<path class="u-led" fill="${c2}" d="M${n(edge)} ${n(edge)}h${n(w - 2 * edge)}v${n(band)}h${n(-(w - 2 * edge))}zM${n(edge)} ${n(h - edge - band)}h${n(w - 2 * edge)}v${n(band)}h${n(-(w - 2 * edge))}z"/>`;
|
|
167
|
+
const block = Math.min(w * 0.2, h * 0.5);
|
|
168
|
+
const [yb, hb] = [h * 0.28, h * 0.44];
|
|
169
|
+
svg += `<path class="u-led" fill="${c0}" d="M${n(edge * 2)} ${n(yb)}h${n(block)}v${n(hb)}h${n(-block)}z"/><path class="u-led" fill="${c1}" d="M${n(w - edge * 2 - block)} ${n(yb)}h${n(block)}v${n(hb)}h${n(-block)}z"/>`;
|
|
170
|
+
// The score: two numbers and a dash, as large as the face between the blocks lets them be.
|
|
171
|
+
const room = w - 2 * (block + edge * 4);
|
|
172
|
+
const digitCount = String(look.score[0]).length + String(look.score[1]).length;
|
|
173
|
+
const dash = 0.4;
|
|
174
|
+
const high = Math.min(h * 0.5, room / (digitCount * 0.56 + (digitCount - 2) * 0.13 + dash + 0.5));
|
|
175
|
+
const [home, away] = [digits(look.score[0], 0, 0, high), digits(look.score[1], 0, 0, high)];
|
|
176
|
+
const gap = high * 0.3;
|
|
177
|
+
const total = home.width + gap + high * dash + gap + away.width;
|
|
178
|
+
const x0 = (w - total) / 2;
|
|
179
|
+
const y0 = (h - high) / 2;
|
|
180
|
+
const [h0, a0] = [digits(look.score[0], x0, y0, high), digits(look.score[1], x0 + home.width + gap * 2 + high * dash, y0, high)];
|
|
181
|
+
svg += `<path class="u-led" fill="${c2}" d="${h0.d}${a0.d}M${n(x0 + home.width + gap)} ${n(y0 + high / 2 - high * 0.065)}h${n(high * dash)}v${n(high * 0.13)}h${n(-high * dash)}z"/>`;
|
|
182
|
+
return svg;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* The scoreboard hung over the middle of a surface: a four sided board with its score on every face, a ring of display under it, a cap on top and a strut up to the rafters. `box` is the surface, `lift` how high the surface stands.
|
|
186
|
+
* Its faces look outwards, each the right way round for an eye outside it.
|
|
187
|
+
*/
|
|
188
|
+
export function centreBoard(id, box, lift, look) {
|
|
189
|
+
const size = boardSize(box.w, box.h);
|
|
190
|
+
const [cx, cy] = [box.x + box.w / 2, box.y + box.h / 2];
|
|
191
|
+
const [x0, x1, y0, y1] = [cx - size.w / 2, cx + size.w / 2, cy - size.d / 2, cy + size.d / 2];
|
|
192
|
+
const ring = clamp(size.w * 0.16, BOARD.ring.rise[0], BOARD.ring.rise[1]);
|
|
193
|
+
const body = clamp(size.w * 0.45, 8, 16);
|
|
194
|
+
const [z0, z1, z2] = [lift + size.hang, lift + size.hang + ring, lift + size.hang + ring + body];
|
|
195
|
+
const ins = size.w * BOARD.ring.inset;
|
|
196
|
+
const insD = size.d * BOARD.ring.inset;
|
|
197
|
+
// The faces, each from the left of an eye outside it to its right: +y, -y, +x, -x.
|
|
198
|
+
const faces = [
|
|
199
|
+
{ name: "south", from: [x0, y1], to: [x1, y1] },
|
|
200
|
+
{ name: "north", from: [x1, y0], to: [x0, y0] },
|
|
201
|
+
{ name: "east", from: [x1, y1], to: [x1, y0] },
|
|
202
|
+
{ name: "west", from: [x0, y0], to: [x0, y1] },
|
|
203
|
+
];
|
|
204
|
+
const planes = [];
|
|
205
|
+
let run = 0;
|
|
206
|
+
for (const f of faces) {
|
|
207
|
+
const long = Math.hypot(f.to[0] - f.from[0], f.to[1] - f.from[1]);
|
|
208
|
+
planes.push(plane(`${id}-${f.name}`, "hung-board", [f.from[0], f.from[1], z2], [f.to[0] - f.from[0], f.to[1] - f.from[1], 0], [0, 0, z1 - z2], boardFace(long, body, look)));
|
|
209
|
+
// The ring of display under it, set in a little on every side, in the pattern the ribbons have.
|
|
210
|
+
const grow = (p, q) => {
|
|
211
|
+
const [dx, dy] = [(q[0] - p[0]) / long, (q[1] - p[1]) / long];
|
|
212
|
+
const cut = f.name === "south" || f.name === "north" ? ins : insD;
|
|
213
|
+
return [[p[0] + dx * cut, p[1] + dy * cut], [q[0] - dx * cut, q[1] - dy * cut]];
|
|
214
|
+
};
|
|
215
|
+
const [r0, r1] = grow(f.from, f.to);
|
|
216
|
+
const span = Math.hypot(r1[0] - r0[0], r1[1] - r0[1]);
|
|
217
|
+
planes.push(plane(`${id}-${f.name}-ring`, "hung-board", [r0[0], r0[1], z1], [r1[0] - r0[0], r1[1] - r0[1], 0], [0, 0, z0 - z1], ledWall(span, ring, look, run)));
|
|
218
|
+
run += long;
|
|
219
|
+
}
|
|
220
|
+
// The cap, a dark top with a thin line of light round its edge, and the strut the board hangs from.
|
|
221
|
+
const [w, d] = [x1 - x0, y1 - y0];
|
|
222
|
+
const rim = Math.min(0.5, d * 0.05);
|
|
223
|
+
const capSvg = `<rect class="u-led-bed" width="${n(w)}" height="${n(d)}"/><path class="u-led" fill="none" stroke="${look.colors[0]}" stroke-width="${n(rim)}" d="M${n(rim * 2)} ${n(rim * 2)}h${n(w - rim * 4)}v${n(d - rim * 4)}h${n(-(w - rim * 4))}z"/>`;
|
|
224
|
+
planes.push(flat(`${id}-cap`, "hung-board", x0, y0, x1, y1, z2, capSvg));
|
|
225
|
+
planes.push(...bar(`${id}-strut`, "frame", [cx, cy, z2], [cx, cy, z2 + BOARD.strut], 0.9, "u-led-bed"));
|
|
226
|
+
return planes;
|
|
227
|
+
}
|
|
228
|
+
// ---- The flat plan. ----
|
|
229
|
+
/** The size of the scoreboard in the flat plan, from the surface's box. */
|
|
230
|
+
export const planBoard = (box) => {
|
|
231
|
+
const s = boardSize(box.w, box.h);
|
|
232
|
+
return { x: box.x + (box.w - s.w) / 2, y: box.y + (box.h - s.d) / 2, w: s.w, d: s.d };
|
|
233
|
+
};
|
|
234
|
+
/** The ribbon boards in the flat plan: a lit line along the front of every tier that has a walk below it (the front of the tiers there is no walk to, where the venue has one level), panels of the colours in turn. */
|
|
235
|
+
export function planRibbons(stands, look) {
|
|
236
|
+
const links = tierLinks(stands);
|
|
237
|
+
const fronts = links.length > 0 ? links.map((l) => l.after) : stands.rings.filter((r) => r.tier !== "wall" && r.tier !== "bleachers").slice(0, 1);
|
|
238
|
+
const paths = fronts.flatMap((ring) => (ring.hole === null ? [] : [outlinePath(ring.hole)])).join("");
|
|
239
|
+
if (paths === "")
|
|
240
|
+
return "";
|
|
241
|
+
const cell = BOARD.panel;
|
|
242
|
+
const lit = look.colors.map((color, k) => el("path", { class: "ky-cr-led", d: paths, fill: "none", stroke: color, "stroke-width": 2.2, "stroke-dasharray": `${cell} ${cell * 2}`, "stroke-dashoffset": -cell * k }));
|
|
243
|
+
return el("g", { class: "ky-cr-ribbon" }, el("path", { class: "ky-cr-led-line", d: paths, "stroke-width": 3.4 }) + lit.join(""));
|
|
244
|
+
}
|
|
245
|
+
/** The scoreboard in the flat plan, as the board hangs over the surface seen from above: its dark cap with a line of light round it and its four edges' colours. */
|
|
246
|
+
export function planScoreboard(box, look) {
|
|
247
|
+
const b = planBoard(box);
|
|
248
|
+
const [c0, c1, c2] = look.colors;
|
|
249
|
+
const rim = b.d * 0.07;
|
|
250
|
+
const inner = { x: b.x + rim * 2, y: b.y + rim * 2, w: b.w - rim * 4, d: b.d - rim * 4 };
|
|
251
|
+
const rect = (cls, r, extra = {}) => el("rect", { class: cls, x: n(r.x), y: n(r.y), width: n(r.w), height: n(r.d), rx: n(rim), ...extra });
|
|
252
|
+
const edge = (x, y, w, h, color) => el("rect", { class: "ky-cr-led", x: n(x), y: n(y), width: n(w), height: n(h), fill: color });
|
|
253
|
+
return el("g", { class: "ky-cr-board" }, rect("ky-cr-led-bed", b) +
|
|
254
|
+
edge(inner.x, inner.y, inner.w, rim, c0) +
|
|
255
|
+
edge(inner.x, inner.y + inner.d - rim, inner.w, rim, c1) +
|
|
256
|
+
edge(inner.x, inner.y, rim, inner.d, c2) +
|
|
257
|
+
edge(inner.x + inner.w - rim, inner.y, rim, inner.d, c2));
|
|
258
|
+
}
|
|
259
|
+
/** How tall the ribbon on the front of a tier is, for a front `top` feet high: the usual ribbon, or less where the front is low. */
|
|
260
|
+
export const ribbonHigh = (top) => Math.min(BOARD.ribbon, top * 0.6);
|
|
261
|
+
/** The ribbon on the top of a wall that stands over the line from `a` to `b` and is `top` feet high (the front of a tier): a wall of its own, as tall as `ribbonHigh` says. `run` is how far along the ribbon the wall starts. */
|
|
262
|
+
export const fasciaRibbon = (id, a, b, top, look, run) => {
|
|
263
|
+
const high = ribbonHigh(top);
|
|
264
|
+
return wall(id, "ribbon", a[0], a[1], b[0], b[1], top - high, top, ledWall(Math.hypot(b[0] - a[0], b[1] - a[1]), high, look, run));
|
|
265
|
+
};
|
|
266
|
+
/** A hall's boards as its stadium asks for them: the layout has scoreboards of its own, so the hall has the ribbons and no scoreboard hung over its middle. */
|
|
267
|
+
export const hallBoards = (ask) => (ask === undefined || ask === false ? undefined : { ...(ask === true ? {} : ask), scoreboard: false });
|
package/dist/venue.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Crowd, type CrowdStands } from "./crowd.ts";
|
|
2
2
|
import { type Cut } from "./venue.geom.ts";
|
|
3
3
|
import { type Upright } from "./turn.kit.ts";
|
|
4
|
-
import type { SurfaceOptions } from "./types.ts";
|
|
4
|
+
import type { LedBoardOptions, SurfaceOptions } from "./types.ts";
|
|
5
5
|
/** What can be asked of the venue. */
|
|
6
6
|
export interface VenueSettings {
|
|
7
7
|
/** Roofs and canopies over the top tier of the stands: a canopy over the back of the top tier in the open, a lid over a hall. They give way to the eye as the walls do. Off by default. */
|
|
@@ -12,12 +12,19 @@ export interface VenueSettings {
|
|
|
12
12
|
walls?: boolean;
|
|
13
13
|
/** Fill the empty places of the stands (the apron round the surface, the back of each bowl): on for a real venue's, off for the usual stands (where it is a tournament layout's hall that asks for it). */
|
|
14
14
|
fill?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The LED boards: ribbon boards along the fascia between the seating levels (on the front of the one level a venue has, where there is no walk) and a scoreboard hung over the middle of the playing surface. `true` for both in the package's
|
|
17
|
+
* colours, or `{ ribbon, scoreboard, colors, pattern, score }`. Generic content, never a logo, a sponsor or a real board's text. Off by default; it wins over the crowd's own `boards`, and `false` turns that one off. See `docs/boards.md`.
|
|
18
|
+
*/
|
|
19
|
+
boards?: boolean | LedBoardOptions;
|
|
15
20
|
/** How finely the curves are cut: `low` a facet to each corner, `auto` (the default) three, `high` six; an oval is 12, 28 or 56 facets round. */
|
|
16
21
|
detail?: Cut;
|
|
17
22
|
}
|
|
18
23
|
/** The settings a venue is built from: the asker's, and the prefix of the ids of what it draws, which the view gives. */
|
|
19
24
|
export interface VenueBuild extends VenueSettings {
|
|
20
25
|
id: string;
|
|
26
|
+
/** Leave the scoreboard hung over the middle out (a tournament hall has scoreboards of its own). */
|
|
27
|
+
noCentre?: boolean;
|
|
21
28
|
}
|
|
22
29
|
/** What the venue is made of: the things that stand, and the patterns they are drawn with (the contents of a `defs`). */
|
|
23
30
|
export interface Venue {
|
package/dist/venue.js
CHANGED
|
@@ -9,6 +9,7 @@ import { groundById } from "./grounds.js";
|
|
|
9
9
|
import { ARC_STEPS, clipAround, clipConvex, clipSegment, areaOf, pointList, raked, slopeOf, stripsOf, tidy } from "./venue.geom.js";
|
|
10
10
|
import { apronPlanes, backEdges, backWall, concourseFloor, rimAt, suiteWall } from "./venue.fill.js";
|
|
11
11
|
import { firstHit, realBuilding } from "./venue.real.js";
|
|
12
|
+
import { centreBoard, fasciaRibbon, hangsOver, ledStrip, resolveBoards, ribbonHigh, ribbonShare, tierLinks } from "./venue.boards.js";
|
|
12
13
|
import { n, shy, wall } from "./turn.kit.js";
|
|
13
14
|
export const NO_VENUE = { items: [], defs: "", reach: 0 };
|
|
14
15
|
/** The sports played under a roof: their stands have a lid and not a canopy. */
|
|
@@ -95,13 +96,13 @@ export function standsVenueOf(stands, crowd, o, v, lift) {
|
|
|
95
96
|
};
|
|
96
97
|
// The tiers. A ring that no concourse leads to is the first of its chain: a low wall stands under its first row.
|
|
97
98
|
const chained = new Set();
|
|
98
|
-
const links = stands
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
const links = tierLinks(stands);
|
|
100
|
+
for (const l of links)
|
|
101
|
+
chained.add(l.after);
|
|
102
|
+
const boards = resolveBoards(v.boards !== undefined ? v.boards : crowd.boards, { home: crowd.home, away: crowd.away });
|
|
103
|
+
const ribbons = [];
|
|
104
|
+
/** How far along the ribbon of one level the next piece of it starts, in feet, so that its panels carry on. */
|
|
105
|
+
let run = 0;
|
|
105
106
|
for (const ring of stands.rings) {
|
|
106
107
|
const strips = stripsOf(ring.region, ring.hole, ring.more ?? [], cut);
|
|
107
108
|
const into = ring.tier === "wall" ? wallSeats : seatPlanes;
|
|
@@ -124,24 +125,45 @@ export function standsVenueOf(stands, crowd, o, v, lift) {
|
|
|
124
125
|
if (Math.hypot(b[0] - a[0], b[1] - a[1]) < 0.5 || inCover([(a[0] + b[0]) / 2, (a[1] + b[1]) / 2]))
|
|
125
126
|
continue;
|
|
126
127
|
const h = lift + ring.height[0];
|
|
127
|
-
const
|
|
128
|
+
const id = `${ring.id}-front-${si === 0 ? "" : `s${si}-`}${i}`;
|
|
129
|
+
const long = Math.hypot(b[0] - a[0], b[1] - a[1]);
|
|
130
|
+
// A venue with one level has its ribbon on the front of that level: the front is the wall below the ribbon, and the ribbon a wall of its own over it.
|
|
131
|
+
const ribbon = boards?.ribbon === true && links.length === 0 && ring.height[0] >= 5 ? ribbonHigh(h) : 0;
|
|
132
|
+
const w = wall(id, "fascia", a[0], a[1], b[0], b[1], 0, h - ribbon, `<rect class="u-fascia" width="${n(long)}" height="${n(h - ribbon)}"/>`);
|
|
128
133
|
seatPlanes.push(shy(w, centre));
|
|
134
|
+
if (ribbon > 0 && boards !== undefined) {
|
|
135
|
+
ribbons.push(shy(fasciaRibbon(`${id}-ribbon`, a, b, h, boards, run), centre));
|
|
136
|
+
run += long;
|
|
137
|
+
}
|
|
129
138
|
}
|
|
130
139
|
});
|
|
131
140
|
}
|
|
132
141
|
}
|
|
133
142
|
// The walks between the tiers: a plane from the outer edge of one tier up to the first row of the next.
|
|
134
143
|
for (const { c, before, after } of links) {
|
|
135
|
-
|
|
136
|
-
|
|
144
|
+
run = 0;
|
|
145
|
+
const rise = after.height[0] - before.height[1];
|
|
137
146
|
for (const q of quadsOf(stripsOf(c.region, c.hole, [], cut))) {
|
|
138
147
|
const slope = slopeOf(q, lift + before.height[1], lift + after.height[0]);
|
|
139
148
|
if (slope === undefined)
|
|
140
149
|
continue;
|
|
150
|
+
const share = boards?.ribbon === true ? ribbonShare(rise, Math.hypot(slope.slope.gx, slope.slope.gy)) : 0;
|
|
141
151
|
for (const piece of pieces(tidy(q))) {
|
|
142
152
|
count += 1;
|
|
153
|
+
// A ribbon board is the top of the walk, a plane of its own over the same slope: the walk below it is the walk less that strip.
|
|
154
|
+
let walk = piece;
|
|
155
|
+
if (share > 0 && boards !== undefined && piece.length === 4) {
|
|
156
|
+
const [a, b, c2, d] = piece;
|
|
157
|
+
const cut1 = (p, q2) => [p[0] + (q2[0] - p[0]) * (1 - share), p[1] + (q2[1] - p[1]) * (1 - share)];
|
|
158
|
+
const [e, f] = [cut1(a, d), cut1(b, c2)];
|
|
159
|
+
walk = [a, b, f, e];
|
|
160
|
+
const rib = raked(`ribbon-${count}`, "ribbon", [e, f, c2, d], slope.slope, slope.along, (corners) => ledStrip(corners, boards, run));
|
|
161
|
+
if (rib !== undefined)
|
|
162
|
+
ribbons.push({ ...rib, shy: slope.out });
|
|
163
|
+
run += Math.hypot(b[0] - a[0], b[1] - a[1]);
|
|
164
|
+
}
|
|
143
165
|
// Where the empty places are filled, the walk between two tiers is the suite level: a facing wall with a band of windows, not a bare shelf.
|
|
144
|
-
const p = raked(`walk-${count}`, "concourse",
|
|
166
|
+
const p = raked(`walk-${count}`, "concourse", walk, slope.slope, slope.along, (corners) => (filled ? suiteWall(corners) : `<polygon class="u-conc" points="${pointList(corners)}"/>`));
|
|
145
167
|
if (p !== undefined)
|
|
146
168
|
seatPlanes.push({ ...p, shy: slope.out });
|
|
147
169
|
}
|
|
@@ -168,6 +190,13 @@ export function standsVenueOf(stands, crowd, o, v, lift) {
|
|
|
168
190
|
const items = [];
|
|
169
191
|
if (seatPlanes.length > 0)
|
|
170
192
|
items.push({ id: "stands", kind: "stands", at: centre, height: topOf(seatPlanes), planes: seatPlanes });
|
|
193
|
+
if (ribbons.length > 0)
|
|
194
|
+
items.push({ id: "ribbon-boards", kind: "ribbon-boards", at: centre, height: topOf(ribbons), planes: ribbons });
|
|
195
|
+
// The scoreboard hung over the middle of the surface (a ballpark has none, and a hall's own scoreboards stand in its place).
|
|
196
|
+
if (boards?.scoreboard === true && v.noCentre !== true && hangsOver(String(o.sport))) {
|
|
197
|
+
const planes = centreBoard("centre-board", stands.box, lift, boards);
|
|
198
|
+
items.push({ id: "centre-board", kind: "hung-board", at: centre, height: topOf(planes), planes });
|
|
199
|
+
}
|
|
171
200
|
if (wallSeats.length > 0)
|
|
172
201
|
items.push({ id: "wall-seats", kind: "wall-seats", at: centre, height: topOf(wallSeats), planes: wallSeats });
|
|
173
202
|
// The roof: a canopy over the back of the top tier, or a lid over it in a hall. A real venue has its own: the walls of its building and a roof of its kind over them.
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The package's version: the same as package.json's, and a test holds them to each other. */
|
|
2
|
-
export declare const VERSION = "0.
|
|
2
|
+
export declare const VERSION = "0.37.0";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The package's version: the same as package.json's, and a test holds them to each other. */
|
|
2
|
-
export const VERSION = "0.
|
|
2
|
+
export const VERSION = "0.37.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/kyogijo-stadiums",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "Kyogijo Stadiums 競技場, 40 sports' surfaces as SVG, drawn to scale from the rulebooks: NFL, CFL and IFAF football fields, an NHL rink, an NBA court, MLB ballparks, soccer pitches, curling sheets, athletics stadiums, speed skating, short track and figure skating rinks, swimming pools, water polo fields, diving wells, artistic swimming areas, and the courts and fields of tennis, volleyball (indoor, beach and sitting), badminton, pickleball, table tennis, padel, squash, racquetball, sepak takraw, teqball, roundnet, netball, lacrosse, rugby, Australian football, Gaelic games, cricket, field hockey and handball, and the budo of judo, karate, kendo, sumo and kyudo with a dojo of tatami laid as real units, the MMA cage, with each team's name and logo on its side and the score in the middle, stands and a crowd, a pageant of flags, and a 3D view. Light and dark, accessible, a compact badge for lists, a helper for React and a custom element. Zero dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sports",
|