@luceosports/play-rendering 2.2.2 → 2.2.4

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luceosports/play-rendering",
3
- "version": "2.2.2",
3
+ "version": "2.2.4",
4
4
  "main": "dist/play-rendering.js",
5
5
  "types": "dist/play-rendering.d.ts",
6
6
  "scripts": {
@@ -29,16 +29,12 @@ export function shapeModelKeyFromImport(shapeModels: typeof ShapeModels, type: S
29
29
  }
30
30
 
31
31
  export async function loadImage(src: string | Buffer) {
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;
32
+ const img = new Image();
33
+ if (typeof src === 'string') {
34
+ img.src = src;
35
+ } else {
36
+ img.src = 'data:image/jpeg;base64,' + src.toString('base64');
43
37
  }
38
+ await img.decode();
39
+ return img;
44
40
  }
@@ -90,8 +90,9 @@ export default class PlayerLayer extends BaseLayer {
90
90
 
91
91
  drawPlayerPuck(player: PlayerModel) {
92
92
  const { x, y } = player.location;
93
+ const radiusMultiplier = this.options.legacyPrintStyle ? 1.2 : 1;
93
94
  this.ctx.beginPath();
94
- this.ctx.arc(x, y, this.radius, 0, Math.PI * 2, true);
95
+ this.ctx.arc(x, y, radiusMultiplier * this.radius, 0, Math.PI * 2, true);
95
96
  if (this.options.legacyPrintStyle) {
96
97
  if (player.possession) this.ctx.stroke();
97
98
  return;
@@ -123,7 +123,16 @@ export default class PlayModel {
123
123
  };
124
124
 
125
125
  const luceoSportsWatermark = await loadImage(`${STORAGE_URL}/${LUCEOSPORTS_WATERMARK_PATH}`);
126
- const teamLogoWatermark = teamLogoPath ? await loadImage(`${STORAGE_URL}/${teamLogoPath}`) : null;
126
+
127
+ let teamLogoWatermark = null;
128
+ if (teamLogoPath) {
129
+ try {
130
+ teamLogoWatermark = await loadImage(`${STORAGE_URL}/${teamLogoPath}`);
131
+ } catch (e) {
132
+ console.log('teamLogoWatermark loadImage error', e);
133
+ }
134
+ }
135
+
127
136
  PlayModel.watermark = {
128
137
  LuceoSports: luceoSportsWatermark,
129
138
  TeamLogo: teamLogoWatermark