@luceosports/play-rendering 2.5.6 → 2.6.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/dist/play-rendering.js +3 -3
- package/dist/play-rendering.js.map +1 -1
- package/dist/types/constants.d.ts +3 -0
- package/dist/types/models/LineModel.d.ts +3 -3
- package/dist/types/models/PlayModel.d.ts +2 -1
- package/dist/types/models/PlayerModel.d.ts +3 -3
- package/dist/types/types/enums.d.ts +4 -0
- package/dist/types/types/index.d.ts +142 -141
- package/package.json +1 -1
- package/src/assets/sand_bg.png +0 -0
- package/src/ballConfig.ts +3 -1
- package/src/constants.ts +4 -0
- package/src/helpers/draw.ts +3 -2
- package/src/index.ts +2 -0
- package/src/layers/court/index.ts +278 -261
- package/src/layers/court/layers/BEACH_VOLLEYBALL/constants.ts +5 -0
- package/src/layers/court/layers/BEACH_VOLLEYBALL/courtTypes/BEACH_VOLLEYBALL_NCAA/constants.ts +2 -0
- package/src/layers/court/layers/BEACH_VOLLEYBALL/courtTypes/BEACH_VOLLEYBALL_RECREATIONAL/constants.ts +2 -0
- package/src/layers/court/layers/BEACH_VOLLEYBALL/layers/BorderRectLayer.ts +10 -0
- package/src/layers/court/layers/BEACH_VOLLEYBALL/layers/CenterLineLayer.ts +20 -0
- package/src/layers/court/layers/BEACH_VOLLEYBALL/layers/HashMarkLayer.ts +24 -0
- package/src/layers/court/layers/BEACH_VOLLEYBALL/layers/index.ts +5 -0
- package/src/models/AnimationModel.ts +8 -2
- package/src/models/FrameModel.ts +34 -15
- package/src/models/LineModel.ts +27 -13
- package/src/models/Play/Options.ts +41 -39
- package/src/models/PlayModel.ts +6 -1
- package/src/models/PlayerModel.ts +9 -5
- package/src/types/enums.ts +4 -0
- package/src/types/index.ts +8 -3
|
@@ -1,261 +1,278 @@
|
|
|
1
|
-
import { CourtType, SportType } from '../../types';
|
|
2
|
-
import {
|
|
3
|
-
COURT_TYPE_BASEBALL_HIGH_SCHOOL,
|
|
4
|
-
COURT_TYPE_BIG3,
|
|
5
|
-
COURT_TYPE_FIBA,
|
|
6
|
-
COURT_TYPE_FOOTBALL_HIGH_SCHOOL,
|
|
7
|
-
COURT_TYPE_FOOTBALL_HIGH_SCHOOL_LEGACY,
|
|
8
|
-
COURT_TYPE_HOCKEY_INTERNATIONAL,
|
|
9
|
-
COURT_TYPE_HOCKEY_NHL,
|
|
10
|
-
COURT_TYPE_LACROSSE_US_M,
|
|
11
|
-
COURT_TYPE_LACROSSE_US_W,
|
|
12
|
-
COURT_TYPE_LACROSSE_BOX_US,
|
|
13
|
-
COURT_TYPE_NBA,
|
|
14
|
-
COURT_TYPE_NCAAM,
|
|
15
|
-
COURT_TYPE_NCAAW,
|
|
16
|
-
COURT_TYPE_SOCCER_FIFA,
|
|
17
|
-
COURT_TYPE_SOCCER_NCAA,
|
|
18
|
-
COURT_TYPE_SOCCER_NFHS,
|
|
19
|
-
COURT_TYPE_SOCCER_U10,
|
|
20
|
-
COURT_TYPE_SOCCER_U12,
|
|
21
|
-
COURT_TYPE_SOCCER_U19,
|
|
22
|
-
COURT_TYPE_US_HIGH_SCHOOL,
|
|
23
|
-
COURT_TYPE_US_JUNIOR_HIGH,
|
|
24
|
-
COURT_TYPE_VOLLEYBALL_INDOOR,
|
|
25
|
-
COURT_TYPE_WNBA,
|
|
26
|
-
SPORT_TYPE_BASEBALL,
|
|
27
|
-
SPORT_TYPE_BASKETBALL,
|
|
28
|
-
SPORT_TYPE_FOOTBALL,
|
|
29
|
-
SPORT_TYPE_HOCKEY,
|
|
30
|
-
SPORT_TYPE_LACROSSE,
|
|
31
|
-
SPORT_TYPE_SOCCER,
|
|
32
|
-
SPORT_TYPE_VOLLEYBALL,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
import
|
|
60
|
-
|
|
61
|
-
import * as
|
|
62
|
-
|
|
63
|
-
import * as
|
|
64
|
-
import * as
|
|
65
|
-
|
|
66
|
-
import * as
|
|
67
|
-
import * as
|
|
68
|
-
import * as
|
|
69
|
-
|
|
70
|
-
import * as
|
|
71
|
-
import * as
|
|
72
|
-
|
|
73
|
-
import * as
|
|
74
|
-
import * as
|
|
75
|
-
import * as
|
|
76
|
-
import * as
|
|
77
|
-
import * as
|
|
78
|
-
import * as
|
|
79
|
-
import * as
|
|
80
|
-
import * as
|
|
81
|
-
import * as
|
|
82
|
-
import * as
|
|
83
|
-
import * as
|
|
84
|
-
import * as
|
|
85
|
-
import * as
|
|
86
|
-
import * as
|
|
87
|
-
import * as
|
|
88
|
-
|
|
89
|
-
import * as
|
|
90
|
-
import * as
|
|
91
|
-
|
|
92
|
-
import * as
|
|
93
|
-
import * as
|
|
94
|
-
|
|
95
|
-
import * as
|
|
96
|
-
import * as
|
|
97
|
-
|
|
98
|
-
import * as
|
|
99
|
-
import * as
|
|
100
|
-
import * as
|
|
101
|
-
|
|
102
|
-
import * as
|
|
103
|
-
import * as
|
|
104
|
-
|
|
105
|
-
import * as
|
|
106
|
-
import * as
|
|
107
|
-
import * as
|
|
108
|
-
|
|
109
|
-
import * as
|
|
110
|
-
import * as
|
|
111
|
-
|
|
112
|
-
import * as
|
|
113
|
-
import * as
|
|
114
|
-
import * as
|
|
115
|
-
|
|
116
|
-
import * as
|
|
117
|
-
import * as
|
|
118
|
-
|
|
119
|
-
import * as
|
|
120
|
-
import * as
|
|
121
|
-
import * as
|
|
122
|
-
import * as
|
|
123
|
-
import * as
|
|
124
|
-
import * as
|
|
125
|
-
import * as
|
|
126
|
-
import * as
|
|
127
|
-
import * as
|
|
128
|
-
|
|
129
|
-
import * as
|
|
130
|
-
import * as
|
|
131
|
-
|
|
132
|
-
import
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
[
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
[
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
[
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
[
|
|
162
|
-
[
|
|
163
|
-
},
|
|
164
|
-
[
|
|
165
|
-
|
|
166
|
-
[
|
|
167
|
-
[
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
[
|
|
171
|
-
[
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
[
|
|
181
|
-
[
|
|
182
|
-
},
|
|
183
|
-
[
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
[
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
[
|
|
194
|
-
[
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
[
|
|
199
|
-
[
|
|
200
|
-
[
|
|
201
|
-
[
|
|
202
|
-
[
|
|
203
|
-
[
|
|
204
|
-
[
|
|
205
|
-
[
|
|
206
|
-
[
|
|
207
|
-
[
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
[
|
|
211
|
-
[
|
|
212
|
-
[
|
|
213
|
-
[
|
|
214
|
-
[
|
|
215
|
-
[
|
|
216
|
-
[
|
|
217
|
-
[
|
|
218
|
-
[
|
|
219
|
-
[
|
|
220
|
-
[
|
|
221
|
-
[
|
|
222
|
-
[
|
|
223
|
-
[
|
|
224
|
-
[
|
|
225
|
-
[
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
[
|
|
229
|
-
[
|
|
230
|
-
[
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
[
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
|
|
1
|
+
import { CourtType, SportType } from '../../types';
|
|
2
|
+
import {
|
|
3
|
+
COURT_TYPE_BASEBALL_HIGH_SCHOOL,
|
|
4
|
+
COURT_TYPE_BIG3,
|
|
5
|
+
COURT_TYPE_FIBA,
|
|
6
|
+
COURT_TYPE_FOOTBALL_HIGH_SCHOOL,
|
|
7
|
+
COURT_TYPE_FOOTBALL_HIGH_SCHOOL_LEGACY,
|
|
8
|
+
COURT_TYPE_HOCKEY_INTERNATIONAL,
|
|
9
|
+
COURT_TYPE_HOCKEY_NHL,
|
|
10
|
+
COURT_TYPE_LACROSSE_US_M,
|
|
11
|
+
COURT_TYPE_LACROSSE_US_W,
|
|
12
|
+
COURT_TYPE_LACROSSE_BOX_US,
|
|
13
|
+
COURT_TYPE_NBA,
|
|
14
|
+
COURT_TYPE_NCAAM,
|
|
15
|
+
COURT_TYPE_NCAAW,
|
|
16
|
+
COURT_TYPE_SOCCER_FIFA,
|
|
17
|
+
COURT_TYPE_SOCCER_NCAA,
|
|
18
|
+
COURT_TYPE_SOCCER_NFHS,
|
|
19
|
+
COURT_TYPE_SOCCER_U10,
|
|
20
|
+
COURT_TYPE_SOCCER_U12,
|
|
21
|
+
COURT_TYPE_SOCCER_U19,
|
|
22
|
+
COURT_TYPE_US_HIGH_SCHOOL,
|
|
23
|
+
COURT_TYPE_US_JUNIOR_HIGH,
|
|
24
|
+
COURT_TYPE_VOLLEYBALL_INDOOR,
|
|
25
|
+
COURT_TYPE_WNBA,
|
|
26
|
+
SPORT_TYPE_BASEBALL,
|
|
27
|
+
SPORT_TYPE_BASKETBALL,
|
|
28
|
+
SPORT_TYPE_FOOTBALL,
|
|
29
|
+
SPORT_TYPE_HOCKEY,
|
|
30
|
+
SPORT_TYPE_LACROSSE,
|
|
31
|
+
SPORT_TYPE_SOCCER,
|
|
32
|
+
SPORT_TYPE_VOLLEYBALL,
|
|
33
|
+
SPORT_TYPE_BEACH_VOLLEYBALL,
|
|
34
|
+
SPORT_TYPE_LACROSSE_BOX,
|
|
35
|
+
SPORT_TYPE_SOFTBALL,
|
|
36
|
+
COURT_TYPE_SOFTBALL_FP_COLLEGE,
|
|
37
|
+
COURT_TYPE_SOFTBALL_FP_HIGH_SCHOOL,
|
|
38
|
+
COURT_TYPE_LACROSSE_BOX_CLA,
|
|
39
|
+
COURT_TYPE_FOOTBALL_COLLEGE,
|
|
40
|
+
COURT_TYPE_FOOTBALL_NFL,
|
|
41
|
+
COURT_TYPE_BEACH_VOLLEYBALL_NCAA,
|
|
42
|
+
COURT_TYPE_BEACH_VOLLEYBALL_RECREATIONAL
|
|
43
|
+
} from '../../constants';
|
|
44
|
+
|
|
45
|
+
export type SportConstants = {
|
|
46
|
+
COURT_LINE_WIDTH: number;
|
|
47
|
+
PLAYER_TOKEN_RADIUS: number;
|
|
48
|
+
PLAYER_TOKEN_SCALE: number;
|
|
49
|
+
LINE_WIDTH: number;
|
|
50
|
+
LINE_MASKING: boolean;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type CourtTypeConstants = {
|
|
54
|
+
COURT_RECT_WIDTH: number;
|
|
55
|
+
COURT_RECT_HEIGHT: number;
|
|
56
|
+
BACKGROUND?: keyof typeof PlayModel.backgroundOptions | string;
|
|
57
|
+
} & Record<string, any>;
|
|
58
|
+
|
|
59
|
+
import InternalCourtLayer from './base/InternalCourtLayer';
|
|
60
|
+
|
|
61
|
+
import * as BaseballLayers from './layers/BASEBALL/layers';
|
|
62
|
+
import * as BaseballConstants from './layers/BASEBALL/constants';
|
|
63
|
+
import * as BaseballHighSchoolLayers from './layers/BASEBALL/courtTypes/BASEBALL_HIGH_SCHOOL/layers';
|
|
64
|
+
import * as BaseballHighSchoolConstants from './layers/BASEBALL/courtTypes/BASEBALL_HIGH_SCHOOL/constants';
|
|
65
|
+
|
|
66
|
+
import * as SoftballLayers from './layers/SOFTBALL/layers';
|
|
67
|
+
import * as SoftballConstants from './layers/SOFTBALL/constants';
|
|
68
|
+
import * as SoftballFPCollageLayers from './layers/SOFTBALL/courtTypes/SOFTBALL_FP_COLLEGE/layers';
|
|
69
|
+
import * as SoftballFPCollageConstants from './layers/SOFTBALL/courtTypes/SOFTBALL_FP_COLLEGE/constants';
|
|
70
|
+
import * as SoftballFPHSLayers from './layers/SOFTBALL/courtTypes/SOFTBALL_FP_HIGH_SCHOOL/layers';
|
|
71
|
+
import * as SoftballFPHSConstants from './layers/SOFTBALL/courtTypes/SOFTBALL_FP_HIGH_SCHOOL/constants';
|
|
72
|
+
|
|
73
|
+
import * as BasketballLayers from './layers/BASKETBALL/layers';
|
|
74
|
+
import * as BasketballConstants from './layers/BASKETBALL/constants';
|
|
75
|
+
import * as BasketballBig3Layers from './layers/BASKETBALL/courtTypes/BIG3/layers';
|
|
76
|
+
import * as BasketballBig3Constants from './layers/BASKETBALL/courtTypes/BIG3/constants';
|
|
77
|
+
import * as BasketballFibaLayers from './layers/BASKETBALL/courtTypes/FIBA/layers';
|
|
78
|
+
import * as BasketballFibaConstants from './layers/BASKETBALL/courtTypes/FIBA/constants';
|
|
79
|
+
import * as BasketballNbaLayers from './layers/BASKETBALL/courtTypes/NBA/layers';
|
|
80
|
+
import * as BasketballNbaConstants from './layers/BASKETBALL/courtTypes/NBA/constants';
|
|
81
|
+
import * as BasketballNcaamLayers from './layers/BASKETBALL/courtTypes/NCAAM/layers';
|
|
82
|
+
import * as BasketballNcaamConstants from './layers/BASKETBALL/courtTypes/NCAAM/constants';
|
|
83
|
+
import * as BasketballNcaawLayers from './layers/BASKETBALL/courtTypes/NCAAW/layers';
|
|
84
|
+
import * as BasketballNcaawConstants from './layers/BASKETBALL/courtTypes/NCAAW/constants';
|
|
85
|
+
import * as BasketballUsHsLayers from './layers/BASKETBALL/courtTypes/US_HIGH_SCHOOL/layers';
|
|
86
|
+
import * as BasketballUsHsConstants from './layers/BASKETBALL/courtTypes/US_HIGH_SCHOOL/constants';
|
|
87
|
+
import * as BasketballUsJhLayers from './layers/BASKETBALL/courtTypes/US_JUNIOR_HIGH/layers';
|
|
88
|
+
import * as BasketballUsJhConstants from './layers/BASKETBALL/courtTypes/US_JUNIOR_HIGH/constants';
|
|
89
|
+
import * as BasketballWnbaLayers from './layers/BASKETBALL/courtTypes/WNBA/layers';
|
|
90
|
+
import * as BasketballWnbaConstants from './layers/BASKETBALL/courtTypes/WNBA/constants';
|
|
91
|
+
|
|
92
|
+
import * as FootballLayers from './layers/FOOTBALL/layers';
|
|
93
|
+
import * as FootballConstants from './layers/FOOTBALL/constants';
|
|
94
|
+
import * as FootballHsConstants from './layers/FOOTBALL/courtTypes/FOOTBALL_HIGH_SCHOOL/constants';
|
|
95
|
+
import * as FootballNflConstants from './layers/FOOTBALL/courtTypes/FOOTBALL_NFL/constants';
|
|
96
|
+
import * as FootballCollegeConstants from './layers/FOOTBALL/courtTypes/FOOTBALL_HIGH_COLLEGE/constants';
|
|
97
|
+
|
|
98
|
+
import * as HockeyLayers from './layers/HOCKEY/layers';
|
|
99
|
+
import * as HockeyConstants from './layers/HOCKEY/constants';
|
|
100
|
+
import * as HockeyNhlLayers from './layers/HOCKEY/courtTypes/HOCKEY_NHL/layers';
|
|
101
|
+
import * as HockeyNhlConstants from './layers/HOCKEY/courtTypes/HOCKEY_NHL/constants';
|
|
102
|
+
import * as HockeyIntLayers from './layers/HOCKEY/courtTypes/HOCKEY_INTERNATIONAL/layers';
|
|
103
|
+
import * as HockeyIntConstants from './layers/HOCKEY/courtTypes/HOCKEY_INTERNATIONAL/constants';
|
|
104
|
+
|
|
105
|
+
import * as LacrosseLayers from './layers/LACROSSE/layers';
|
|
106
|
+
import * as LacrosseConstants from './layers/LACROSSE/constants';
|
|
107
|
+
import * as LacrosseUsMLayers from './layers/LACROSSE/courtTypes/LACROSSE_US_M/layers';
|
|
108
|
+
import * as LacrosseUsMConstants from './layers/LACROSSE/courtTypes/LACROSSE_US_M/constants';
|
|
109
|
+
import * as LacrosseUsWLayers from './layers/LACROSSE/courtTypes/LACROSSE_US_W/layers';
|
|
110
|
+
import * as LacrosseUsWConstants from './layers/LACROSSE/courtTypes/LACROSSE_US_W/constants';
|
|
111
|
+
|
|
112
|
+
import * as LacrosseBoxLayers from './layers/LACROSSE_BOX/layers';
|
|
113
|
+
import * as LacrosseBoxConstants from './layers/LACROSSE_BOX/constants';
|
|
114
|
+
import * as LacrosseBoxUsLayers from './layers/LACROSSE_BOX/courtTypes/LACROSSE_BOX_US/layers';
|
|
115
|
+
import * as LacrosseBoxUsConstants from './layers/LACROSSE_BOX/courtTypes/LACROSSE_BOX_US/constants';
|
|
116
|
+
import * as LacrosseBoxClaLayers from './layers/LACROSSE_BOX/courtTypes/LACROSSE_BOX_CLA/layers';
|
|
117
|
+
import * as LacrosseBoxClaConstants from './layers/LACROSSE_BOX/courtTypes/LACROSSE_BOX_CLA/constants';
|
|
118
|
+
|
|
119
|
+
import * as SoccerLayers from './layers/SOCCER/layers';
|
|
120
|
+
import * as SoccerConstants from './layers/SOCCER/constants';
|
|
121
|
+
import * as SoccerU19Constants from './layers/SOCCER/courtTypes/SOCCER_U19/constants';
|
|
122
|
+
import * as SoccerFifaConstants from './layers/SOCCER/courtTypes/SOCCER_FIFA/constants';
|
|
123
|
+
import * as SoccerNcaaLayers from './layers/SOCCER/courtTypes/SOCCER_NCAA/layers';
|
|
124
|
+
import * as SoccerNcaaConstants from './layers/SOCCER/courtTypes/SOCCER_NCAA/constants';
|
|
125
|
+
import * as SoccerNfhsLayers from './layers/SOCCER/courtTypes/SOCCER_NFHS/layers';
|
|
126
|
+
import * as SoccerNfhsConstants from './layers/SOCCER/courtTypes/SOCCER_NFHS/constants';
|
|
127
|
+
import * as SoccerU10Layers from './layers/SOCCER/courtTypes/SOCCER_U10/layers';
|
|
128
|
+
import * as SoccerU10Constants from './layers/SOCCER/courtTypes/SOCCER_U10/constants';
|
|
129
|
+
import * as SoccerU12Layers from './layers/SOCCER/courtTypes/SOCCER_U12/layers';
|
|
130
|
+
import * as SoccerU12Constants from './layers/SOCCER/courtTypes/SOCCER_U12/constants';
|
|
131
|
+
|
|
132
|
+
import * as VolleyballLayers from './layers/VOLLEYBALL/layers';
|
|
133
|
+
import * as VolleyballConstants from './layers/VOLLEYBALL/constants';
|
|
134
|
+
import * as VolleyballIndoorConstants from './layers/VOLLEYBALL/courtTypes/VOLLEYBALL_INDOOR/constants';
|
|
135
|
+
|
|
136
|
+
import * as BeachVolleyballLayers from './layers/BEACH_VOLLEYBALL/layers';
|
|
137
|
+
import * as BeachVolleyballConstants from './layers/BEACH_VOLLEYBALL/constants';
|
|
138
|
+
import * as BeachVolleyballNcaaConstants from './layers/BEACH_VOLLEYBALL/courtTypes/BEACH_VOLLEYBALL_NCAA/constants';
|
|
139
|
+
import * as BeachVolleyballRecreationalConstants from './layers/BEACH_VOLLEYBALL/courtTypes/BEACH_VOLLEYBALL_RECREATIONAL/constants';
|
|
140
|
+
|
|
141
|
+
import PlayModel from '../../models/PlayModel';
|
|
142
|
+
|
|
143
|
+
const sportLayers: Record<SportType, Record<string, typeof InternalCourtLayer>> = {
|
|
144
|
+
[SPORT_TYPE_BASEBALL]: BaseballLayers,
|
|
145
|
+
[SPORT_TYPE_SOFTBALL]: SoftballLayers,
|
|
146
|
+
[SPORT_TYPE_BASKETBALL]: BasketballLayers,
|
|
147
|
+
[SPORT_TYPE_FOOTBALL]: FootballLayers,
|
|
148
|
+
[SPORT_TYPE_HOCKEY]: HockeyLayers,
|
|
149
|
+
[SPORT_TYPE_LACROSSE]: LacrosseLayers,
|
|
150
|
+
[SPORT_TYPE_LACROSSE_BOX]: LacrosseBoxLayers,
|
|
151
|
+
[SPORT_TYPE_SOCCER]: SoccerLayers,
|
|
152
|
+
[SPORT_TYPE_VOLLEYBALL]: VolleyballLayers,
|
|
153
|
+
[SPORT_TYPE_BEACH_VOLLEYBALL]: BeachVolleyballLayers
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const courtTypeLayers: Record<SportType, Partial<Record<CourtType, Record<string, typeof InternalCourtLayer>>>> = {
|
|
157
|
+
[SPORT_TYPE_BASEBALL]: {
|
|
158
|
+
[COURT_TYPE_BASEBALL_HIGH_SCHOOL]: BaseballHighSchoolLayers
|
|
159
|
+
},
|
|
160
|
+
[SPORT_TYPE_SOFTBALL]: {
|
|
161
|
+
[COURT_TYPE_SOFTBALL_FP_COLLEGE]: SoftballFPCollageLayers,
|
|
162
|
+
[COURT_TYPE_SOFTBALL_FP_HIGH_SCHOOL]: SoftballFPHSLayers
|
|
163
|
+
},
|
|
164
|
+
[SPORT_TYPE_BASKETBALL]: {
|
|
165
|
+
[COURT_TYPE_BIG3]: BasketballBig3Layers,
|
|
166
|
+
[COURT_TYPE_FIBA]: BasketballFibaLayers,
|
|
167
|
+
[COURT_TYPE_NBA]: BasketballNbaLayers,
|
|
168
|
+
[COURT_TYPE_NCAAM]: BasketballNcaamLayers,
|
|
169
|
+
[COURT_TYPE_NCAAW]: BasketballNcaawLayers,
|
|
170
|
+
[COURT_TYPE_US_HIGH_SCHOOL]: BasketballUsHsLayers,
|
|
171
|
+
[COURT_TYPE_US_JUNIOR_HIGH]: BasketballUsJhLayers,
|
|
172
|
+
[COURT_TYPE_WNBA]: BasketballWnbaLayers
|
|
173
|
+
},
|
|
174
|
+
[SPORT_TYPE_FOOTBALL]: {},
|
|
175
|
+
[SPORT_TYPE_HOCKEY]: {
|
|
176
|
+
[COURT_TYPE_HOCKEY_NHL]: HockeyNhlLayers,
|
|
177
|
+
[COURT_TYPE_HOCKEY_INTERNATIONAL]: HockeyIntLayers
|
|
178
|
+
},
|
|
179
|
+
[SPORT_TYPE_LACROSSE]: {
|
|
180
|
+
[COURT_TYPE_LACROSSE_US_M]: LacrosseUsMLayers,
|
|
181
|
+
[COURT_TYPE_LACROSSE_US_W]: LacrosseUsWLayers
|
|
182
|
+
},
|
|
183
|
+
[SPORT_TYPE_LACROSSE_BOX]: {
|
|
184
|
+
[COURT_TYPE_LACROSSE_BOX_US]: LacrosseBoxUsLayers,
|
|
185
|
+
[COURT_TYPE_LACROSSE_BOX_CLA]: LacrosseBoxClaLayers
|
|
186
|
+
},
|
|
187
|
+
[SPORT_TYPE_SOCCER]: {
|
|
188
|
+
[COURT_TYPE_SOCCER_NCAA]: SoccerNcaaLayers,
|
|
189
|
+
[COURT_TYPE_SOCCER_NFHS]: SoccerNfhsLayers,
|
|
190
|
+
[COURT_TYPE_SOCCER_U10]: SoccerU10Layers,
|
|
191
|
+
[COURT_TYPE_SOCCER_U12]: SoccerU12Layers
|
|
192
|
+
},
|
|
193
|
+
[SPORT_TYPE_VOLLEYBALL]: {},
|
|
194
|
+
[SPORT_TYPE_BEACH_VOLLEYBALL]: {}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const sportConstants: Record<SportType, SportConstants> = {
|
|
198
|
+
[SPORT_TYPE_BASEBALL]: BaseballConstants,
|
|
199
|
+
[SPORT_TYPE_SOFTBALL]: SoftballConstants,
|
|
200
|
+
[SPORT_TYPE_BASKETBALL]: BasketballConstants,
|
|
201
|
+
[SPORT_TYPE_FOOTBALL]: FootballConstants,
|
|
202
|
+
[SPORT_TYPE_HOCKEY]: HockeyConstants,
|
|
203
|
+
[SPORT_TYPE_LACROSSE]: LacrosseConstants,
|
|
204
|
+
[SPORT_TYPE_LACROSSE_BOX]: LacrosseBoxConstants,
|
|
205
|
+
[SPORT_TYPE_SOCCER]: SoccerConstants,
|
|
206
|
+
[SPORT_TYPE_VOLLEYBALL]: VolleyballConstants,
|
|
207
|
+
[SPORT_TYPE_BEACH_VOLLEYBALL]: BeachVolleyballConstants
|
|
208
|
+
};
|
|
209
|
+
const courtTypeConstants: Record<CourtType, CourtTypeConstants> = {
|
|
210
|
+
[COURT_TYPE_BASEBALL_HIGH_SCHOOL]: BaseballHighSchoolConstants,
|
|
211
|
+
[COURT_TYPE_SOFTBALL_FP_COLLEGE]: SoftballFPCollageConstants,
|
|
212
|
+
[COURT_TYPE_SOFTBALL_FP_HIGH_SCHOOL]: SoftballFPHSConstants,
|
|
213
|
+
[COURT_TYPE_BIG3]: BasketballBig3Constants,
|
|
214
|
+
[COURT_TYPE_FIBA]: BasketballFibaConstants,
|
|
215
|
+
[COURT_TYPE_NBA]: BasketballNbaConstants,
|
|
216
|
+
[COURT_TYPE_NCAAM]: BasketballNcaamConstants,
|
|
217
|
+
[COURT_TYPE_NCAAW]: BasketballNcaawConstants,
|
|
218
|
+
[COURT_TYPE_US_HIGH_SCHOOL]: BasketballUsHsConstants,
|
|
219
|
+
[COURT_TYPE_US_JUNIOR_HIGH]: BasketballUsJhConstants,
|
|
220
|
+
[COURT_TYPE_WNBA]: BasketballWnbaConstants,
|
|
221
|
+
[COURT_TYPE_FOOTBALL_COLLEGE]: FootballCollegeConstants,
|
|
222
|
+
[COURT_TYPE_FOOTBALL_NFL]: FootballNflConstants,
|
|
223
|
+
[COURT_TYPE_FOOTBALL_HIGH_SCHOOL_LEGACY]: FootballHsConstants,
|
|
224
|
+
[COURT_TYPE_FOOTBALL_HIGH_SCHOOL]: FootballHsConstants,
|
|
225
|
+
[COURT_TYPE_HOCKEY_NHL]: HockeyNhlConstants,
|
|
226
|
+
[COURT_TYPE_HOCKEY_INTERNATIONAL]: HockeyIntConstants,
|
|
227
|
+
[COURT_TYPE_LACROSSE_US_M]: LacrosseUsMConstants,
|
|
228
|
+
[COURT_TYPE_LACROSSE_US_W]: LacrosseUsWConstants,
|
|
229
|
+
[COURT_TYPE_LACROSSE_BOX_US]: LacrosseBoxUsConstants,
|
|
230
|
+
[COURT_TYPE_LACROSSE_BOX_CLA]: LacrosseBoxClaConstants,
|
|
231
|
+
[COURT_TYPE_SOCCER_FIFA]: SoccerFifaConstants,
|
|
232
|
+
[COURT_TYPE_SOCCER_NCAA]: SoccerNcaaConstants,
|
|
233
|
+
[COURT_TYPE_SOCCER_NFHS]: SoccerNfhsConstants,
|
|
234
|
+
[COURT_TYPE_SOCCER_U10]: SoccerU10Constants,
|
|
235
|
+
[COURT_TYPE_SOCCER_U12]: SoccerU12Constants,
|
|
236
|
+
[COURT_TYPE_SOCCER_U19]: SoccerU19Constants,
|
|
237
|
+
[COURT_TYPE_VOLLEYBALL_INDOOR]: VolleyballIndoorConstants,
|
|
238
|
+
[COURT_TYPE_BEACH_VOLLEYBALL_NCAA]: BeachVolleyballNcaaConstants,
|
|
239
|
+
[COURT_TYPE_BEACH_VOLLEYBALL_RECREATIONAL]: BeachVolleyballRecreationalConstants
|
|
240
|
+
};
|
|
241
|
+
const sportCourtTypeMap: Record<SportType, { courtTypes: CourtType[] }> = {
|
|
242
|
+
[SPORT_TYPE_BASEBALL]: { courtTypes: [COURT_TYPE_BASEBALL_HIGH_SCHOOL] },
|
|
243
|
+
[SPORT_TYPE_SOFTBALL]: { courtTypes: [COURT_TYPE_SOFTBALL_FP_COLLEGE, COURT_TYPE_SOFTBALL_FP_HIGH_SCHOOL] },
|
|
244
|
+
[SPORT_TYPE_BASKETBALL]: {
|
|
245
|
+
courtTypes: [
|
|
246
|
+
COURT_TYPE_BIG3,
|
|
247
|
+
COURT_TYPE_FIBA,
|
|
248
|
+
COURT_TYPE_NBA,
|
|
249
|
+
COURT_TYPE_NCAAM,
|
|
250
|
+
COURT_TYPE_NCAAW,
|
|
251
|
+
COURT_TYPE_US_HIGH_SCHOOL,
|
|
252
|
+
COURT_TYPE_US_JUNIOR_HIGH,
|
|
253
|
+
COURT_TYPE_WNBA
|
|
254
|
+
]
|
|
255
|
+
},
|
|
256
|
+
[SPORT_TYPE_FOOTBALL]: {
|
|
257
|
+
courtTypes: [COURT_TYPE_FOOTBALL_HIGH_SCHOOL, COURT_TYPE_FOOTBALL_COLLEGE, COURT_TYPE_FOOTBALL_NFL]
|
|
258
|
+
},
|
|
259
|
+
[SPORT_TYPE_HOCKEY]: { courtTypes: [COURT_TYPE_HOCKEY_NHL, COURT_TYPE_HOCKEY_INTERNATIONAL] },
|
|
260
|
+
[SPORT_TYPE_LACROSSE]: { courtTypes: [COURT_TYPE_LACROSSE_US_M, COURT_TYPE_LACROSSE_US_W] },
|
|
261
|
+
[SPORT_TYPE_LACROSSE_BOX]: { courtTypes: [COURT_TYPE_LACROSSE_BOX_US, COURT_TYPE_LACROSSE_BOX_CLA] },
|
|
262
|
+
[SPORT_TYPE_SOCCER]: {
|
|
263
|
+
courtTypes: [
|
|
264
|
+
COURT_TYPE_SOCCER_FIFA,
|
|
265
|
+
COURT_TYPE_SOCCER_NCAA,
|
|
266
|
+
COURT_TYPE_SOCCER_NFHS,
|
|
267
|
+
COURT_TYPE_SOCCER_U10,
|
|
268
|
+
COURT_TYPE_SOCCER_U12,
|
|
269
|
+
COURT_TYPE_SOCCER_U19
|
|
270
|
+
]
|
|
271
|
+
},
|
|
272
|
+
[SPORT_TYPE_VOLLEYBALL]: { courtTypes: [COURT_TYPE_VOLLEYBALL_INDOOR] },
|
|
273
|
+
[SPORT_TYPE_BEACH_VOLLEYBALL]: {
|
|
274
|
+
courtTypes: [COURT_TYPE_BEACH_VOLLEYBALL_NCAA, COURT_TYPE_BEACH_VOLLEYBALL_RECREATIONAL]
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
export { sportLayers, courtTypeLayers, sportConstants, courtTypeConstants, sportCourtTypeMap };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import InternalCourtLayer from '../../../base/InternalCourtLayer';
|
|
2
|
+
|
|
3
|
+
export default class BorderRectLayer extends InternalCourtLayer {
|
|
4
|
+
drawLogic() {
|
|
5
|
+
this.ctx.beginPath();
|
|
6
|
+
this.ctx.lineWidth = this.courtTypeConstants.COURT_LINE_WIDTH * 2;
|
|
7
|
+
this.ctx.rect(0, 0, this.courtTypeConstants.COURT_RECT_WIDTH, this.courtTypeConstants.COURT_RECT_HEIGHT);
|
|
8
|
+
this.ctx.stroke();
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import InternalCourtLayer from '../../../base/InternalCourtLayer';
|
|
2
|
+
|
|
3
|
+
const NET_COLOR = '#b0ab9e';
|
|
4
|
+
|
|
5
|
+
export default class CenterLineLayer extends InternalCourtLayer {
|
|
6
|
+
drawLogic() {
|
|
7
|
+
const courtOrigin = { x: 0.0, y: this.courtCenter.y };
|
|
8
|
+
const courtTerminus = { x: this.courtTypeConstants.COURT_RECT_WIDTH, y: this.courtCenter.y };
|
|
9
|
+
|
|
10
|
+
this.setColor(NET_COLOR);
|
|
11
|
+
|
|
12
|
+
this.ctx.beginPath();
|
|
13
|
+
this.ctx.lineWidth = this.courtTypeConstants.COURT_LINE_WIDTH * 6;
|
|
14
|
+
this.ctx.moveTo(courtOrigin.x, courtOrigin.y);
|
|
15
|
+
this.ctx.lineTo(courtTerminus.x, courtTerminus.y);
|
|
16
|
+
this.ctx.stroke();
|
|
17
|
+
|
|
18
|
+
this.ctx.beginPath();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import InternalCourtLayer from '../../../base/InternalCourtLayer';
|
|
2
|
+
|
|
3
|
+
const HASH_MARK_LENGTH = 0.574;
|
|
4
|
+
|
|
5
|
+
export default class HashMarkLayer extends InternalCourtLayer {
|
|
6
|
+
reflection() {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
drawLogic() {
|
|
11
|
+
const courtOriginX = 0.0;
|
|
12
|
+
const courtTerminusX = this.courtTypeConstants.COURT_RECT_WIDTH;
|
|
13
|
+
|
|
14
|
+
this.ctx.beginPath();
|
|
15
|
+
this.ctx.moveTo(courtOriginX, -HASH_MARK_LENGTH);
|
|
16
|
+
this.ctx.lineTo(courtOriginX, -HASH_MARK_LENGTH * 2);
|
|
17
|
+
this.ctx.stroke();
|
|
18
|
+
|
|
19
|
+
this.ctx.beginPath();
|
|
20
|
+
this.ctx.moveTo(courtTerminusX, -HASH_MARK_LENGTH);
|
|
21
|
+
this.ctx.lineTo(courtTerminusX, -HASH_MARK_LENGTH * 2);
|
|
22
|
+
this.ctx.stroke();
|
|
23
|
+
}
|
|
24
|
+
}
|