@luceosports/play-rendering 2.2.0 → 2.2.2
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
package/src/helpers/common.ts
CHANGED
|
@@ -29,12 +29,16 @@ export function shapeModelKeyFromImport(shapeModels: typeof ShapeModels, type: S
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export async function loadImage(src: string | Buffer) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
try {
|
|
33
|
+
const img = new Image();
|
|
34
|
+
if (typeof src === 'string') {
|
|
35
|
+
img.src = src;
|
|
36
|
+
} else {
|
|
37
|
+
img.src = 'data:image/jpeg;base64,' + src.toString('base64');
|
|
38
|
+
}
|
|
39
|
+
await img.decode();
|
|
40
|
+
return img;
|
|
41
|
+
} catch (e) {
|
|
42
|
+
return null;
|
|
37
43
|
}
|
|
38
|
-
await img.decode();
|
|
39
|
-
return img;
|
|
40
44
|
}
|
|
@@ -162,8 +162,8 @@ export default class PlayerLayer extends BaseLayer {
|
|
|
162
162
|
.join('')
|
|
163
163
|
.slice(0, 2);
|
|
164
164
|
playerTextLabel = teamPlayer.Initials || fallbackLabel;
|
|
165
|
-
if (this.options.labelsOverrideType === 'Jersey number') {
|
|
166
|
-
playerTextLabel = `${teamPlayer.jersey_number}
|
|
165
|
+
if (this.options.labelsOverrideType === 'Jersey number' && teamPlayer.jersey_number) {
|
|
166
|
+
playerTextLabel = `${teamPlayer.jersey_number}`;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
}
|