@luceosports/play-rendering 2.0.4 → 2.0.5
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/package.json
CHANGED
|
@@ -90,8 +90,12 @@ 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;
|
|
93
97
|
this.ctx.beginPath();
|
|
94
|
-
this.ctx.arc(x, y,
|
|
98
|
+
this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
|
|
95
99
|
if (this.options.legacyPrintStyle) {
|
|
96
100
|
if (player.possession) this.ctx.stroke();
|
|
97
101
|
return;
|
|
@@ -105,6 +109,11 @@ export default class PlayerLayer extends BaseLayer {
|
|
|
105
109
|
if (this.staticData.playerHeadshots && this.options.labelsOverrideType === 'Headshot') {
|
|
106
110
|
const playerMapItem = this.options.playersMap.find(item => item.position === player.position);
|
|
107
111
|
const headshotImage = this.staticData.playerHeadshots.find(item => item.id === playerMapItem?.teamPlayerId);
|
|
112
|
+
|
|
113
|
+
this.ctx.save();
|
|
114
|
+
|
|
115
|
+
this.ctx.translate(x, y);
|
|
116
|
+
|
|
108
117
|
if (headshotImage) {
|
|
109
118
|
const imageVertical = headshotImage.image.width < headshotImage.image.height;
|
|
110
119
|
const imageHorizontal = headshotImage.image.height < headshotImage.image.width;
|
|
@@ -123,17 +132,22 @@ export default class PlayerLayer extends BaseLayer {
|
|
|
123
132
|
const topLeftX = 0 - (imageHorizontal ? dw / 2 : this.radius);
|
|
124
133
|
const topLeftY = 0 - (imageVertical ? dh / 2 : this.radius);
|
|
125
134
|
|
|
126
|
-
this.ctx.save();
|
|
127
|
-
this.ctx.translate(x, y);
|
|
128
135
|
if (this.options.flipPlayerLabels) {
|
|
129
136
|
this.ctx.rotate(Math.PI);
|
|
130
137
|
}
|
|
131
138
|
this.ctx.arc(0, 0, this.radius, 0, Math.PI * 2, true);
|
|
132
139
|
this.ctx.clip();
|
|
133
140
|
this.ctx.drawImage(headshotImage.image, topLeftX, topLeftY, dw, dh);
|
|
134
|
-
this.ctx.restore();
|
|
135
|
-
return;
|
|
136
141
|
}
|
|
142
|
+
|
|
143
|
+
this.ctx.beginPath();
|
|
144
|
+
this.ctx.lineWidth = this.courtTypeConstants.LINE_WIDTH;
|
|
145
|
+
this.ctx.arc(0, 0, this.radius, 0, Math.PI * 2, true);
|
|
146
|
+
this.ctx.stroke();
|
|
147
|
+
|
|
148
|
+
this.ctx.restore();
|
|
149
|
+
|
|
150
|
+
if (headshotImage) return;
|
|
137
151
|
}
|
|
138
152
|
|
|
139
153
|
const { alpha } = player.color;
|