@luceosports/play-rendering 2.3.1 → 2.4.1

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.
Files changed (27) hide show
  1. package/dist/play-rendering.js +4 -4
  2. package/dist/play-rendering.js.map +1 -1
  3. package/dist/types/constants.d.ts +3 -0
  4. package/dist/types/types/index.d.ts +140 -139
  5. package/package.json +1 -1
  6. package/src/constants.ts +4 -0
  7. package/src/layers/court/index.ts +20 -1
  8. package/src/layers/court/layers/LACROSSE_BOX/courtTypes/LACROSSE_BOX_US/layers/RefereeCreaseLayer.ts +36 -0
  9. package/src/layers/court/layers/LACROSSE_BOX/courtTypes/LACROSSE_BOX_US/layers/RestrainingLineLayer.ts +20 -0
  10. package/src/layers/court/layers/LACROSSE_BOX/layers/CenterLineLayer.ts +23 -0
  11. package/src/layers/court/layers/SOFTBALL/constants.ts +5 -0
  12. package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_COLLEGE/constants.ts +36 -0
  13. package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_COLLEGE/layers/ADirtLayer.ts +96 -0
  14. package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_COLLEGE/layers/BaseLineLayer.ts +99 -0
  15. package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_COLLEGE/layers/HomePlateLayer.ts +119 -0
  16. package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_COLLEGE/layers/PitchingMoundLayer.ts +39 -0
  17. package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_COLLEGE/layers/index.ts +6 -0
  18. package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_HIGH_SCHOOL/constants.ts +36 -0
  19. package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_HIGH_SCHOOL/layers/ADirtLayer.ts +96 -0
  20. package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_HIGH_SCHOOL/layers/BaseLineLayer.ts +99 -0
  21. package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_HIGH_SCHOOL/layers/HomePlateLayer.ts +119 -0
  22. package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_HIGH_SCHOOL/layers/PitchingMoundLayer.ts +39 -0
  23. package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_HIGH_SCHOOL/layers/index.ts +6 -0
  24. package/src/layers/court/layers/SOFTBALL/layers/BorderRectLayer.ts +10 -0
  25. package/src/layers/court/layers/SOFTBALL/layers/index.ts +3 -0
  26. package/src/models/PlayModel.ts +3 -1
  27. package/src/types/index.ts +5 -1
@@ -6,6 +6,7 @@ export declare const SPORT_TYPE_LACROSSE_BOX = "LACROSSE_BOX";
6
6
  export declare const SPORT_TYPE_SOCCER = "SOCCER";
7
7
  export declare const SPORT_TYPE_HOCKEY = "HOCKEY";
8
8
  export declare const SPORT_TYPE_BASEBALL = "BASEBALL";
9
+ export declare const SPORT_TYPE_SOFTBALL = 'SOFTBALL';
9
10
  export declare const COURT_TYPE_BIG3 = "BIG3";
10
11
  export declare const COURT_TYPE_FIBA = "FIBA";
11
12
  export declare const COURT_TYPE_NBA = "NBA";
@@ -29,6 +30,8 @@ export declare const COURT_TYPE_SOCCER_U19 = "SOCCER_U19";
29
30
  export declare const COURT_TYPE_HOCKEY_NHL = "HOCKEY_NHL";
30
31
  export declare const COURT_TYPE_HOCKEY_INTERNATIONAL = "HOCKEY_INTERNATIONAL";
31
32
  export declare const COURT_TYPE_BASEBALL_HIGH_SCHOOL = "BASEBALL_HIGH_SCHOOL";
33
+ export declare const COURT_TYPE_SOFTBALL_FP_COLLEGE = 'SOFTBALL_FP_COLLEGE';
34
+ export declare const COURT_TYPE_SOFTBALL_FP_HIGH_SCHOOL = 'SOFTBALL_FP_HS';
32
35
  export declare const SHAPE_TYPE_CIRCLE = "CIRCLE";
33
36
  export declare const SHAPE_TYPE_SQUARE = "SQUARE";
34
37
  export declare const SHAPE_TYPE_TRIANGLE = "TRIANGLE";
