@luceosports/play-rendering 1.16.3 → 1.17.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/package.json +1 -1
- package/src/assets/ice_bg.png +0 -0
- package/src/constants.js +4 -0
- package/src/layers/court/layers/HOCKEY/constants.js +7 -0
- package/src/layers/court/layers/HOCKEY/courtTypes/HOCKEY_INTERNATIONAL/constants.js +14 -0
- package/src/layers/court/layers/HOCKEY/courtTypes/HOCKEY_INTERNATIONAL/layers/GoaCreaseLayer.js +37 -0
- package/src/layers/court/layers/HOCKEY/courtTypes/HOCKEY_NHL/constants.js +14 -0
- package/src/layers/court/layers/HOCKEY/courtTypes/HOCKEY_NHL/layers/GoaCreaseLayer.js +46 -0
- package/src/layers/court/layers/HOCKEY/layers/BorderRinkLayer.js +53 -0
- package/src/layers/court/layers/HOCKEY/layers/CenterCircleLayer.js +16 -0
- package/src/layers/court/layers/HOCKEY/layers/CenterLineLayer.js +19 -0
- package/src/layers/court/layers/HOCKEY/layers/CenterSpotLayer.js +14 -0
- package/src/layers/court/layers/HOCKEY/layers/EndZoneLayer.js +63 -0
- package/src/layers/court/layers/HOCKEY/layers/GoalLineLayer.js +23 -0
- package/src/layers/court/layers/HOCKEY/layers/NeutralZoneLayer.js +67 -0
- package/src/layers/court/layers/HOCKEY/layers/RefereeCreaseLayer.js +16 -0
- package/src/models/Play.js +6 -2
package/package.json
CHANGED
|
Binary file
|
package/src/constants.js
CHANGED
|
@@ -4,6 +4,7 @@ module.exports = Object.freeze({
|
|
|
4
4
|
SPORT_TYPE_FOOTBALL: 'FOOTBALL',
|
|
5
5
|
SPORT_TYPE_LACROSSE: 'LACROSSE',
|
|
6
6
|
SPORT_TYPE_SOCCER: 'SOCCER',
|
|
7
|
+
SPORT_TYPE_HOCKEY: 'HOCKEY',
|
|
7
8
|
|
|
8
9
|
COURT_TYPE_BIG3: 'BIG3',
|
|
9
10
|
COURT_TYPE_FIBA: 'FIBA',
|
|
@@ -29,6 +30,9 @@ module.exports = Object.freeze({
|
|
|
29
30
|
COURT_TYPE_SOCCER_U12: 'SOCCER_U12',
|
|
30
31
|
COURT_TYPE_SOCCER_U19: 'SOCCER_U19',
|
|
31
32
|
|
|
33
|
+
COURT_TYPE_HOCKEY_NHL: 'HOCKEY_NHL',
|
|
34
|
+
COURT_TYPE_HOCKEY_INTERNATIONAL: 'HOCKEY_INTERNATIONAL',
|
|
35
|
+
|
|
32
36
|
SHAPE_TYPE_CIRCLE: 'CIRCLE',
|
|
33
37
|
SHAPE_TYPE_SQUARE: 'SQUARE',
|
|
34
38
|
SHAPE_TYPE_TRIANGLE: 'TRIANGLE',
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module.exports = Object.freeze({
|
|
2
|
+
COURT_RECT_WIDTH: 100,
|
|
3
|
+
COURT_RECT_HEIGHT: 200,
|
|
4
|
+
LINE_COLOR_RED: '#C8102E',
|
|
5
|
+
LINE_COLOR_BLUE: '#0032A0',
|
|
6
|
+
END_ZONE_LENGTH: 58,
|
|
7
|
+
NEUTRAL_ZONE_LENGTH: 29,
|
|
8
|
+
FACE_OFF_SPOTS_DISTANCE: 44,
|
|
9
|
+
FACE_OFF_SPOT_RADIUS: 0.75,
|
|
10
|
+
FACE_OFF_SPOT_CIRCLE_RADIUS: 15,
|
|
11
|
+
GOAL_CAGE_LENGTH: 6,
|
|
12
|
+
GOAL_CAGE_DEPTH: 3,
|
|
13
|
+
GOAL_CREASE_ARC_RADIUS: 5.8
|
|
14
|
+
});
|
package/src/layers/court/layers/HOCKEY/courtTypes/HOCKEY_INTERNATIONAL/layers/GoaCreaseLayer.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const InternalCourtLayer = require('../../../../../base/InternalCourtLayer');
|
|
2
|
+
|
|
3
|
+
class GoaCreaseLayer extends InternalCourtLayer {
|
|
4
|
+
reflection() {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
drawLogic() {
|
|
9
|
+
this.ctx.strokeStyle = this.courtTypeConstants.LINE_COLOR_RED;
|
|
10
|
+
this.ctx.lineWidth = this.courtTypeConstants.COURT_LINE_WIDTH * 2;
|
|
11
|
+
|
|
12
|
+
const goalLineY =
|
|
13
|
+
this.courtCenter.y - this.courtTypeConstants.NEUTRAL_ZONE_LENGTH - this.courtTypeConstants.END_ZONE_LENGTH;
|
|
14
|
+
|
|
15
|
+
// 1. Draw goal crease rect
|
|
16
|
+
this.ctx.beginPath();
|
|
17
|
+
this.ctx.arc(this.courtCenter.x, goalLineY, this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS, 0, Math.PI, false);
|
|
18
|
+
this.ctx.stroke();
|
|
19
|
+
|
|
20
|
+
// 2. Draw goal cage
|
|
21
|
+
this.ctx.strokeStyle = '#000';
|
|
22
|
+
this.ctx.beginPath();
|
|
23
|
+
this.ctx.moveTo(this.courtCenter.x - this.courtTypeConstants.GOAL_CAGE_LENGTH / 2, goalLineY);
|
|
24
|
+
this.ctx.lineTo(
|
|
25
|
+
this.courtCenter.x - this.courtTypeConstants.GOAL_CAGE_LENGTH / 2,
|
|
26
|
+
goalLineY - this.courtTypeConstants.GOAL_CAGE_DEPTH
|
|
27
|
+
);
|
|
28
|
+
this.ctx.lineTo(
|
|
29
|
+
this.courtCenter.x + this.courtTypeConstants.GOAL_CAGE_LENGTH / 2,
|
|
30
|
+
goalLineY - this.courtTypeConstants.GOAL_CAGE_DEPTH
|
|
31
|
+
);
|
|
32
|
+
this.ctx.lineTo(this.courtCenter.x + this.courtTypeConstants.GOAL_CAGE_LENGTH / 2, goalLineY);
|
|
33
|
+
this.ctx.stroke();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = GoaCreaseLayer;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module.exports = Object.freeze({
|
|
2
|
+
COURT_RECT_WIDTH: 85,
|
|
3
|
+
COURT_RECT_HEIGHT: 200,
|
|
4
|
+
LINE_COLOR_RED: '#C8102E',
|
|
5
|
+
LINE_COLOR_BLUE: '#0032A0',
|
|
6
|
+
END_ZONE_LENGTH: 64,
|
|
7
|
+
NEUTRAL_ZONE_LENGTH: 25,
|
|
8
|
+
FACE_OFF_SPOTS_DISTANCE: 44,
|
|
9
|
+
FACE_OFF_SPOT_RADIUS: 0.75,
|
|
10
|
+
FACE_OFF_SPOT_CIRCLE_RADIUS: 15,
|
|
11
|
+
GOAL_CAGE_LENGTH: 6,
|
|
12
|
+
GOAL_CAGE_DEPTH: 3,
|
|
13
|
+
GOAL_CREASE_ARC_RADIUS: 4
|
|
14
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const InternalCourtLayer = require('../../../../../base/InternalCourtLayer');
|
|
2
|
+
|
|
3
|
+
class GoaCreaseLayer extends InternalCourtLayer {
|
|
4
|
+
reflection() {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
drawLogic() {
|
|
9
|
+
this.ctx.strokeStyle = this.courtTypeConstants.LINE_COLOR_RED;
|
|
10
|
+
this.ctx.lineWidth = this.courtTypeConstants.COURT_LINE_WIDTH * 2;
|
|
11
|
+
|
|
12
|
+
const goalLineY =
|
|
13
|
+
this.courtCenter.y - this.courtTypeConstants.NEUTRAL_ZONE_LENGTH - this.courtTypeConstants.END_ZONE_LENGTH;
|
|
14
|
+
|
|
15
|
+
// 1. Draw goal crease rect
|
|
16
|
+
this.ctx.beginPath();
|
|
17
|
+
this.ctx.moveTo(this.courtCenter.x - this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS, goalLineY);
|
|
18
|
+
this.ctx.lineTo(
|
|
19
|
+
this.courtCenter.x - this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS,
|
|
20
|
+
goalLineY + this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS
|
|
21
|
+
);
|
|
22
|
+
this.ctx.lineTo(
|
|
23
|
+
this.courtCenter.x + this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS,
|
|
24
|
+
goalLineY + this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS
|
|
25
|
+
);
|
|
26
|
+
this.ctx.lineTo(this.courtCenter.x + this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS, goalLineY);
|
|
27
|
+
this.ctx.stroke();
|
|
28
|
+
|
|
29
|
+
// 2. Draw goal cage
|
|
30
|
+
this.ctx.strokeStyle = '#000';
|
|
31
|
+
this.ctx.beginPath();
|
|
32
|
+
this.ctx.moveTo(this.courtCenter.x - this.courtTypeConstants.GOAL_CAGE_LENGTH / 2, goalLineY);
|
|
33
|
+
this.ctx.lineTo(
|
|
34
|
+
this.courtCenter.x - this.courtTypeConstants.GOAL_CAGE_LENGTH / 2,
|
|
35
|
+
goalLineY - this.courtTypeConstants.GOAL_CAGE_DEPTH
|
|
36
|
+
);
|
|
37
|
+
this.ctx.lineTo(
|
|
38
|
+
this.courtCenter.x + this.courtTypeConstants.GOAL_CAGE_LENGTH / 2,
|
|
39
|
+
goalLineY - this.courtTypeConstants.GOAL_CAGE_DEPTH
|
|
40
|
+
);
|
|
41
|
+
this.ctx.lineTo(this.courtCenter.x + this.courtTypeConstants.GOAL_CAGE_LENGTH / 2, goalLineY);
|
|
42
|
+
this.ctx.stroke();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
module.exports = GoaCreaseLayer;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const InternalCourtLayer = require('../../../base/InternalCourtLayer');
|
|
2
|
+
|
|
3
|
+
class BorderRinkLayer extends InternalCourtLayer {
|
|
4
|
+
reflection() {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
drawLogic() {
|
|
9
|
+
this.ctx.strokeStyle = '#000'; // #7c7c7c
|
|
10
|
+
this.ctx.lineWidth = this.courtTypeConstants.COURT_LINE_WIDTH * 4;
|
|
11
|
+
|
|
12
|
+
const goalLineY =
|
|
13
|
+
this.courtCenter.y - this.courtTypeConstants.NEUTRAL_ZONE_LENGTH - this.courtTypeConstants.END_ZONE_LENGTH;
|
|
14
|
+
|
|
15
|
+
const faceOffOffset =
|
|
16
|
+
(this.courtTypeConstants.COURT_RECT_WIDTH - this.courtTypeConstants.FACE_OFF_SPOTS_DISTANCE) / 2;
|
|
17
|
+
|
|
18
|
+
const sideLineLeft = [
|
|
19
|
+
{ x: 0, y: this.courtCenter.y },
|
|
20
|
+
{ x: 0, y: goalLineY }
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
const sideLineTop = [
|
|
24
|
+
{ x: faceOffOffset, y: 0 },
|
|
25
|
+
{ x: this.courtTypeConstants.COURT_RECT_WIDTH - faceOffOffset, y: 0 }
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const sideLineRight = [
|
|
29
|
+
{ x: this.courtTypeConstants.COURT_RECT_WIDTH, y: this.courtCenter.y },
|
|
30
|
+
{ x: this.courtTypeConstants.COURT_RECT_WIDTH, y: goalLineY }
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
this.ctx.beginPath();
|
|
34
|
+
this.ctx.moveTo(sideLineLeft[0].x, sideLineLeft[0].y);
|
|
35
|
+
this.ctx.lineTo(sideLineLeft[1].x, sideLineLeft[1].y);
|
|
36
|
+
|
|
37
|
+
this.ctx.bezierCurveTo(0, 0, 10, 0, sideLineTop[0].x, sideLineTop[0].y);
|
|
38
|
+
this.ctx.lineTo(sideLineTop[1].x, sideLineTop[1].y);
|
|
39
|
+
|
|
40
|
+
this.ctx.bezierCurveTo(
|
|
41
|
+
this.courtTypeConstants.COURT_RECT_WIDTH - 10,
|
|
42
|
+
0,
|
|
43
|
+
this.courtTypeConstants.COURT_RECT_WIDTH,
|
|
44
|
+
0,
|
|
45
|
+
sideLineRight[1].x,
|
|
46
|
+
sideLineRight[1].y
|
|
47
|
+
);
|
|
48
|
+
this.ctx.lineTo(sideLineRight[0].x, sideLineRight[0].y);
|
|
49
|
+
this.ctx.stroke();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
module.exports = BorderRinkLayer;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const InternalCourtLayer = require('../../../base/InternalCourtLayer');
|
|
2
|
+
|
|
3
|
+
const CENTER_CIRCLE_RADIUS = 15;
|
|
4
|
+
|
|
5
|
+
class CenterCircleLayer extends InternalCourtLayer {
|
|
6
|
+
drawLogic() {
|
|
7
|
+
this.ctx.strokeStyle = this.courtTypeConstants.LINE_COLOR_BLUE;
|
|
8
|
+
this.ctx.lineWidth = this.courtTypeConstants.COURT_LINE_WIDTH * 2;
|
|
9
|
+
|
|
10
|
+
this.ctx.beginPath();
|
|
11
|
+
this.ctx.arc(this.courtCenter.x, this.courtCenter.y, CENTER_CIRCLE_RADIUS, 0, Math.PI * 2, true);
|
|
12
|
+
this.ctx.stroke();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
module.exports = CenterCircleLayer;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const InternalCourtLayer = require('../../../base/InternalCourtLayer');
|
|
2
|
+
|
|
3
|
+
class CenterLineLayer extends InternalCourtLayer {
|
|
4
|
+
drawLogic() {
|
|
5
|
+
this.ctx.strokeStyle = this.courtTypeConstants.LINE_COLOR_RED;
|
|
6
|
+
this.ctx.setLineDash([2, 1]);
|
|
7
|
+
this.ctx.lineWidth = this.courtTypeConstants.COURT_LINE_WIDTH * 4;
|
|
8
|
+
|
|
9
|
+
const courtOrigin = { x: 0.0, y: this.courtCenter.y };
|
|
10
|
+
const courtTerminus = { x: this.courtTypeConstants.COURT_RECT_WIDTH, y: this.courtCenter.y };
|
|
11
|
+
|
|
12
|
+
this.ctx.beginPath();
|
|
13
|
+
this.ctx.moveTo(courtOrigin.x, courtOrigin.y);
|
|
14
|
+
this.ctx.lineTo(courtTerminus.x, courtTerminus.y);
|
|
15
|
+
this.ctx.stroke();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = CenterLineLayer;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const InternalCourtLayer = require('../../../base/InternalCourtLayer');
|
|
2
|
+
|
|
3
|
+
const CENTER_SPOT_RADIUS = 1;
|
|
4
|
+
class CenterSpotLayer extends InternalCourtLayer {
|
|
5
|
+
drawLogic() {
|
|
6
|
+
this.ctx.fillStyle = this.courtTypeConstants.LINE_COLOR_BLUE;
|
|
7
|
+
|
|
8
|
+
this.ctx.beginPath();
|
|
9
|
+
this.ctx.arc(this.courtCenter.x, this.courtCenter.y, CENTER_SPOT_RADIUS, 0, Math.PI * 2, true);
|
|
10
|
+
this.ctx.fill();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
module.exports = CenterSpotLayer;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const InternalCourtLayer = require('../../../base/InternalCourtLayer');
|
|
2
|
+
|
|
3
|
+
const FACE_OFF_SPOT_GOAL_LINE_OFFSET = 22;
|
|
4
|
+
|
|
5
|
+
class EndZoneLayer extends InternalCourtLayer {
|
|
6
|
+
reflection() {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
drawLogic() {
|
|
11
|
+
this.ctx.fillStyle = this.courtTypeConstants.LINE_COLOR_RED;
|
|
12
|
+
this.ctx.strokeStyle = this.courtTypeConstants.LINE_COLOR_RED;
|
|
13
|
+
this.ctx.lineWidth = this.courtTypeConstants.COURT_LINE_WIDTH * 2;
|
|
14
|
+
|
|
15
|
+
const faceOffOffset =
|
|
16
|
+
(this.courtTypeConstants.COURT_RECT_WIDTH - this.courtTypeConstants.FACE_OFF_SPOTS_DISTANCE) / 2;
|
|
17
|
+
|
|
18
|
+
const faceOffSpotY =
|
|
19
|
+
this.courtCenter.y -
|
|
20
|
+
this.courtTypeConstants.NEUTRAL_ZONE_LENGTH -
|
|
21
|
+
this.courtTypeConstants.END_ZONE_LENGTH +
|
|
22
|
+
FACE_OFF_SPOT_GOAL_LINE_OFFSET;
|
|
23
|
+
|
|
24
|
+
const faceOffSpots = [
|
|
25
|
+
{ x: faceOffOffset, y: faceOffSpotY },
|
|
26
|
+
{ x: this.courtTypeConstants.COURT_RECT_WIDTH - faceOffOffset, y: faceOffSpotY }
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
faceOffSpots.forEach(spot => {
|
|
30
|
+
// 1. Draw face off spots
|
|
31
|
+
this.ctx.beginPath();
|
|
32
|
+
this.ctx.arc(spot.x, spot.y, this.courtTypeConstants.FACE_OFF_SPOT_RADIUS, 0, Math.PI * 2, true);
|
|
33
|
+
this.ctx.fill();
|
|
34
|
+
|
|
35
|
+
// 2. Draw face off circles
|
|
36
|
+
this.ctx.beginPath();
|
|
37
|
+
this.ctx.arc(spot.x, spot.y, this.courtTypeConstants.FACE_OFF_SPOT_CIRCLE_RADIUS, 0, Math.PI * 2, true);
|
|
38
|
+
this.ctx.stroke();
|
|
39
|
+
|
|
40
|
+
// 3. Draw hash marks
|
|
41
|
+
const hashMarks = [
|
|
42
|
+
{
|
|
43
|
+
ox: spot.x - this.courtTypeConstants.FACE_OFF_SPOT_CIRCLE_RADIUS,
|
|
44
|
+
tx: spot.x - (this.courtTypeConstants.FACE_OFF_SPOT_CIRCLE_RADIUS + 1)
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
ox: spot.x + this.courtTypeConstants.FACE_OFF_SPOT_CIRCLE_RADIUS,
|
|
48
|
+
tx: spot.x + (this.courtTypeConstants.FACE_OFF_SPOT_CIRCLE_RADIUS + 1)
|
|
49
|
+
}
|
|
50
|
+
];
|
|
51
|
+
hashMarks.forEach(hm => {
|
|
52
|
+
[spot.y - 1, spot.y + 1].forEach(y => {
|
|
53
|
+
this.ctx.beginPath();
|
|
54
|
+
this.ctx.moveTo(hm.ox, y);
|
|
55
|
+
this.ctx.lineTo(hm.tx, y);
|
|
56
|
+
this.ctx.stroke();
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
module.exports = EndZoneLayer;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const InternalCourtLayer = require('../../../base/InternalCourtLayer');
|
|
2
|
+
|
|
3
|
+
class GoalLineLayer extends InternalCourtLayer {
|
|
4
|
+
reflection() {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
drawLogic() {
|
|
9
|
+
this.ctx.strokeStyle = this.courtTypeConstants.LINE_COLOR_RED;
|
|
10
|
+
this.ctx.lineWidth = this.courtTypeConstants.COURT_LINE_WIDTH * 2;
|
|
11
|
+
|
|
12
|
+
const goalLineY =
|
|
13
|
+
this.courtCenter.y - this.courtTypeConstants.NEUTRAL_ZONE_LENGTH - this.courtTypeConstants.END_ZONE_LENGTH;
|
|
14
|
+
|
|
15
|
+
// 1. Draw goal line
|
|
16
|
+
this.ctx.beginPath();
|
|
17
|
+
this.ctx.moveTo(0, goalLineY);
|
|
18
|
+
this.ctx.lineTo(this.courtTypeConstants.COURT_RECT_WIDTH, goalLineY);
|
|
19
|
+
this.ctx.stroke();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = GoalLineLayer;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const InternalCourtLayer = require('../../../base/InternalCourtLayer');
|
|
2
|
+
|
|
3
|
+
const FACE_OFF_SPOT_BLUE_LINE_OFFSET = 5;
|
|
4
|
+
|
|
5
|
+
class NeutralZoneLayer extends InternalCourtLayer {
|
|
6
|
+
reflection() {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
drawLogic() {
|
|
11
|
+
// 1. Draw blue line
|
|
12
|
+
this.ctx.strokeStyle = this.courtTypeConstants.LINE_COLOR_BLUE;
|
|
13
|
+
this.ctx.lineWidth = this.courtTypeConstants.COURT_LINE_WIDTH * 4;
|
|
14
|
+
|
|
15
|
+
const blueLineOrigin = { x: 0.0, y: this.courtCenter.y - this.courtTypeConstants.NEUTRAL_ZONE_LENGTH };
|
|
16
|
+
const blueLineTerminus = {
|
|
17
|
+
x: this.courtTypeConstants.COURT_RECT_WIDTH,
|
|
18
|
+
y: this.courtCenter.y - this.courtTypeConstants.NEUTRAL_ZONE_LENGTH
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
this.ctx.beginPath();
|
|
22
|
+
this.ctx.moveTo(blueLineOrigin.x, blueLineOrigin.y);
|
|
23
|
+
this.ctx.lineTo(blueLineTerminus.x, blueLineTerminus.y);
|
|
24
|
+
this.ctx.stroke();
|
|
25
|
+
|
|
26
|
+
// 2. Draw face off spots
|
|
27
|
+
this.ctx.fillStyle = this.courtTypeConstants.LINE_COLOR_RED;
|
|
28
|
+
|
|
29
|
+
const faceOffOffset =
|
|
30
|
+
(this.courtTypeConstants.COURT_RECT_WIDTH - this.courtTypeConstants.FACE_OFF_SPOTS_DISTANCE) / 2;
|
|
31
|
+
|
|
32
|
+
const faceOffSpotY =
|
|
33
|
+
this.courtCenter.y - this.courtTypeConstants.NEUTRAL_ZONE_LENGTH + FACE_OFF_SPOT_BLUE_LINE_OFFSET;
|
|
34
|
+
|
|
35
|
+
const faceOffSpotLeft = {
|
|
36
|
+
x: faceOffOffset,
|
|
37
|
+
y: faceOffSpotY
|
|
38
|
+
};
|
|
39
|
+
const faceOffSpotRight = {
|
|
40
|
+
x: this.courtTypeConstants.COURT_RECT_WIDTH - faceOffOffset,
|
|
41
|
+
y: faceOffSpotY
|
|
42
|
+
};
|
|
43
|
+
this.ctx.beginPath();
|
|
44
|
+
this.ctx.arc(
|
|
45
|
+
faceOffSpotLeft.x,
|
|
46
|
+
faceOffSpotLeft.y,
|
|
47
|
+
this.courtTypeConstants.FACE_OFF_SPOT_RADIUS,
|
|
48
|
+
0,
|
|
49
|
+
Math.PI * 2,
|
|
50
|
+
true
|
|
51
|
+
);
|
|
52
|
+
this.ctx.fill();
|
|
53
|
+
|
|
54
|
+
this.ctx.beginPath();
|
|
55
|
+
this.ctx.arc(
|
|
56
|
+
faceOffSpotRight.x,
|
|
57
|
+
faceOffSpotRight.y,
|
|
58
|
+
this.courtTypeConstants.FACE_OFF_SPOT_RADIUS,
|
|
59
|
+
0,
|
|
60
|
+
Math.PI * 2,
|
|
61
|
+
true
|
|
62
|
+
);
|
|
63
|
+
this.ctx.fill();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
module.exports = NeutralZoneLayer;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const InternalCourtLayer = require('../../../base/InternalCourtLayer');
|
|
2
|
+
|
|
3
|
+
const REFEREE_CREASE_RADIUS = 10;
|
|
4
|
+
|
|
5
|
+
class RefereeCreaseLayer extends InternalCourtLayer {
|
|
6
|
+
drawLogic() {
|
|
7
|
+
this.ctx.strokeStyle = this.courtTypeConstants.LINE_COLOR_RED;
|
|
8
|
+
this.ctx.lineWidth = this.courtTypeConstants.COURT_LINE_WIDTH * 2;
|
|
9
|
+
|
|
10
|
+
this.ctx.beginPath();
|
|
11
|
+
this.ctx.arc(0, this.courtCenter.y, REFEREE_CREASE_RADIUS, -Math.PI / 2, Math.PI / 2, false);
|
|
12
|
+
this.ctx.stroke();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
module.exports = RefereeCreaseLayer;
|
package/src/models/Play.js
CHANGED
|
@@ -8,7 +8,8 @@ const {
|
|
|
8
8
|
SPORT_TYPE_VOLLEYBALL,
|
|
9
9
|
SPORT_TYPE_FOOTBALL,
|
|
10
10
|
SPORT_TYPE_LACROSSE,
|
|
11
|
-
SPORT_TYPE_SOCCER
|
|
11
|
+
SPORT_TYPE_SOCCER,
|
|
12
|
+
SPORT_TYPE_HOCKEY
|
|
12
13
|
} = require('../constants');
|
|
13
14
|
|
|
14
15
|
const STORAGE_URL = 'https://playbooksstore.blob.core.windows.net/public';
|
|
@@ -29,6 +30,8 @@ class Play {
|
|
|
29
30
|
const hardwoodImage = await loadImage(hardwoodImageData);
|
|
30
31
|
const grassImageData = require('../assets/grass_bg.png');
|
|
31
32
|
const grassImage = await loadImage(grassImageData);
|
|
33
|
+
const iceImageData = require('../assets/ice_bg.png');
|
|
34
|
+
const iceImage = await loadImage(iceImageData);
|
|
32
35
|
|
|
33
36
|
Play.backgroundOptions = {
|
|
34
37
|
Hardwood: hardwoodImage,
|
|
@@ -36,7 +39,8 @@ class Play {
|
|
|
36
39
|
[SPORT_TYPE_VOLLEYBALL]: hardwoodImage,
|
|
37
40
|
[SPORT_TYPE_FOOTBALL]: grassImage,
|
|
38
41
|
[SPORT_TYPE_LACROSSE]: grassImage,
|
|
39
|
-
[SPORT_TYPE_SOCCER]: grassImage
|
|
42
|
+
[SPORT_TYPE_SOCCER]: grassImage,
|
|
43
|
+
[SPORT_TYPE_HOCKEY]: iceImage
|
|
40
44
|
};
|
|
41
45
|
|
|
42
46
|
const luceoSportsWatermark = await loadImage(`${STORAGE_URL}/${LUCEOSPORTS_WATERMARK_PATH}`);
|