@luceosports/play-rendering 2.0.5 → 2.0.7
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/.babelrc +1 -1
- package/dist/play-rendering.js +2 -2
- package/dist/play-rendering.js.map +1 -1
- package/dist/types/constants.d.ts +41 -41
- package/dist/types/helpers/common.d.ts +4 -4
- package/dist/types/layers/court/index.d.ts +18 -18
- package/dist/types/math/Bezier.d.ts +19 -19
- package/dist/types/math/LineDrawingMath.d.ts +8 -8
- package/dist/types/models/AnimationModel.d.ts +20 -20
- package/dist/types/models/FrameModel.d.ts +38 -38
- package/dist/types/models/LineModel.d.ts +21 -21
- package/dist/types/models/NoteModel.d.ts +16 -16
- package/dist/types/models/PlayerModel.d.ts +20 -20
- package/dist/types/models/ShapeModels/CircleShape.d.ts +8 -8
- package/dist/types/models/ShapeModels/ConeShape.d.ts +8 -8
- package/dist/types/models/ShapeModels/FovShape.d.ts +12 -12
- package/dist/types/models/ShapeModels/LineShape.d.ts +11 -11
- package/dist/types/models/ShapeModels/SquareShape.d.ts +8 -8
- package/dist/types/models/ShapeModels/StraightShape.d.ts +12 -12
- package/dist/types/models/ShapeModels/TriangleShape.d.ts +12 -12
- package/dist/types/models/ShapeModels/XmarkShape.d.ts +8 -8
- package/dist/types/models/ShapeModels/index.d.ts +14 -14
- package/dist/types/models/ShapeModels/line/CutLineShape.d.ts +3 -3
- package/dist/types/models/ShapeModels/line/DribbleLineShape.d.ts +3 -3
- package/dist/types/models/ShapeModels/line/HandoffLineShape.d.ts +3 -3
- package/dist/types/models/ShapeModels/line/PassLineShape.d.ts +3 -3
- package/dist/types/models/ShapeModels/line/ScreenLineShape.d.ts +3 -3
- package/dist/types/types/index.d.ts +137 -137
- package/package.json +2 -3
- package/src/layers/PlayerLayer.ts +3 -5
- package/src/layers/court/layers/BASEBALL/constants.ts +1 -1
- package/src/layers/court/layers/BASEBALL/courtTypes/BASEBALL_HIGH_SCHOOL/constants.ts +5 -4
- package/src/layers/court/layers/BASEBALL/courtTypes/BASEBALL_HIGH_SCHOOL/layers/BaseLineLayer.ts +36 -10
- package/src/layers/court/layers/BASEBALL/courtTypes/BASEBALL_HIGH_SCHOOL/layers/HomePlateLayer.ts +23 -7
- package/src/layers/court/layers/BASEBALL/courtTypes/BASEBALL_HIGH_SCHOOL/layers/index.ts +6 -6
- package/src/layers/court/layers/BASEBALL/layers/index.ts +3 -3
- package/src/layers/court/layers/FOOTBALL/layers/index.ts +8 -8
- package/src/layers/court/layers/HOCKEY/layers/index.ts +19 -19
- package/src/layers/court/layers/LACROSSE/layers/index.ts +4 -4
- package/src/layers/court/layers/SOCCER/courtTypes/SOCCER_NCAA/layers/index.ts +5 -5
- package/src/layers/court/layers/SOCCER/courtTypes/SOCCER_NFHS/layers/index.ts +4 -4
- package/src/layers/court/layers/SOCCER/courtTypes/SOCCER_U10/layers/index.ts +4 -4
- package/src/layers/court/layers/SOCCER/courtTypes/SOCCER_U12/layers/index.ts +3 -3
- package/src/layers/court/layers/SOCCER/layers/index.ts +19 -19
- package/src/layers/court/layers/VOLLEYBALL/layers/index.ts +6 -6
- package/src/layers/line/index.ts +8 -8
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import LineShape from '../LineShape';
|
|
2
|
-
export default class DribbleLineShape extends LineShape {
|
|
3
|
-
}
|
|
1
|
+
import LineShape from '../LineShape';
|
|
2
|
+
export default class DribbleLineShape extends LineShape {
|
|
3
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import LineShape from '../LineShape';
|
|
2
|
-
export default class HandoffLineShape extends LineShape {
|
|
3
|
-
}
|
|
1
|
+
import LineShape from '../LineShape';
|
|
2
|
+
export default class HandoffLineShape extends LineShape {
|
|
3
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import LineShape from '../LineShape';
|
|
2
|
-
export default class PassLineShape extends LineShape {
|
|
3
|
-
}
|
|
1
|
+
import LineShape from '../LineShape';
|
|
2
|
+
export default class PassLineShape extends LineShape {
|
|
3
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import LineShape from '../LineShape';
|
|
2
|
-
export default class ScreenLineShape extends LineShape {
|
|
3
|
-
}
|
|
1
|
+
import LineShape from '../LineShape';
|
|
2
|
+
export default class ScreenLineShape extends LineShape {
|
|
3
|
+
}
|
|
@@ -1,138 +1,138 @@
|
|
|
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' | '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 CourtTypeSportFootball = 'FOOTBALL_HIGH_SCHOOL';
|
|
16
|
-
export type CourtTypeSportFootballLegacy = 'FOOTBALL';
|
|
17
|
-
export type CourtType = CourtTypeSportBasketball | CourtTypeSportVolleyball | CourtTypeSportLacrosse | CourtTypeSportSoccer | CourtTypeSportHockey | CourtTypeSportBaseball | CourtTypeSportFootball | CourtTypeSportFootballLegacy;
|
|
18
|
-
export type ShapeControlPoints = [CourtPoint, CourtPoint] | [CourtPoint, CourtPoint, CourtPoint] | [CourtPoint, CourtPoint, CourtPoint, CourtPoint];
|
|
19
|
-
export type NoteDisplayModes = ['onCourt'] | ['playNote'] | ['onCourt', 'playNote'];
|
|
20
|
-
export interface SportConstants {
|
|
21
|
-
PLAYER_TOKEN_RADIUS: number;
|
|
22
|
-
PLAYER_TOKEN_SCALE: number;
|
|
23
|
-
}
|
|
24
|
-
export interface CourtTypeConstants {
|
|
25
|
-
COURT_RECT_WIDTH: number;
|
|
26
|
-
COURT_RECT_HEIGHT: number;
|
|
27
|
-
}
|
|
28
|
-
export interface CourtPoint {
|
|
29
|
-
x: number;
|
|
30
|
-
y: number;
|
|
31
|
-
}
|
|
32
|
-
export interface CourtSize {
|
|
33
|
-
height: number;
|
|
34
|
-
width: number;
|
|
35
|
-
}
|
|
36
|
-
export interface Scale {
|
|
37
|
-
x: number;
|
|
38
|
-
y: number;
|
|
39
|
-
}
|
|
40
|
-
export interface LinePart {
|
|
41
|
-
controlPoints: [CourtPoint, CourtPoint] | [CourtPoint, CourtPoint, CourtPoint] | [CourtPoint, CourtPoint, CourtPoint, CourtPoint];
|
|
42
|
-
}
|
|
43
|
-
export interface Color {
|
|
44
|
-
red: number;
|
|
45
|
-
green: number;
|
|
46
|
-
blue: number;
|
|
47
|
-
alpha: number;
|
|
48
|
-
}
|
|
49
|
-
export interface CourtRect {
|
|
50
|
-
origin: CourtPoint;
|
|
51
|
-
size: CourtSize;
|
|
52
|
-
}
|
|
53
|
-
export interface Court {
|
|
54
|
-
type: CourtType;
|
|
55
|
-
courtRect: CourtRect;
|
|
56
|
-
}
|
|
57
|
-
export type PlayerAnimationType = 'POSITION';
|
|
58
|
-
export interface PlayerAnimation {
|
|
59
|
-
id: string;
|
|
60
|
-
type: PlayerAnimationType;
|
|
61
|
-
keyTimes: number[];
|
|
62
|
-
lineParts: LinePart[];
|
|
63
|
-
}
|
|
64
|
-
export interface Player {
|
|
65
|
-
id: string;
|
|
66
|
-
possession: boolean;
|
|
67
|
-
color: Color;
|
|
68
|
-
position: Position;
|
|
69
|
-
location: CourtPoint;
|
|
70
|
-
textOverride?: string;
|
|
71
|
-
playerHatKey?: string;
|
|
72
|
-
animations: PlayerAnimation[];
|
|
73
|
-
}
|
|
74
|
-
export type LineAnimationType = 'LINESTROKE';
|
|
75
|
-
export interface LineAnimation {
|
|
76
|
-
id: string;
|
|
77
|
-
type: LineAnimationType;
|
|
78
|
-
keyTimes: number[];
|
|
79
|
-
strokeStartValues: [number, number, number];
|
|
80
|
-
}
|
|
81
|
-
export interface Line {
|
|
82
|
-
id: string;
|
|
83
|
-
type: LineType;
|
|
84
|
-
phase: number;
|
|
85
|
-
playerPositionOrigin: Position;
|
|
86
|
-
playerPositionTerminus: Position | null;
|
|
87
|
-
playerLineSequence: number;
|
|
88
|
-
lineParts: LinePart[];
|
|
89
|
-
color: Color;
|
|
90
|
-
hideLineTip?: boolean;
|
|
91
|
-
animations: LineAnimation[];
|
|
92
|
-
}
|
|
93
|
-
export interface Shape {
|
|
94
|
-
id: string;
|
|
95
|
-
type: ShapeType;
|
|
96
|
-
location: CourtPoint;
|
|
97
|
-
color: Color;
|
|
98
|
-
scale: Scale;
|
|
99
|
-
angle?: number;
|
|
100
|
-
showBorder?: boolean;
|
|
101
|
-
linePart?: LinePart;
|
|
102
|
-
}
|
|
103
|
-
export interface Note {
|
|
104
|
-
id: string;
|
|
105
|
-
location: CourtPoint;
|
|
106
|
-
displayModes: NoteDisplayModes;
|
|
107
|
-
text: string;
|
|
108
|
-
animations: NoteAnimation[];
|
|
109
|
-
font: NoteFont;
|
|
110
|
-
color: Color;
|
|
111
|
-
showBorder: boolean;
|
|
112
|
-
}
|
|
113
|
-
export interface NoteAnimation {
|
|
114
|
-
id: string;
|
|
115
|
-
keyTimes: number[];
|
|
116
|
-
}
|
|
117
|
-
export interface NoteFont {
|
|
118
|
-
bold: boolean;
|
|
119
|
-
italic: boolean;
|
|
120
|
-
underline: boolean;
|
|
121
|
-
strikethrough: boolean;
|
|
122
|
-
fontSize: number;
|
|
123
|
-
}
|
|
124
|
-
export interface PlayConstructData {
|
|
125
|
-
id?: string;
|
|
126
|
-
lastUpdtTS?: string;
|
|
127
|
-
name: string;
|
|
128
|
-
playData: PlayData;
|
|
129
|
-
}
|
|
130
|
-
export interface PlayData {
|
|
131
|
-
animationDuration: number;
|
|
132
|
-
sport: SportType;
|
|
133
|
-
court: Court;
|
|
134
|
-
players: Player[];
|
|
135
|
-
lines: Line[];
|
|
136
|
-
shapes?: Shape[];
|
|
137
|
-
notes?: Note[];
|
|
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' | '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 CourtTypeSportFootball = 'FOOTBALL_HIGH_SCHOOL';
|
|
16
|
+
export type CourtTypeSportFootballLegacy = 'FOOTBALL';
|
|
17
|
+
export type CourtType = CourtTypeSportBasketball | CourtTypeSportVolleyball | CourtTypeSportLacrosse | CourtTypeSportSoccer | CourtTypeSportHockey | CourtTypeSportBaseball | CourtTypeSportFootball | CourtTypeSportFootballLegacy;
|
|
18
|
+
export type ShapeControlPoints = [CourtPoint, CourtPoint] | [CourtPoint, CourtPoint, CourtPoint] | [CourtPoint, CourtPoint, CourtPoint, CourtPoint];
|
|
19
|
+
export type NoteDisplayModes = ['onCourt'] | ['playNote'] | ['onCourt', 'playNote'];
|
|
20
|
+
export interface SportConstants {
|
|
21
|
+
PLAYER_TOKEN_RADIUS: number;
|
|
22
|
+
PLAYER_TOKEN_SCALE: number;
|
|
23
|
+
}
|
|
24
|
+
export interface CourtTypeConstants {
|
|
25
|
+
COURT_RECT_WIDTH: number;
|
|
26
|
+
COURT_RECT_HEIGHT: number;
|
|
27
|
+
}
|
|
28
|
+
export interface CourtPoint {
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
}
|
|
32
|
+
export interface CourtSize {
|
|
33
|
+
height: number;
|
|
34
|
+
width: number;
|
|
35
|
+
}
|
|
36
|
+
export interface Scale {
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
}
|
|
40
|
+
export interface LinePart {
|
|
41
|
+
controlPoints: [CourtPoint, CourtPoint] | [CourtPoint, CourtPoint, CourtPoint] | [CourtPoint, CourtPoint, CourtPoint, CourtPoint];
|
|
42
|
+
}
|
|
43
|
+
export interface Color {
|
|
44
|
+
red: number;
|
|
45
|
+
green: number;
|
|
46
|
+
blue: number;
|
|
47
|
+
alpha: number;
|
|
48
|
+
}
|
|
49
|
+
export interface CourtRect {
|
|
50
|
+
origin: CourtPoint;
|
|
51
|
+
size: CourtSize;
|
|
52
|
+
}
|
|
53
|
+
export interface Court {
|
|
54
|
+
type: CourtType;
|
|
55
|
+
courtRect: CourtRect;
|
|
56
|
+
}
|
|
57
|
+
export type PlayerAnimationType = 'POSITION';
|
|
58
|
+
export interface PlayerAnimation {
|
|
59
|
+
id: string;
|
|
60
|
+
type: PlayerAnimationType;
|
|
61
|
+
keyTimes: number[];
|
|
62
|
+
lineParts: LinePart[];
|
|
63
|
+
}
|
|
64
|
+
export interface Player {
|
|
65
|
+
id: string;
|
|
66
|
+
possession: boolean;
|
|
67
|
+
color: Color;
|
|
68
|
+
position: Position;
|
|
69
|
+
location: CourtPoint;
|
|
70
|
+
textOverride?: string;
|
|
71
|
+
playerHatKey?: string;
|
|
72
|
+
animations: PlayerAnimation[];
|
|
73
|
+
}
|
|
74
|
+
export type LineAnimationType = 'LINESTROKE';
|
|
75
|
+
export interface LineAnimation {
|
|
76
|
+
id: string;
|
|
77
|
+
type: LineAnimationType;
|
|
78
|
+
keyTimes: number[];
|
|
79
|
+
strokeStartValues: [number, number, number];
|
|
80
|
+
}
|
|
81
|
+
export interface Line {
|
|
82
|
+
id: string;
|
|
83
|
+
type: LineType;
|
|
84
|
+
phase: number;
|
|
85
|
+
playerPositionOrigin: Position;
|
|
86
|
+
playerPositionTerminus: Position | null;
|
|
87
|
+
playerLineSequence: number;
|
|
88
|
+
lineParts: LinePart[];
|
|
89
|
+
color: Color;
|
|
90
|
+
hideLineTip?: boolean;
|
|
91
|
+
animations: LineAnimation[];
|
|
92
|
+
}
|
|
93
|
+
export interface Shape {
|
|
94
|
+
id: string;
|
|
95
|
+
type: ShapeType;
|
|
96
|
+
location: CourtPoint;
|
|
97
|
+
color: Color;
|
|
98
|
+
scale: Scale;
|
|
99
|
+
angle?: number;
|
|
100
|
+
showBorder?: boolean;
|
|
101
|
+
linePart?: LinePart;
|
|
102
|
+
}
|
|
103
|
+
export interface Note {
|
|
104
|
+
id: string;
|
|
105
|
+
location: CourtPoint;
|
|
106
|
+
displayModes: NoteDisplayModes;
|
|
107
|
+
text: string;
|
|
108
|
+
animations: NoteAnimation[];
|
|
109
|
+
font: NoteFont;
|
|
110
|
+
color: Color;
|
|
111
|
+
showBorder: boolean;
|
|
112
|
+
}
|
|
113
|
+
export interface NoteAnimation {
|
|
114
|
+
id: string;
|
|
115
|
+
keyTimes: number[];
|
|
116
|
+
}
|
|
117
|
+
export interface NoteFont {
|
|
118
|
+
bold: boolean;
|
|
119
|
+
italic: boolean;
|
|
120
|
+
underline: boolean;
|
|
121
|
+
strikethrough: boolean;
|
|
122
|
+
fontSize: number;
|
|
123
|
+
}
|
|
124
|
+
export interface PlayConstructData {
|
|
125
|
+
id?: string;
|
|
126
|
+
lastUpdtTS?: string;
|
|
127
|
+
name: string;
|
|
128
|
+
playData: PlayData;
|
|
129
|
+
}
|
|
130
|
+
export interface PlayData {
|
|
131
|
+
animationDuration: number;
|
|
132
|
+
sport: SportType;
|
|
133
|
+
court: Court;
|
|
134
|
+
players: Player[];
|
|
135
|
+
lines: Line[];
|
|
136
|
+
shapes?: Shape[];
|
|
137
|
+
notes?: Note[];
|
|
138
138
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luceosports/play-rendering",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"main": "dist/play-rendering.js",
|
|
5
5
|
"types": "dist/play-rendering.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -21,14 +21,13 @@
|
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@babel/core": "^7.18.6",
|
|
24
|
-
"@babel/plugin-
|
|
24
|
+
"@babel/plugin-transform-class-properties": "^7.24.7",
|
|
25
25
|
"@babel/plugin-transform-runtime": "^7.9.0",
|
|
26
26
|
"@babel/preset-env": "^7.9.0",
|
|
27
27
|
"@babel/preset-typescript": "^7.24.6",
|
|
28
28
|
"@commitlint/cli": "^13.2.0",
|
|
29
29
|
"@commitlint/config-angular": "^13.2.0",
|
|
30
30
|
"@types/lodash": "^4.17.4",
|
|
31
|
-
"@types/mathjs": "^9.4.2",
|
|
32
31
|
"@types/node": "^20.12.12",
|
|
33
32
|
"@typescript-eslint/eslint-plugin": "^7.11.0",
|
|
34
33
|
"@typescript-eslint/parser": "^7.11.0",
|
|
@@ -90,12 +90,8 @@ export default class PlayerLayer extends BaseLayer {
|
|
|
90
90
|
|
|
91
91
|
drawPlayerPuck(player: PlayerModel) {
|
|
92
92
|
const { x, y } = player.location;
|
|
93
|
-
const radius =
|
|
94
|
-
this.staticData.playerHeadshots && this.options.labelsOverrideType === 'Headshot'
|
|
95
|
-
? this.radius + this.courtTypeConstants.LINE_WIDTH / 2
|
|
96
|
-
: this.radius;
|
|
97
93
|
this.ctx.beginPath();
|
|
98
|
-
this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
|
|
94
|
+
this.ctx.arc(x, y, this.radius, 0, Math.PI * 2, true);
|
|
99
95
|
if (this.options.legacyPrintStyle) {
|
|
100
96
|
if (player.possession) this.ctx.stroke();
|
|
101
97
|
return;
|
|
@@ -115,6 +111,7 @@ export default class PlayerLayer extends BaseLayer {
|
|
|
115
111
|
this.ctx.translate(x, y);
|
|
116
112
|
|
|
117
113
|
if (headshotImage) {
|
|
114
|
+
this.ctx.save();
|
|
118
115
|
const imageVertical = headshotImage.image.width < headshotImage.image.height;
|
|
119
116
|
const imageHorizontal = headshotImage.image.height < headshotImage.image.width;
|
|
120
117
|
|
|
@@ -138,6 +135,7 @@ export default class PlayerLayer extends BaseLayer {
|
|
|
138
135
|
this.ctx.arc(0, 0, this.radius, 0, Math.PI * 2, true);
|
|
139
136
|
this.ctx.clip();
|
|
140
137
|
this.ctx.drawImage(headshotImage.image, topLeftX, topLeftY, dw, dh);
|
|
138
|
+
this.ctx.restore();
|
|
141
139
|
}
|
|
142
140
|
|
|
143
141
|
this.ctx.beginPath();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export const COURT_RECT_WIDTH =
|
|
2
|
-
export const COURT_RECT_HEIGHT =
|
|
1
|
+
export const COURT_RECT_WIDTH = 480;
|
|
2
|
+
export const COURT_RECT_HEIGHT = 460;
|
|
3
3
|
export const COURT_DIRT_COLOR = '#C49463';
|
|
4
4
|
|
|
5
5
|
export const HOME_PLATE_APEX_TO_PITCHERS_PLATE_FRONT = 60.5;
|
|
@@ -28,7 +28,8 @@ export const PITCHING_MOUND_DIA = 18;
|
|
|
28
28
|
|
|
29
29
|
export const PITCHERS_PLATE_GRASS_LINE_RAD = 95;
|
|
30
30
|
|
|
31
|
-
export const
|
|
31
|
+
export const HOME_RUN_FENCE_CENTER_DISTANCE = 390;
|
|
32
|
+
export const FOUL_LINE_LENGTH = 330;
|
|
32
33
|
export const BASE_LINE_LENGTH = 90;
|
|
33
|
-
export const BASE_SQUARE_SIDE_LENGTH =
|
|
34
|
+
export const BASE_SQUARE_SIDE_LENGTH = 2.5;
|
|
34
35
|
export const BASE_DIRT_RAD = 13;
|
package/src/layers/court/layers/BASEBALL/courtTypes/BASEBALL_HIGH_SCHOOL/layers/BaseLineLayer.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import InternalCourtLayer from '../../../../../base/InternalCourtLayer';
|
|
2
2
|
|
|
3
|
-
import {
|
|
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';
|
|
4
11
|
|
|
5
12
|
export default class BaseLineLayer extends InternalCourtLayer {
|
|
6
13
|
original() {
|
|
@@ -14,7 +21,7 @@ export default class BaseLineLayer extends InternalCourtLayer {
|
|
|
14
21
|
drawLogic() {
|
|
15
22
|
const homePlateApex = { x: this.courtCenter.x, y: HOME_PLATE_APEX_TO_BACKSTOP };
|
|
16
23
|
|
|
17
|
-
this.ctx.lineWidth = this.courtTypeConstants.COURT_LINE_WIDTH *
|
|
24
|
+
this.ctx.lineWidth = this.courtTypeConstants.COURT_LINE_WIDTH * 3;
|
|
18
25
|
|
|
19
26
|
this.ctx.save();
|
|
20
27
|
this.ctx.translate(homePlateApex.x, homePlateApex.y);
|
|
@@ -26,16 +33,18 @@ export default class BaseLineLayer extends InternalCourtLayer {
|
|
|
26
33
|
this.ctx.stroke();
|
|
27
34
|
this.drawBaseSquare(BASE_LINE_LENGTH, 0);
|
|
28
35
|
|
|
29
|
-
|
|
30
|
-
this.ctx.
|
|
31
|
-
this.ctx.
|
|
32
|
-
this.ctx.
|
|
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();
|
|
33
41
|
this.drawBaseSquare(BASE_LINE_LENGTH + BASE_SQUARE_SIDE_LENGTH / 2, BASE_LINE_LENGTH - BASE_SQUARE_SIDE_LENGTH / 2);
|
|
34
42
|
|
|
35
|
-
|
|
36
|
-
this.ctx.
|
|
37
|
-
this.ctx.
|
|
38
|
-
this.ctx.
|
|
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();
|
|
39
48
|
this.drawBaseSquare(BASE_SQUARE_SIDE_LENGTH, BASE_LINE_LENGTH - BASE_SQUARE_SIDE_LENGTH);
|
|
40
49
|
|
|
41
50
|
this.ctx.beginPath();
|
|
@@ -54,6 +63,23 @@ export default class BaseLineLayer extends InternalCourtLayer {
|
|
|
54
63
|
this.ctx.stroke();
|
|
55
64
|
this.ctx.restore();
|
|
56
65
|
});
|
|
66
|
+
|
|
67
|
+
// Home run arc
|
|
68
|
+
const homeRunArcCenterOffsetY = 138;
|
|
69
|
+
const homeRunArcStartAngle = Math.PI / 8.1;
|
|
70
|
+
const homeRunArcEndAngle = Math.PI - Math.PI / 8.1;
|
|
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,
|
|
77
|
+
homeRunArcStartAngle,
|
|
78
|
+
homeRunArcEndAngle,
|
|
79
|
+
false
|
|
80
|
+
);
|
|
81
|
+
this.ctx.stroke();
|
|
82
|
+
this.ctx.restore();
|
|
57
83
|
}
|
|
58
84
|
|
|
59
85
|
drawBaseSquare(x: number, y: number) {
|
package/src/layers/court/layers/BASEBALL/courtTypes/BASEBALL_HIGH_SCHOOL/layers/HomePlateLayer.ts
CHANGED
|
@@ -43,26 +43,42 @@ export default class HomePlateLayer extends InternalCourtLayer {
|
|
|
43
43
|
this.ctx.stroke();
|
|
44
44
|
this.ctx.fill();
|
|
45
45
|
|
|
46
|
+
// // 2. Batters Box
|
|
47
|
+
// [-1, 1].forEach(sideIndex => {
|
|
48
|
+
// this.ctx.save();
|
|
49
|
+
// this.ctx.translate(homePlateApex.x, homePlateApex.y + HOME_PLATE_SIDE / 2);
|
|
50
|
+
// this.ctx.beginPath();
|
|
51
|
+
// const battersBoxClosestX = HOME_PLATE_SIDE / 2 + HOME_PLATE_SIDE_TO_BATTERS_BOX;
|
|
52
|
+
// this.ctx.moveTo(sideIndex * battersBoxClosestX, 0);
|
|
53
|
+
// this.ctx.lineTo(sideIndex * battersBoxClosestX, BATTERS_BOX_HEIGHT / 2);
|
|
54
|
+
// this.ctx.lineTo(sideIndex * (battersBoxClosestX + BATTERS_BOX_WIDTH), BATTERS_BOX_HEIGHT / 2);
|
|
55
|
+
// this.ctx.lineTo(sideIndex * (battersBoxClosestX + BATTERS_BOX_WIDTH), -BATTERS_BOX_HEIGHT / 2);
|
|
56
|
+
// this.ctx.lineTo(sideIndex * battersBoxClosestX, -BATTERS_BOX_HEIGHT / 2);
|
|
57
|
+
// this.ctx.lineTo(sideIndex * battersBoxClosestX, 0);
|
|
58
|
+
// this.ctx.stroke();
|
|
59
|
+
// this.ctx.restore();
|
|
60
|
+
// });
|
|
61
|
+
|
|
46
62
|
// 2. Batters Box
|
|
47
63
|
[-1, 1].forEach(sideIndex => {
|
|
48
64
|
this.ctx.save();
|
|
49
65
|
this.ctx.translate(homePlateApex.x, homePlateApex.y + HOME_PLATE_SIDE / 2);
|
|
50
66
|
this.ctx.beginPath();
|
|
51
|
-
|
|
52
67
|
const battersBoxClosestX = HOME_PLATE_SIDE / 2 + HOME_PLATE_SIDE_TO_BATTERS_BOX;
|
|
53
|
-
|
|
54
68
|
this.ctx.moveTo(sideIndex * battersBoxClosestX, 0);
|
|
55
|
-
this.ctx.lineTo(sideIndex * battersBoxClosestX,
|
|
56
|
-
this.ctx.lineTo(sideIndex * (battersBoxClosestX + BATTERS_BOX_WIDTH),
|
|
57
|
-
this.ctx.lineTo(sideIndex * (battersBoxClosestX + BATTERS_BOX_WIDTH),
|
|
58
|
-
this.ctx.lineTo(sideIndex * battersBoxClosestX,
|
|
69
|
+
this.ctx.lineTo(sideIndex * battersBoxClosestX, HOME_PLATE_SIDE / 2);
|
|
70
|
+
this.ctx.lineTo(sideIndex * (battersBoxClosestX + BATTERS_BOX_WIDTH), HOME_PLATE_SIDE / 2);
|
|
71
|
+
this.ctx.lineTo(sideIndex * (battersBoxClosestX + BATTERS_BOX_WIDTH), HOME_PLATE_SIDE / 2 - BATTERS_BOX_HEIGHT);
|
|
72
|
+
this.ctx.lineTo(sideIndex * battersBoxClosestX, HOME_PLATE_SIDE / 2 - BATTERS_BOX_HEIGHT);
|
|
73
|
+
this.ctx.lineTo(sideIndex * battersBoxClosestX, 0);
|
|
59
74
|
this.ctx.lineTo(sideIndex * battersBoxClosestX, 0);
|
|
60
75
|
this.ctx.stroke();
|
|
61
76
|
this.ctx.restore();
|
|
62
77
|
});
|
|
63
78
|
|
|
64
79
|
// 3. Catchers box
|
|
65
|
-
const battersBoxNearestY = homePlateApex.y + HOME_PLATE_SIDE / 2 - BATTERS_BOX_HEIGHT / 2;
|
|
80
|
+
// const battersBoxNearestY = homePlateApex.y + HOME_PLATE_SIDE / 2 - BATTERS_BOX_HEIGHT / 2;
|
|
81
|
+
const battersBoxNearestY = homePlateApex.y + HOME_PLATE_SIDE / 2 - BATTERS_BOX_HEIGHT + HOME_PLATE_SIDE / 2;
|
|
66
82
|
[-1, 1].forEach(sideIndex => {
|
|
67
83
|
this.ctx.save();
|
|
68
84
|
this.ctx.translate(this.courtCenter.x, battersBoxNearestY - BATTERS_BOX_TO_CATCHERS_BACK_LINE);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import ADirtLayer from './ADirtLayer';
|
|
2
|
-
import BaseLineLayer from './BaseLineLayer';
|
|
3
|
-
import HomePlateLayer from './HomePlateLayer';
|
|
4
|
-
import PitchingMoundLayer from './PitchingMoundLayer';
|
|
5
|
-
|
|
6
|
-
export { ADirtLayer, BaseLineLayer, HomePlateLayer, PitchingMoundLayer };
|
|
1
|
+
import ADirtLayer from './ADirtLayer';
|
|
2
|
+
import BaseLineLayer from './BaseLineLayer';
|
|
3
|
+
import HomePlateLayer from './HomePlateLayer';
|
|
4
|
+
import PitchingMoundLayer from './PitchingMoundLayer';
|
|
5
|
+
|
|
6
|
+
export { ADirtLayer, BaseLineLayer, HomePlateLayer, PitchingMoundLayer };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import BorderRectLayer from './BorderRectLayer';
|
|
2
|
-
|
|
3
|
-
export { BorderRectLayer };
|
|
1
|
+
import BorderRectLayer from './BorderRectLayer';
|
|
2
|
+
|
|
3
|
+
export { BorderRectLayer };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import BorderRectLayer from './BorderRectLayer';
|
|
2
|
-
import CenterLineLayer from './CenterLineLayer';
|
|
3
|
-
import EndZoneLayer from './EndZoneLayer';
|
|
4
|
-
import FieldNumberLayer from './FieldNumberLayer';
|
|
5
|
-
import HashMarkLayer from './HashMarkLayer';
|
|
6
|
-
import YardLineLayer from './YardLineLayer';
|
|
7
|
-
|
|
8
|
-
export { BorderRectLayer, CenterLineLayer, EndZoneLayer, FieldNumberLayer, HashMarkLayer, YardLineLayer };
|
|
1
|
+
import BorderRectLayer from './BorderRectLayer';
|
|
2
|
+
import CenterLineLayer from './CenterLineLayer';
|
|
3
|
+
import EndZoneLayer from './EndZoneLayer';
|
|
4
|
+
import FieldNumberLayer from './FieldNumberLayer';
|
|
5
|
+
import HashMarkLayer from './HashMarkLayer';
|
|
6
|
+
import YardLineLayer from './YardLineLayer';
|
|
7
|
+
|
|
8
|
+
export { BorderRectLayer, CenterLineLayer, EndZoneLayer, FieldNumberLayer, HashMarkLayer, YardLineLayer };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import BorderRinkLayer from './BorderRinkLayer';
|
|
2
|
-
import CenterCircleLayer from './CenterCircleLayer';
|
|
3
|
-
import CenterLineLayer from './CenterLineLayer';
|
|
4
|
-
import CenterSpotLayer from './CenterSpotLayer';
|
|
5
|
-
import EndZoneLayer from './EndZoneLayer';
|
|
6
|
-
import GoalLineLayer from './GoalLineLayer';
|
|
7
|
-
import NeutralZoneLayer from './NeutralZoneLayer';
|
|
8
|
-
import RefereeCreaseLayer from './RefereeCreaseLayer';
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
BorderRinkLayer,
|
|
12
|
-
CenterCircleLayer,
|
|
13
|
-
CenterLineLayer,
|
|
14
|
-
CenterSpotLayer,
|
|
15
|
-
EndZoneLayer,
|
|
16
|
-
GoalLineLayer,
|
|
17
|
-
NeutralZoneLayer,
|
|
18
|
-
RefereeCreaseLayer
|
|
19
|
-
};
|
|
1
|
+
import BorderRinkLayer from './BorderRinkLayer';
|
|
2
|
+
import CenterCircleLayer from './CenterCircleLayer';
|
|
3
|
+
import CenterLineLayer from './CenterLineLayer';
|
|
4
|
+
import CenterSpotLayer from './CenterSpotLayer';
|
|
5
|
+
import EndZoneLayer from './EndZoneLayer';
|
|
6
|
+
import GoalLineLayer from './GoalLineLayer';
|
|
7
|
+
import NeutralZoneLayer from './NeutralZoneLayer';
|
|
8
|
+
import RefereeCreaseLayer from './RefereeCreaseLayer';
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
BorderRinkLayer,
|
|
12
|
+
CenterCircleLayer,
|
|
13
|
+
CenterLineLayer,
|
|
14
|
+
CenterSpotLayer,
|
|
15
|
+
EndZoneLayer,
|
|
16
|
+
GoalLineLayer,
|
|
17
|
+
NeutralZoneLayer,
|
|
18
|
+
RefereeCreaseLayer
|
|
19
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import BorderRectLayer from './BorderRectLayer';
|
|
2
|
-
import RestrainingLineLayer from './RestrainingLineLayer';
|
|
3
|
-
|
|
4
|
-
export { BorderRectLayer, RestrainingLineLayer };
|
|
1
|
+
import BorderRectLayer from './BorderRectLayer';
|
|
2
|
+
import RestrainingLineLayer from './RestrainingLineLayer';
|
|
3
|
+
|
|
4
|
+
export { BorderRectLayer, RestrainingLineLayer };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import CenterSpotLayer from './CenterSpotLayer';
|
|
2
|
-
import HashMarkLayer from './HashMarkLayer';
|
|
3
|
-
import PenaltySpotLayer from './PenaltySpotLayer';
|
|
4
|
-
|
|
5
|
-
export { CenterSpotLayer, HashMarkLayer, PenaltySpotLayer };
|
|
1
|
+
import CenterSpotLayer from './CenterSpotLayer';
|
|
2
|
+
import HashMarkLayer from './HashMarkLayer';
|
|
3
|
+
import PenaltySpotLayer from './PenaltySpotLayer';
|
|
4
|
+
|
|
5
|
+
export { CenterSpotLayer, HashMarkLayer, PenaltySpotLayer };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import HashMarkLayer from './HashMarkLayer';
|
|
2
|
-
import PenaltySpotLayer from './PenaltySpotLayer';
|
|
3
|
-
|
|
4
|
-
export { HashMarkLayer, PenaltySpotLayer };
|
|
1
|
+
import HashMarkLayer from './HashMarkLayer';
|
|
2
|
+
import PenaltySpotLayer from './PenaltySpotLayer';
|
|
3
|
+
|
|
4
|
+
export { HashMarkLayer, PenaltySpotLayer };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import BuildOutLineLayer from './BuildOutLineLayer';
|
|
2
|
-
import PenaltyArcLayer from './PenaltyArcLayer';
|
|
3
|
-
|
|
4
|
-
export { BuildOutLineLayer, PenaltyArcLayer };
|
|
1
|
+
import BuildOutLineLayer from './BuildOutLineLayer';
|
|
2
|
+
import PenaltyArcLayer from './PenaltyArcLayer';
|
|
3
|
+
|
|
4
|
+
export { BuildOutLineLayer, PenaltyArcLayer };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import PenaltyArcLayer from './PenaltyArcLayer';
|
|
2
|
-
|
|
3
|
-
export { PenaltyArcLayer };
|
|
1
|
+
import PenaltyArcLayer from './PenaltyArcLayer';
|
|
2
|
+
|
|
3
|
+
export { PenaltyArcLayer };
|