@luceosports/play-rendering 2.3.1 → 2.4.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/types/index.d.ts +140 -139
- package/package.json +1 -1
- package/src/constants.ts +4 -0
- package/src/layers/court/index.ts +20 -1
- package/src/layers/court/layers/SOFTBALL/constants.ts +5 -0
- package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_COLLEGE/constants.ts +36 -0
- package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_COLLEGE/layers/ADirtLayer.ts +96 -0
- package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_COLLEGE/layers/BaseLineLayer.ts +99 -0
- package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_COLLEGE/layers/HomePlateLayer.ts +119 -0
- package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_COLLEGE/layers/PitchingMoundLayer.ts +39 -0
- package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_COLLEGE/layers/index.ts +6 -0
- package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_HIGH_SCHOOL/constants.ts +36 -0
- package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_HIGH_SCHOOL/layers/ADirtLayer.ts +96 -0
- package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_HIGH_SCHOOL/layers/BaseLineLayer.ts +99 -0
- package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_HIGH_SCHOOL/layers/HomePlateLayer.ts +119 -0
- package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_HIGH_SCHOOL/layers/PitchingMoundLayer.ts +39 -0
- package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_HIGH_SCHOOL/layers/index.ts +6 -0
- package/src/layers/court/layers/SOFTBALL/layers/BorderRectLayer.ts +10 -0
- package/src/layers/court/layers/SOFTBALL/layers/index.ts +3 -0
- package/src/models/PlayModel.ts +3 -1
- 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
|
|
17
|
-
export type
|
|
18
|
-
export type
|
|
19
|
-
export type
|
|
20
|
-
export type
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
export
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
export
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
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,
|
|
@@ -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
|
+
}
|
package/src/layers/court/layers/SOFTBALL/courtTypes/SOFTBALL_FP_COLLEGE/layers/BaseLineLayer.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import InternalCourtLayer from '../../../../../base/InternalCourtLayer';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
BASE_LINE_LENGTH,
|
|
5
|
+
BASE_SQUARE_SIDE_LENGTH,
|
|
6
|
+
FOUL_LINE_LENGTH,
|
|
7
|
+
HOME_PLATE_APEX_TO_BACKSTOP,
|
|
8
|
+
HOME_RUN_FENCE_CENTER_DISTANCE,
|
|
9
|
+
PITCHERS_PLATE_GRASS_LINE_RAD
|
|
10
|
+
} from '../constants';
|
|
11
|
+
|
|
12
|
+
export default class BaseLineLayer extends InternalCourtLayer {
|
|
13
|
+
original() {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
reflection() {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
drawLogic() {
|
|
22
|
+
const homePlateApex = { x: this.courtCenter.x, y: HOME_PLATE_APEX_TO_BACKSTOP };
|
|
23
|
+
|
|
24
|
+
this.ctx.lineWidth = this.courtTypeConstants.COURT_LINE_WIDTH * 3;
|
|
25
|
+
|
|
26
|
+
this.ctx.save();
|
|
27
|
+
this.ctx.translate(homePlateApex.x, homePlateApex.y);
|
|
28
|
+
this.ctx.rotate(Math.PI / 4);
|
|
29
|
+
|
|
30
|
+
this.ctx.beginPath();
|
|
31
|
+
this.ctx.moveTo(0, 0);
|
|
32
|
+
this.ctx.lineTo(BASE_LINE_LENGTH, 0);
|
|
33
|
+
this.ctx.stroke();
|
|
34
|
+
this.drawBaseSquare(BASE_LINE_LENGTH, 0);
|
|
35
|
+
|
|
36
|
+
// line between 1st & 2nd bases
|
|
37
|
+
// this.ctx.beginPath();
|
|
38
|
+
// this.ctx.moveTo(BASE_LINE_LENGTH, 0);
|
|
39
|
+
// this.ctx.lineTo(BASE_LINE_LENGTH, BASE_LINE_LENGTH);
|
|
40
|
+
// this.ctx.stroke();
|
|
41
|
+
this.drawBaseSquare(BASE_LINE_LENGTH + BASE_SQUARE_SIDE_LENGTH / 2, BASE_LINE_LENGTH - BASE_SQUARE_SIDE_LENGTH / 2);
|
|
42
|
+
|
|
43
|
+
// line between 2st & 3nd bases
|
|
44
|
+
// this.ctx.beginPath();
|
|
45
|
+
// this.ctx.moveTo(BASE_LINE_LENGTH, BASE_LINE_LENGTH);
|
|
46
|
+
// this.ctx.lineTo(0, BASE_LINE_LENGTH);
|
|
47
|
+
// this.ctx.stroke();
|
|
48
|
+
this.drawBaseSquare(BASE_SQUARE_SIDE_LENGTH, BASE_LINE_LENGTH - BASE_SQUARE_SIDE_LENGTH);
|
|
49
|
+
|
|
50
|
+
this.ctx.beginPath();
|
|
51
|
+
this.ctx.lineTo(0, 0);
|
|
52
|
+
this.ctx.stroke();
|
|
53
|
+
this.ctx.restore();
|
|
54
|
+
|
|
55
|
+
// Foul lines
|
|
56
|
+
[-1, 1].forEach(sideIndex => {
|
|
57
|
+
this.ctx.save();
|
|
58
|
+
this.ctx.translate(homePlateApex.x, homePlateApex.y);
|
|
59
|
+
this.ctx.rotate(sideIndex * (Math.PI / 4));
|
|
60
|
+
this.ctx.beginPath();
|
|
61
|
+
this.ctx.moveTo(0, 0);
|
|
62
|
+
this.ctx.lineTo(sideIndex * FOUL_LINE_LENGTH, 0);
|
|
63
|
+
this.ctx.stroke();
|
|
64
|
+
this.ctx.restore();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// Home run arc
|
|
68
|
+
const homeRunArcCenterOffsetY = 77;
|
|
69
|
+
const homeRunArcStartAngle = Math.PI / 7.8;
|
|
70
|
+
const homeRunArcEndAngle = Math.PI - Math.PI / 7.8;
|
|
71
|
+
this.ctx.save();
|
|
72
|
+
this.ctx.beginPath();
|
|
73
|
+
this.ctx.arc(
|
|
74
|
+
homePlateApex.x,
|
|
75
|
+
homePlateApex.y + homeRunArcCenterOffsetY,
|
|
76
|
+
HOME_RUN_FENCE_CENTER_DISTANCE - homeRunArcCenterOffsetY + 3,
|
|
77
|
+
homeRunArcStartAngle,
|
|
78
|
+
homeRunArcEndAngle,
|
|
79
|
+
false
|
|
80
|
+
);
|
|
81
|
+
this.ctx.stroke();
|
|
82
|
+
this.ctx.restore();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
drawBaseSquare(x: number, y: number) {
|
|
86
|
+
this.ctx.save();
|
|
87
|
+
this.ctx.lineCap = 'square';
|
|
88
|
+
this.ctx.beginPath();
|
|
89
|
+
this.ctx.translate(x, y);
|
|
90
|
+
this.ctx.moveTo(0, 0);
|
|
91
|
+
this.ctx.lineTo(0, BASE_SQUARE_SIDE_LENGTH);
|
|
92
|
+
this.ctx.lineTo(-BASE_SQUARE_SIDE_LENGTH, BASE_SQUARE_SIDE_LENGTH);
|
|
93
|
+
this.ctx.lineTo(-BASE_SQUARE_SIDE_LENGTH, 0);
|
|
94
|
+
this.ctx.lineTo(0, 0);
|
|
95
|
+
this.ctx.stroke();
|
|
96
|
+
this.ctx.fill();
|
|
97
|
+
this.ctx.restore();
|
|
98
|
+
}
|
|
99
|
+
}
|