|
1 |
| -import { sport, cfgSportA, dataStorage } from "../../setup.js"; |
| 1 | +import { |
| 2 | + sport, |
| 3 | + cfgSportA, |
| 4 | + dataStorage, |
| 5 | + cfgSportGoalCoords, |
| 6 | + setCfgSportGoalCoords, |
| 7 | +} from "../../setup.js"; |
2 | 8 | import { setRows, getRows } from "../table/table-functions.js";
|
3 | 9 | import { minMaxes } from "./min-max.js";
|
4 | 10 |
|
@@ -88,6 +94,11 @@ function customSoccerPlayingAreaSetup() {
|
88 | 94 | const goalarea = inYards ? 6 : 5.5;
|
89 | 95 | const arc = inYards ? 8 : 7.312;
|
90 | 96 |
|
| 97 | + setCfgSportGoalCoords([ |
| 98 | + [0, halfh], |
| 99 | + [w, halfh], |
| 100 | + ]); |
| 101 | + |
91 | 102 | const svg = d3.select(`#${sport}-svg`);
|
92 | 103 | svg.attr("viewBox", `-1 -1 ${w + 2} ${h + 2}`);
|
93 | 104 |
|
@@ -197,6 +208,12 @@ function customIndoorLacrossePlayingAreaSetup() {
|
197 | 208 | const halfw = w / 2;
|
198 | 209 | const halfh = h / 2;
|
199 | 210 |
|
| 211 | + const goalLine = 12; |
| 212 | + setCfgSportGoalCoords([ |
| 213 | + [goalLine, halfh], |
| 214 | + [w - goalLine, halfh], |
| 215 | + ]); |
| 216 | + |
200 | 217 | if (w !== 0 && h !== 0 && (storedWidth !== w || storedHeight !== h)) {
|
201 | 218 | dataStorage.set("width", w);
|
202 | 219 | dataStorage.set("height", h);
|
@@ -287,16 +304,18 @@ function customIndoorLacrossePlayingAreaSetup() {
|
287 | 304 | const goal_depth = Math.sqrt(4.5 ** 2 - halfgoal ** 2);
|
288 | 305 | ga.select(`#${dir}-goal-net`).attr(
|
289 | 306 | "d",
|
290 |
| - `M 12 ${halfh - halfgoal} |
291 |
| - L ${12 - goal_depth} ${halfh} |
292 |
| - L 12 ${halfh + halfgoal}` |
| 307 | + `M ${goalLine} ${halfh - halfgoal} |
| 308 | + L ${goalLine - goal_depth} ${halfh} |
| 309 | + L ${goalLine} ${halfh + halfgoal}` |
293 | 310 | );
|
294 | 311 |
|
295 | 312 | const intersect = Math.sqrt(9.25 ** 2 - (goal_depth - 1) ** 2);
|
296 | 313 | ga.select(`#${dir}-goal-crease`).attr(
|
297 | 314 | "d",
|
298 |
| - `M ${12 - goal_depth - 1} ${halfh - intersect} |
299 |
| - A 9.25 9.25 0 1 1 ${12 - goal_depth - 1} ${halfh + intersect} |
| 315 | + `M ${goalLine - goal_depth - 1} ${halfh - intersect} |
| 316 | + A 9.25 9.25 0 1 1 ${goalLine - goal_depth - 1} ${ |
| 317 | + halfh + intersect |
| 318 | + } |
300 | 319 | Z`
|
301 | 320 | );
|
302 | 321 | }
|
@@ -356,6 +375,12 @@ function customIceHockeyPlayingAreaSetup() {
|
356 | 375 | const halfw = w / 2;
|
357 | 376 | const halfh = h / 2;
|
358 | 377 |
|
| 378 | + const iihfGoalLineDistance = 4; |
| 379 | + setCfgSportGoalCoords([ |
| 380 | + [iihfGoalLineDistance, halfh], |
| 381 | + [w - iihfGoalLineDistance, halfh], |
| 382 | + ]); |
| 383 | + |
359 | 384 | if (w !== 0 && h !== 0 && (storedWidth !== w || storedHeight !== h)) {
|
360 | 385 | dataStorage.set("width", w);
|
361 | 386 | dataStorage.set("height", h);
|
|
0 commit comments