Skip to content

Commit 3e6d8fa

Browse files
authored
Merge pull request #33 from nguyenank/distance-fix
Fixed Fix goal coordinates being off for customizable dimension playing areas.
2 parents 047dda9 + 59d9a56 commit 3e6d8fa

File tree

5 files changed

+43
-12
lines changed

5 files changed

+43
-12
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ All notable changes to this project will be documented in this file.
77
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
88
and this project adheres to the spirit of [Semantic Versioning](https://semver.org/spec/v2.0.0.html) as best it can without a proper API.
99

10+
## [2.4.1] - 2025-03-29
11+
12+
### Fixed
13+
14+
- Fix goal coordinates being off for customizable dimension playing areas.
15+
1016
## [2.4.0] - 2025-01-31
1117

1218
### Added
@@ -299,6 +305,7 @@ and this project adheres to the spirit of [Semantic Versioning](https://semver.o
299305
- Ability to click on rink to create dot and add row to table with the current details.
300306
- Ability to download and upload table.
301307

308+
[2.4.1]: https://github.com/nguyenank/shot-plotter/releases/tag/v2.4.1
302309
[2.4.0]: https://github.com/nguyenank/shot-plotter/releases/tag/v2.4.0
303310
[2.3.0]: https://github.com/nguyenank/shot-plotter/releases/tag/v2.3.0
304311
[2.2.0]: https://github.com/nguyenank/shot-plotter/releases/tag/v2.2.0

html/index.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@
4949

5050
<body>
5151
<!-- inject:banner -->
52-
<div class="alert alert-info" role="alert">
53-
<b>01/31/25:</b> Men's lacrosse net and women's lacrosse net have been
54-
added!
55-
</div>
56-
5752
<!-- endinject -->
5853
<div class="center header">
5954
<h1>Shot-Plotter</h1>

js/custom-setups/playing-area-setup.js

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import { sport, cfgSportA, dataStorage } from "../../setup.js";
1+
import {
2+
sport,
3+
cfgSportA,
4+
dataStorage,
5+
cfgSportGoalCoords,
6+
setCfgSportGoalCoords,
7+
} from "../../setup.js";
28
import { setRows, getRows } from "../table/table-functions.js";
39
import { minMaxes } from "./min-max.js";
410

@@ -88,6 +94,11 @@ function customSoccerPlayingAreaSetup() {
8894
const goalarea = inYards ? 6 : 5.5;
8995
const arc = inYards ? 8 : 7.312;
9096

97+
setCfgSportGoalCoords([
98+
[0, halfh],
99+
[w, halfh],
100+
]);
101+
91102
const svg = d3.select(`#${sport}-svg`);
92103
svg.attr("viewBox", `-1 -1 ${w + 2} ${h + 2}`);
93104

@@ -197,6 +208,12 @@ function customIndoorLacrossePlayingAreaSetup() {
197208
const halfw = w / 2;
198209
const halfh = h / 2;
199210

211+
const goalLine = 12;
212+
setCfgSportGoalCoords([
213+
[goalLine, halfh],
214+
[w - goalLine, halfh],
215+
]);
216+
200217
if (w !== 0 && h !== 0 && (storedWidth !== w || storedHeight !== h)) {
201218
dataStorage.set("width", w);
202219
dataStorage.set("height", h);
@@ -287,16 +304,18 @@ function customIndoorLacrossePlayingAreaSetup() {
287304
const goal_depth = Math.sqrt(4.5 ** 2 - halfgoal ** 2);
288305
ga.select(`#${dir}-goal-net`).attr(
289306
"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}`
293310
);
294311

295312
const intersect = Math.sqrt(9.25 ** 2 - (goal_depth - 1) ** 2);
296313
ga.select(`#${dir}-goal-crease`).attr(
297314
"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+
}
300319
Z`
301320
);
302321
}
@@ -356,6 +375,12 @@ function customIceHockeyPlayingAreaSetup() {
356375
const halfw = w / 2;
357376
const halfh = h / 2;
358377

378+
const iihfGoalLineDistance = 4;
379+
setCfgSportGoalCoords([
380+
[iihfGoalLineDistance, halfh],
381+
[w - iihfGoalLineDistance, halfh],
382+
]);
383+
359384
if (w !== 0 && h !== 0 && (storedWidth !== w || storedHeight !== h)) {
360385
dataStorage.set("width", w);
361386
dataStorage.set("height", h);

preprocessing/gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const inject = require("gulp-inject");
66
const del = require("del");
77
const sports = require("../supported-sports.json").sports;
88

9-
const indexBanner = true;
9+
const indexBanner = false;
1010
const banner = false;
1111
const analytics = true;
1212

setup.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ export function indexSetup() {
2929
});
3030
}
3131

32+
export function setCfgSportGoalCoords(newGoalCoords) {
33+
cfgSportGoalCoords = newGoalCoords;
34+
}
35+
3236
export function setup(s) {
3337
sport = s;
3438
dataStorage = localDataStorage(sport);

0 commit comments

Comments
 (0)