@@ -1,139 +1,140 @@
1
- export type PlayerPosition = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11';
2
- export type DefenderPosition = 'x1' | 'x2' | 'x3' | 'x4' | 'x5' | 'x6' | 'x7' | 'x8' | 'x9' | 'x10' | 'x11';
3
- export type CoachPosition = 'C';
4
- export type Position = PlayerPosition | DefenderPosition | CoachPosition;
5
- export type LineType = 'PASS' | 'CUT' | 'SCREEN' | 'DRIBBLE' | 'HANDOFF' | 'SHOT';
6
- export type LineShapeType = 'LINE.CUT' | 'LINE.SCREEN' | 'LINE.DRIBBLE' | 'LINE.PASS' | 'LINE.HANDOFF';
7
- export type ShapeType = 'CIRCLE' | 'SQUARE' | 'TRIANGLE' | 'FOV' | 'XMARK' | 'STRAIGHT' | 'CONE' | LineShapeType;
8
- export type SportType = 'FOOTBALL' | 'BASKETBALL' | 'VOLLEYBALL' | 'LACROSSE' | 'LACROSSE_BOX' | 'SOCCER' | 'HOCKEY' | 'BASEBALL';
9
- export type CourtTypeSportBasketball = 'BIG3' | 'NBA' | 'WNBA' | 'FIBA' | 'NCAAM' | 'NCAAW' | 'US_HIGH_SCHOOL' | 'US_JUNIOR_HIGH';
10
- export type CourtTypeSportVolleyball = 'VOLLEYBALL_INDOOR';
11
- export type CourtTypeSportSoccer = 'SOCCER_FIFA' | 'SOCCER_NCAA' | 'SOCCER_NFHS' | 'SOCCER_U10' | 'SOCCER_U12' | 'SOCCER_U19';
12
- export type CourtTypeSportHockey = 'HOCKEY_NHL' | 'HOCKEY_INTERNATIONAL';
13
- export type CourtTypeSportBaseball = 'BASEBALL_HIGH_SCHOOL';
14
- export type CourtTypeSportLacrosse = 'LACROSSE_US_M' | 'LACROSSE_US_W';
15
- export type CourtTypeSportLacrosseBox = 'LACROSSE_BOX_US';
16
- export type CourtTypeSportFootball = 'FOOTBALL_HIGH_SCHOOL';
17
- export type CourtTypeSportFootballLegacy = 'FOOTBALL';
18
- export type CourtType = CourtTypeSportBasketball | CourtTypeSportVolleyball | CourtTypeSportLacrosse | CourtTypeSportLacrosseBox | CourtTypeSportSoccer | CourtTypeSportHockey | CourtTypeSportBaseball | CourtTypeSportFootball | CourtTypeSportFootballLegacy;
19
- export type ShapeControlPoints = [CourtPoint, CourtPoint] | [CourtPoint, CourtPoint, CourtPoint] | [CourtPoint, CourtPoint, CourtPoint, CourtPoint];
20
- export type NoteDisplayModes = ['onCourt'] | ['playNote'] | ['onCourt', 'playNote'];
21
- export interface SportConstants {
22
- PLAYER_TOKEN_RADIUS: number;
23
- PLAYER_TOKEN_SCALE: number;
24
- }
25
- export interface CourtTypeConstants {
26
- COURT_RECT_WIDTH: number;
27
- COURT_RECT_HEIGHT: number;
28
- }
29
- export interface CourtPoint {
30
- x: number;
31
- y: number;
32
- }
33
- export interface CourtSize {
34
- height: number;
35
- width: number;
36
- }
37
- export interface Scale {
38
- x: number;
39
- y: number;
40
- }
41
- export interface LinePart {
42
- controlPoints: [CourtPoint, CourtPoint] | [CourtPoint, CourtPoint, CourtPoint] | [CourtPoint, CourtPoint, CourtPoint, CourtPoint];
43
- }
44
- export interface Color {
45
- red: number;
46
- green: number;
47
- blue: number;
48
- alpha: number;
49
- }
50
- export interface CourtRect {
51
- origin: CourtPoint;
52
- size: CourtSize;
53
- }
54
- export interface Court {
55
- type: CourtType;
56
- courtRect: CourtRect;
57
- }
58
- export type PlayerAnimationType = 'POSITION';
59
- export interface Animation {
60
- id: string;
61
- keyTimes: number[];
62
- }
63
- export interface PlayerAnimation extends Animation {
64
- type: PlayerAnimationType;
65
- lineParts: LinePart[];
66
- }
67
- export interface Player {
68
- id: string;
69
- possession: boolean;
70
- color: Color;
71
- position: Position;
72
- location: CourtPoint;
73
- textOverride?: string;
74
- animations: PlayerAnimation[];
75
- }
76
- export type LineAnimationType = 'LINESTROKE';
77
- export interface LineAnimation {
78
- id: string;
79
- type: LineAnimationType;
80
- keyTimes: number[];
81
- strokeStartValues: [number, number, number];
82
- }
83
- export interface Line {
84
- id: string;
85
- type: LineType;
86
- phase: number;
87
- playerPositionOrigin: Position;
88
- playerPositionTerminus: Position | null;
89
- playerLineSequence: number;
90
- lineParts: LinePart[];
91
- color: Color;
92
- hideLineTip?: boolean;
93
- animations: LineAnimation[];
94
- }
95
- export interface Shape {
96
- id: string;
97
- type: ShapeType;
98
- location: CourtPoint;
99
- color: Color;
100
- scale: Scale;
101
- angle?: number;
102
- showBorder?: boolean;
103
- linePart?: LinePart;
104
- animations?: Animation[];
105
- hideForStatic?: boolean;
106
- }
107
- export interface Note {
108
- id: string;
109
- location: CourtPoint;
110
- displayModes: NoteDisplayModes;
111
- text: string;
112
- animations?: Animation[];
113
- font: NoteFont;
114
- color: Color;
115
- showBorder: boolean;
116
- hideForStatic?: boolean;
117
- }
118
- export interface NoteFont {
119
- bold: boolean;
120
- italic: boolean;
121
- underline: boolean;
122
- strikethrough: boolean;
123
- fontSize: number;
124
- }
125
- export interface PlayConstructData {
126
- id?: string;
127
- lastUpdtTS?: string;
128
- name: string;
129
- playData: PlayData;
130
- }
131
- export interface PlayData {
132
- animationDuration: number;
133
- sport: SportType;
134
- court: Court;
135
- players: Player[];
136
- lines: Line[];
137
- shapes?: Shape[];
138
- notes?: Note[];
139
- }
1
+ export type PlayerPosition = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11';
2
+ export type DefenderPosition = 'x1' | 'x2' | 'x3' | 'x4' | 'x5' | 'x6' | 'x7' | 'x8' | 'x9' | 'x10' | 'x11';
3
+ export type CoachPosition = 'C';
4
+ export type Position = PlayerPosition | DefenderPosition | CoachPosition;
5
+ export type LineType = 'PASS' | 'CUT' | 'SCREEN' | 'DRIBBLE' | 'HANDOFF' | 'SHOT';
6
+ export type LineShapeType = 'LINE.CUT' | 'LINE.SCREEN' | 'LINE.DRIBBLE' | 'LINE.PASS' | 'LINE.HANDOFF';
7
+ export type ShapeType = 'CIRCLE' | 'SQUARE' | 'TRIANGLE' | 'FOV' | 'XMARK' | 'STRAIGHT' | 'CONE' | LineShapeType;
8
+ export type SportType = 'FOOTBALL' | 'BASKETBALL' | 'VOLLEYBALL' | 'LACROSSE' | 'LACROSSE_BOX' | 'SOCCER' | 'HOCKEY' | 'BASEBALL' | 'SOFTBALL';
9
+ export type CourtTypeSportBasketball = 'BIG3' | 'NBA' | 'WNBA' | 'FIBA' | 'NCAAM' | 'NCAAW' | 'US_HIGH_SCHOOL' | 'US_JUNIOR_HIGH';
10
+ export type CourtTypeSportVolleyball = 'VOLLEYBALL_INDOOR';
11
+ export type CourtTypeSportSoccer = 'SOCCER_FIFA' | 'SOCCER_NCAA' | 'SOCCER_NFHS' | 'SOCCER_U10' | 'SOCCER_U12' | 'SOCCER_U19';
12
+ export type CourtTypeSportHockey = 'HOCKEY_NHL' | 'HOCKEY_INTERNATIONAL';
13
+ export type CourtTypeSportBaseball = 'BASEBALL_HIGH_SCHOOL';
14
+ export type CourtTypeSportLacrosse = 'LACROSSE_US_M' | 'LACROSSE_US_W';
15
+ export type CourtTypeSportLacrosseBox = 'LACROSSE_BOX_US';
16
+ export type CourtTypeSportSoftball = 'SOFTBALL_FP_COLLEGE' | 'SOFTBALL_FP_HS';
17
+ export type CourtTypeSportFootball = 'FOOTBALL_HIGH_SCHOOL';
18
+ export type CourtTypeSportFootballLegacy = 'FOOTBALL';
19
+ export type CourtType = CourtTypeSportBasketball | CourtTypeSportVolleyball | CourtTypeSportLacrosse | CourtTypeSportLacrosseBox | CourtTypeSportSoccer | CourtTypeSportHockey | CourtTypeSportBaseball | CourtTypeSportSoftball | CourtTypeSportFootball | CourtTypeSportFootballLegacy;
20
+ export type ShapeControlPoints = [CourtPoint, CourtPoint] | [CourtPoint, CourtPoint, CourtPoint] | [CourtPoint, CourtPoint, CourtPoint, CourtPoint];
21
+ export type NoteDisplayModes = ['onCourt'] | ['playNote'] | ['onCourt', 'playNote'];
22
+ export interface SportConstants {
23
+ PLAYER_TOKEN_RADIUS: number;
24
+ PLAYER_TOKEN_SCALE: number;
25
+ }
26
+ export interface CourtTypeConstants {
27
+ COURT_RECT_WIDTH: number;
28
+ COURT_RECT_HEIGHT: number;
29
+ }
30
+ export interface CourtPoint {
31
+ x: number;
32
+ y: number;
33
+ }
34
+ export interface CourtSize {
35
+ height: number;
36
+ width: number;
37
+ }
38
+ export interface Scale {
39
+ x: number;
40
+ y: number;
41
+ }
42
+ export interface LinePart {
43
+ controlPoints: [CourtPoint, CourtPoint] | [CourtPoint, CourtPoint, CourtPoint] | [CourtPoint, CourtPoint, CourtPoint, CourtPoint];
44
+ }
45
+ export interface Color {
46
+ red: number;
47
+ green: number;
48
+ blue: number;
49
+ alpha: number;
50
+ }
51
+ export interface CourtRect {
52
+ origin: CourtPoint;
53
+ size: CourtSize;
54
+ }
55
+ export interface Court {
56
+ type: CourtType;
57
+ courtRect: CourtRect;
58
+ }
59
+ export type PlayerAnimationType = 'POSITION';
60
+ export interface Animation {
61
+ id: string;
62
+ keyTimes: number[];
63
+ }
64
+ export interface PlayerAnimation extends Animation {
65
+ type: PlayerAnimationType;
66
+ lineParts: LinePart[];
67
+ }
68
+ export interface Player {
69
+ id: string;
70
+ possession: boolean;
71
+ color: Color;
72
+ position: Position;
73
+ location: CourtPoint;
74
+ textOverride?: string;
75
+ animations: PlayerAnimation[];
76
+ }
77
+ export type LineAnimationType = 'LINESTROKE';
78
+ export interface LineAnimation {
79
+ id: string;
80
+ type: LineAnimationType;
81
+ keyTimes: number[];
82
+ strokeStartValues: [number, number, number];
83
+ }
84
+ export interface Line {
85
+ id: string;
86
+ type: LineType;
87
+ phase: number;
88
+ playerPositionOrigin: Position;
89
+ playerPositionTerminus: Position | null;
90
+ playerLineSequence: number;
91
+ lineParts: LinePart[];
92
+ color: Color;
93
+ hideLineTip?: boolean;
94
+ animations: LineAnimation[];
95
+ }
96
+ export interface Shape {
97
+ id: string;
98
+ type: ShapeType;
99
+ location: CourtPoint;
100
+ color: Color;
101
+ scale: Scale;
102
+ angle?: number;
103
+ showBorder?: boolean;
104
+ linePart?: LinePart;
105
+ animations?: Animation[];
106
+ hideForStatic?: boolean;
107
+ }
108
+ export interface Note {
109
+ id: string;
110
+ location: CourtPoint;
111
+ displayModes: NoteDisplayModes;
112
+ text: string;
113
+ animations?: Animation[];
114
+ font: NoteFont;
115
+ color: Color;
116
+ showBorder: boolean;
117
+ hideForStatic?: boolean;
118
+ }
119
+ export interface NoteFont {
120
+ bold: boolean;
121
+ italic: boolean;
122
+ underline: boolean;
123
+ strikethrough: boolean;
124
+ fontSize: number;
125
+ }
126
+ export interface PlayConstructData {
127
+ id?: string;
128
+ lastUpdtTS?: string;
129
+ name: string;
130
+ playData: PlayData;
131
+ }
132
+ export interface PlayData {
133
+ animationDuration: number;
134
+ sport: SportType;
135
+ court: Court;
136
+ players: Player[];
137
+ lines: Line[];
138
+ shapes?: Shape[];
139
+ notes?: Note[];
140
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luceosports/play-rendering",
3
- "version": "2.3.1",
3
+ "version": "2.4.1",
4
4
  "main": "dist/play-rendering.js",
5
5
  "types": "dist/play-rendering.d.ts",
6
6
  "scripts": {
package/src/constants.ts CHANGED
@@ -6,6 +6,7 @@ export const SPORT_TYPE_LACROSSE_BOX = 'LACROSSE_BOX';
6
6
  export const SPORT_TYPE_SOCCER = 'SOCCER';
7
7
  export const SPORT_TYPE_HOCKEY = 'HOCKEY';
8
8
  export const SPORT_TYPE_BASEBALL = 'BASEBALL';
9
+ export const SPORT_TYPE_SOFTBALL = 'SOFTBALL';
9
10
 
10
11
  export const COURT_TYPE_BIG3 = 'BIG3';
11
12
  export const COURT_TYPE_FIBA = 'FIBA';
@@ -38,6 +39,9 @@ export const COURT_TYPE_HOCKEY_INTERNATIONAL = 'HOCKEY_INTERNATIONAL';
38
39
 
39
40
  export const COURT_TYPE_BASEBALL_HIGH_SCHOOL = 'BASEBALL_HIGH_SCHOOL';
40
41
 
42
+ export const COURT_TYPE_SOFTBALL_FP_COLLEGE = 'SOFTBALL_FP_COLLEGE';
43
+ export const COURT_TYPE_SOFTBALL_FP_HIGH_SCHOOL = 'SOFTBALL_FP_HS';
44
+
41
45
  export const SHAPE_TYPE_CIRCLE = 'CIRCLE';
42
46
  export const SHAPE_TYPE_SQUARE = 'SQUARE';
43
47
  export const SHAPE_TYPE_TRIANGLE = 'TRIANGLE';
@@ -30,7 +30,10 @@ import {
30
30
  SPORT_TYPE_LACROSSE,
31
31
  SPORT_TYPE_SOCCER,
32
32
  SPORT_TYPE_VOLLEYBALL,
33
- SPORT_TYPE_LACROSSE_BOX
33
+ SPORT_TYPE_LACROSSE_BOX,
34
+ SPORT_TYPE_SOFTBALL,
35
+ COURT_TYPE_SOFTBALL_FP_COLLEGE,
36
+ COURT_TYPE_SOFTBALL_FP_HIGH_SCHOOL
34
37
  } from '../../constants';
35
38
 
36
39
  export type SportConstants = {
@@ -53,6 +56,13 @@ import * as BaseballConstants from './layers/BASEBALL/constants';
53
56
  import * as BaseballHighSchoolLayers from './layers/BASEBALL/courtTypes/BASEBALL_HIGH_SCHOOL/layers';
54
57
  import * as BaseballHighSchoolConstants from './layers/BASEBALL/courtTypes/BASEBALL_HIGH_SCHOOL/constants';
55
58
 
59
+ import * as SoftballLayers from './layers/SOFTBALL/layers';
60
+ import * as SoftballConstants from './layers/SOFTBALL/constants';
61
+ import * as SoftballFPCollageLayers from './layers/SOFTBALL/courtTypes/SOFTBALL_FP_COLLEGE/layers';
62
+ import * as SoftballFPCollageConstants from './layers/SOFTBALL/courtTypes/SOFTBALL_FP_COLLEGE/constants';
63
+ import * as SoftballFPHSLayers from './layers/SOFTBALL/courtTypes/SOFTBALL_FP_HIGH_SCHOOL/layers';
64
+ import * as SoftballFPHSConstants from './layers/SOFTBALL/courtTypes/SOFTBALL_FP_HIGH_SCHOOL/constants';
65
+
56
66
  import * as BasketballLayers from './layers/BASKETBALL/layers';
57
67
  import * as BasketballConstants from './layers/BASKETBALL/constants';
58
68
  import * as BasketballBig3Layers from './layers/BASKETBALL/courtTypes/BIG3/layers';
@@ -114,6 +124,7 @@ import * as VolleyballIndoorConstants from './layers/VOLLEYBALL/courtTypes/VOLLE
114
124
 
115
125
  const sportLayers: Record<SportType, Record<string, typeof InternalCourtLayer>> = {
116
126
  [SPORT_TYPE_BASEBALL]: BaseballLayers,
127
+ [SPORT_TYPE_SOFTBALL]: SoftballLayers,
117
128
  [SPORT_TYPE_BASKETBALL]: BasketballLayers,
118
129
  [SPORT_TYPE_FOOTBALL]: FootballLayers,
119
130
  [SPORT_TYPE_HOCKEY]: HockeyLayers,
@@ -127,6 +138,10 @@ const courtTypeLayers: Record<SportType, Partial<Record<CourtType, Record<string
127
138
  [SPORT_TYPE_BASEBALL]: {
128
139
  [COURT_TYPE_BASEBALL_HIGH_SCHOOL]: BaseballHighSchoolLayers
129
140
  },
141
+ [SPORT_TYPE_SOFTBALL]: {
142
+ [COURT_TYPE_SOFTBALL_FP_COLLEGE]: SoftballFPCollageLayers,
143
+ [COURT_TYPE_SOFTBALL_FP_HIGH_SCHOOL]: SoftballFPHSLayers
144
+ },
130
145
  [SPORT_TYPE_BASKETBALL]: {
131
146
  [COURT_TYPE_BIG3]: BasketballBig3Layers,
132
147
  [COURT_TYPE_FIBA]: BasketballFibaLayers,
@@ -160,6 +175,7 @@ const courtTypeLayers: Record<SportType, Partial<Record<CourtType, Record<string
160
175
 
161
176
  const sportConstants: Record<SportType, SportConstants> = {
162
177
  [SPORT_TYPE_BASEBALL]: BaseballConstants,
178
+ [SPORT_TYPE_SOFTBALL]: SoftballConstants,
163
179
  [SPORT_TYPE_BASKETBALL]: BasketballConstants,
164
180
  [SPORT_TYPE_FOOTBALL]: FootballConstants,
165
181
  [SPORT_TYPE_HOCKEY]: HockeyConstants,
@@ -170,6 +186,8 @@ const sportConstants: Record<SportType, SportConstants> = {
170
186
  };
171
187
  const courtTypeConstants: Record<CourtType, CourtTypeConstants> = {
172
188
  [COURT_TYPE_BASEBALL_HIGH_SCHOOL]: BaseballHighSchoolConstants,
189
+ [COURT_TYPE_SOFTBALL_FP_COLLEGE]: SoftballFPCollageConstants,
190
+ [COURT_TYPE_SOFTBALL_FP_HIGH_SCHOOL]: SoftballFPHSConstants,
173
191
  [COURT_TYPE_BIG3]: BasketballBig3Constants,
174
192
  [COURT_TYPE_FIBA]: BasketballFibaConstants,
175
193
  [COURT_TYPE_NBA]: BasketballNbaConstants,
@@ -195,6 +213,7 @@ const courtTypeConstants: Record<CourtType, CourtTypeConstants> = {
195
213
  };
196
214
  const sportCourtTypeMap: Record<SportType, { courtTypes: CourtType[] }> = {
197
215
  [SPORT_TYPE_BASEBALL]: { courtTypes: [COURT_TYPE_BASEBALL_HIGH_SCHOOL] },
216
+ [SPORT_TYPE_SOFTBALL]: { courtTypes: [COURT_TYPE_SOFTBALL_FP_COLLEGE, COURT_TYPE_SOFTBALL_FP_HIGH_SCHOOL] },
198
217
  [SPORT_TYPE_BASKETBALL]: {
199
218
  courtTypes: [
200
219
  COURT_TYPE_BIG3,
@@ -1,13 +1,49 @@
1
1
  import InternalCourtLayer from '../../../../../base/InternalCourtLayer';
2
2
 
3
3
  const REFEREE_CREASE_RADIUS = 10;
4
+ const REFEREE_CREASE_BOX_LENGTH = 24;
5
+ const REFEREE_CREASE_BOX_WIDTH = 5;
4
6
 
5
7
  export default class RefereeCreaseLayer extends InternalCourtLayer {
6
8
  drawLogic() {
7
9
  this.ctx.lineWidth = this.courtTypeConstants.COURT_LINE_WIDTH * 2;
8
10
 
11
+ // 1. Draw referee crease half arc
9
12
  this.ctx.beginPath();
10
13
  this.ctx.arc(0, this.courtCenter.y, REFEREE_CREASE_RADIUS, Math.PI / 2, -Math.PI / 2, true);
11
14
  this.ctx.stroke();
15
+
16
+ // 2. Draw referee crease half arc extended curves
17
+ this.ctx.beginPath();
18
+ this.ctx.moveTo(0, this.courtCenter.y - REFEREE_CREASE_RADIUS);
19
+ this.ctx.bezierCurveTo(
20
+ 0,
21
+ this.courtCenter.y - REFEREE_CREASE_RADIUS,
22
+ 0 - REFEREE_CREASE_BOX_WIDTH / 2,
23
+ this.courtCenter.y - REFEREE_CREASE_RADIUS,
24
+ 0 - REFEREE_CREASE_BOX_WIDTH,
25
+ this.courtCenter.y - REFEREE_CREASE_RADIUS
26
+ );
27
+ this.ctx.stroke();
28
+
29
+ this.ctx.beginPath();
30
+ this.ctx.moveTo(0, this.courtCenter.y + REFEREE_CREASE_RADIUS);
31
+ this.ctx.bezierCurveTo(
32
+ 0,
33
+ this.courtCenter.y + REFEREE_CREASE_RADIUS,
34
+ 0 - REFEREE_CREASE_BOX_WIDTH / 2,
35
+ this.courtCenter.y + REFEREE_CREASE_RADIUS,
36
+ 0 - REFEREE_CREASE_BOX_WIDTH,
37
+ this.courtCenter.y + REFEREE_CREASE_RADIUS
38
+ );
39
+ this.ctx.stroke();
40
+
41
+ // 3. Draw scorekeepers bench
42
+ this.ctx.beginPath();
43
+ this.ctx.moveTo(0, this.courtCenter.y - REFEREE_CREASE_BOX_LENGTH / 2);
44
+ this.ctx.lineTo(-REFEREE_CREASE_BOX_WIDTH, this.courtCenter.y - REFEREE_CREASE_BOX_LENGTH / 2);
45
+ this.ctx.lineTo(-REFEREE_CREASE_BOX_WIDTH, this.courtCenter.y + REFEREE_CREASE_BOX_LENGTH / 2);
46
+ this.ctx.lineTo(0, this.courtCenter.y + REFEREE_CREASE_BOX_LENGTH / 2);
47
+ this.ctx.stroke();
12
48
  }
13
49
  }
@@ -1,5 +1,8 @@
1
1
  import InternalCourtLayer from '../../../../../base/InternalCourtLayer';
2
2
 
3
+ const PLAYERS_BENCH_LENGTH = 24;
4
+ const PLAYERS_BENCH_WIDTH = 5;
5
+
3
6
  export default class RestrainingLineLayer extends InternalCourtLayer {
4
7
  reflection() {
5
8
  return true;
@@ -12,10 +15,27 @@ export default class RestrainingLineLayer extends InternalCourtLayer {
12
15
  y: this.courtCenter.y - this.courtTypeConstants.RESTRAINING_LINE_OFFSET_Y
13
16
  };
14
17
 
18
+ // 1. Draw restraining line
15
19
  this.ctx.beginPath();
16
20
  this.ctx.lineWidth = this.courtTypeConstants.COURT_LINE_WIDTH * 2;
17
21
  this.ctx.moveTo(courtOrigin.x, courtOrigin.y);
18
22
  this.ctx.lineTo(courtTerminus.x, courtTerminus.y);
19
23
  this.ctx.stroke();
24
+
25
+ // 2. Draw players bench
26
+ const playersBenchCenterY = this.courtCenter.y - this.courtTypeConstants.RESTRAINING_LINE_OFFSET_Y / 2;
27
+
28
+ this.ctx.beginPath();
29
+ this.ctx.moveTo(this.courtTypeConstants.COURT_RECT_WIDTH, playersBenchCenterY - PLAYERS_BENCH_LENGTH / 2);
30
+ this.ctx.lineTo(
31
+ this.courtTypeConstants.COURT_RECT_WIDTH + PLAYERS_BENCH_WIDTH,
32
+ playersBenchCenterY - PLAYERS_BENCH_LENGTH / 2
33
+ );
34
+ this.ctx.lineTo(
35
+ this.courtTypeConstants.COURT_RECT_WIDTH + PLAYERS_BENCH_WIDTH,
36
+ playersBenchCenterY + PLAYERS_BENCH_LENGTH / 2
37
+ );
38
+ this.ctx.lineTo(this.courtTypeConstants.COURT_RECT_WIDTH, playersBenchCenterY + PLAYERS_BENCH_LENGTH / 2);
39
+ this.ctx.stroke();
20
40
  }
21
41
  }
@@ -1,14 +1,37 @@
1
1
  import InternalCourtLayer from '../../../base/InternalCourtLayer';
2
2
 
3
+ const EXCHANGE_AREA_WIDTH = 5;
4
+
3
5
  export default class CenterLineLayer extends InternalCourtLayer {
4
6
  drawLogic() {
5
7
  const courtOrigin = { x: 0.0, y: this.courtCenter.y };
6
8
  const courtTerminus = { x: this.courtTypeConstants.COURT_RECT_WIDTH, y: this.courtCenter.y };
7
9
 
10
+ // 1. Draw center line
8
11
  this.ctx.beginPath();
9
12
  this.ctx.lineWidth = this.courtTypeConstants.COURT_LINE_WIDTH * 2;
10
13
  this.ctx.moveTo(courtOrigin.x, courtOrigin.y);
11
14
  this.ctx.lineTo(courtTerminus.x, courtTerminus.y);
12
15
  this.ctx.stroke();
16
+
17
+ // 2. Draw exchange area
18
+ this.ctx.beginPath();
19
+ this.ctx.moveTo(
20
+ this.courtTypeConstants.COURT_RECT_WIDTH,
21
+ this.courtCenter.y - this.courtTypeConstants.RESTRAINING_LINE_OFFSET_Y + 5
22
+ );
23
+ this.ctx.lineTo(
24
+ this.courtTypeConstants.COURT_RECT_WIDTH - EXCHANGE_AREA_WIDTH,
25
+ this.courtCenter.y - this.courtTypeConstants.RESTRAINING_LINE_OFFSET_Y + 5
26
+ );
27
+ this.ctx.lineTo(
28
+ this.courtTypeConstants.COURT_RECT_WIDTH - EXCHANGE_AREA_WIDTH,
29
+ this.courtCenter.y + this.courtTypeConstants.RESTRAINING_LINE_OFFSET_Y - 5
30
+ );
31
+ this.ctx.lineTo(
32
+ this.courtTypeConstants.COURT_RECT_WIDTH,
33
+ this.courtCenter.y + this.courtTypeConstants.RESTRAINING_LINE_OFFSET_Y - 5
34
+ );
35
+ this.ctx.stroke();
13
36
  }
14
37
  }
@@ -0,0 +1,5 @@
1
+ export const COURT_LINE_WIDTH = 0.1667;
2
+ export const PLAYER_TOKEN_RADIUS = 1.5;
3
+ export const PLAYER_TOKEN_SCALE = 2.4;
4
+ export const LINE_WIDTH = 0.55;
5
+ export const LINE_MASKING = false;
@@ -0,0 +1,36 @@
1
+ export const COURT_RECT_WIDTH = 280;
2
+ export const COURT_RECT_HEIGHT = 260;
3
+ export const COURT_DIRT_COLOR = '#C49463';
4
+ export const PITCHING_MOUND_COLOR = '#E4CCB7';
5
+
6
+ export const HOME_PLATE_APEX_TO_PITCHERS_PLATE_FRONT = 43;
7
+ export const HOME_PLATE_APEX_TO_SECOND_BASE_APEX = 127.28125;
8
+ export const HOME_PLATE_APEX_TO_BACKSTOP = 25;
9
+ export const HOME_PLATE_SIDE = 1.41667;
10
+ export const HOME_PLATE_CIRCLE_DIA = 26;
11
+
12
+ export const HOME_PLATE_SIDE_TO_BATTERS_BOX = 0.5;
13
+ export const BATTERS_BOX_WIDTH = 4;
14
+ export const BATTERS_BOX_HEIGHT = 6;
15
+ export const BATTERS_BOX_TO_CATCHERS_BACK_LINE = 5;
16
+
17
+ export const CATCHERS_BACK_LINE_LENGTH = 3.58333;
18
+ export const ON_DECK_CIRCLE_DIA = 5;
19
+ export const ON_DECK_CIRCLE_DISTANCE_FROM_CENTER = 37;
20
+
21
+ export const COACH_BOX_TO_BASE_LINE = 8;
22
+ export const COACH_BOX_WIDTH = 15;
23
+ export const COACH_BOX_HEIGHT = 3;
24
+
25
+ export const PITCHERS_PLATE_WIDTH = 5;
26
+ export const PITCHERS_PLATE_HEIGHT = 1;
27
+ export const PITCHERS_PLATE_TO_PITCHING_MOUND_CENTER = 0;
28
+ export const PITCHING_MOUND_DIA = 16;
29
+
30
+ export const PITCHERS_PLATE_GRASS_LINE_RAD = 60;
31
+
32
+ export const HOME_RUN_FENCE_CENTER_DISTANCE = 220;
33
+ export const FOUL_LINE_LENGTH = 190;
34
+ export const BASE_LINE_LENGTH = 60;
35
+ export const BASE_SQUARE_SIDE_LENGTH = 2.5;
36
+ export const BASE_DIRT_RAD = 13;
@@ -0,0 +1,96 @@
1
+ import InternalCourtLayer from '../../../../../base/InternalCourtLayer';
2
+
3
+ import {
4
+ BASE_DIRT_RAD,
5
+ BASE_LINE_LENGTH,
6
+ COURT_DIRT_COLOR,
7
+ HOME_PLATE_APEX_TO_BACKSTOP,
8
+ HOME_PLATE_APEX_TO_PITCHERS_PLATE_FRONT,
9
+ HOME_PLATE_CIRCLE_DIA,
10
+ PITCHERS_PLATE_GRASS_LINE_RAD,
11
+ PITCHERS_PLATE_TO_PITCHING_MOUND_CENTER,
12
+ PITCHING_MOUND_COLOR,
13
+ PITCHING_MOUND_DIA
14
+ } from '../constants';
15
+ import { CourtPoint } from '../../../../../../../types';
16
+
17
+ export default class ADirtLayer extends InternalCourtLayer {
18
+ original() {
19
+ return false;
20
+ }
21
+
22
+ reflection() {
23
+ return true;
24
+ }
25
+
26
+ drawLogic() {
27
+ const homePlateApex = { x: this.courtCenter.x, y: HOME_PLATE_APEX_TO_BACKSTOP };
28
+ const pitchersPlateFrontCenter = {
29
+ x: this.courtCenter.x,
30
+ y: HOME_PLATE_APEX_TO_BACKSTOP + HOME_PLATE_APEX_TO_PITCHERS_PLATE_FRONT
31
+ };
32
+
33
+ const style = this.options.lineColor === 'transparent' ? 'transparent' : COURT_DIRT_COLOR;
34
+ this.ctx.fillStyle = style;
35
+ this.ctx.strokeStyle = style;
36
+
37
+ // 1. Gras line
38
+ const arcStartAngle = Math.PI / 15;
39
+ const arcEndAngle = Math.PI - Math.PI / 15;
40
+
41
+ this.ctx.save();
42
+ this.ctx.beginPath();
43
+ this.ctx.arc(
44
+ pitchersPlateFrontCenter.x,
45
+ pitchersPlateFrontCenter.y,
46
+ PITCHERS_PLATE_GRASS_LINE_RAD,
47
+ arcStartAngle,
48
+ arcEndAngle,
49
+ false
50
+ );
51
+
52
+ const arcEdgePointLeft = getArcPointForAngle(pitchersPlateFrontCenter, PITCHERS_PLATE_GRASS_LINE_RAD, arcEndAngle);
53
+ const arcEdgePointRight = getArcPointForAngle(
54
+ pitchersPlateFrontCenter,
55
+ PITCHERS_PLATE_GRASS_LINE_RAD,
56
+ arcStartAngle
57
+ );
58
+
59
+ this.ctx.moveTo(arcEdgePointLeft.x, arcEdgePointLeft.y);
60
+ this.ctx.lineTo(homePlateApex.x, homePlateApex.y - Math.sqrt(3 * 3 + 3 * 3));
61
+ this.ctx.lineTo(arcEdgePointRight.x, arcEdgePointRight.y);
62
+ this.ctx.lineTo(arcEdgePointLeft.x, arcEdgePointLeft.y);
63
+
64
+ this.ctx.fill();
65
+ this.ctx.restore();
66
+
67
+ // 2. Pitching mound
68
+ this.ctx.save();
69
+ this.ctx.strokeStyle = this.options.lineColor === 'transparent' ? 'transparent' : '#FFFFFF';
70
+ this.ctx.fillStyle = this.options.lineColor === 'transparent' ? 'transparent' : PITCHING_MOUND_COLOR;
71
+ this.ctx.beginPath();
72
+ this.ctx.arc(
73
+ pitchersPlateFrontCenter.x,
74
+ pitchersPlateFrontCenter.y - PITCHERS_PLATE_TO_PITCHING_MOUND_CENTER,
75
+ PITCHING_MOUND_DIA / 2,
76
+ 0,
77
+ Math.PI * 2,
78
+ true
79
+ );
80
+ this.ctx.fill();
81
+ this.ctx.stroke();
82
+ this.ctx.restore();
83
+
84
+ // 3. Home plate circle
85
+ this.ctx.save();
86
+ this.ctx.beginPath();
87
+ this.ctx.arc(homePlateApex.x, homePlateApex.y, HOME_PLATE_CIRCLE_DIA / 2, 0, Math.PI * 2, true);
88
+ this.ctx.stroke();
89
+ this.ctx.fill();
90
+ this.ctx.restore();
91
+ }
92
+ }
93
+
94
+ function getArcPointForAngle(c: CourtPoint, radius: number, angle: number) {
95
+ return { x: c.x + Math.cos(angle) * radius, y: c.y + Math.sin(angle) * radius };
96
+ }