mobility-toolbox-js 1.7.8 → 1.7.10-beta.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.
@@ -272,7 +272,9 @@ const TrackerLayerMixin = (Base) =>
272
272
  * Id of the selected vehicle.
273
273
  */
274
274
  pixelRatio: {
275
- value: pixelRatio || window.devicePixelRatio || 1,
275
+ value:
276
+ pixelRatio ||
277
+ (typeof window !== 'undefined' ? window.devicePixelRatio : 1),
276
278
  writable: true,
277
279
  },
278
280
 
@@ -535,7 +537,6 @@ const TrackerLayerMixin = (Base) =>
535
537
  trajectories.sort(this.sort);
536
538
  }
537
539
  // console.timeEnd('sort');
538
- window.trajectories = trajectories;
539
540
 
540
541
  // console.time('render');
541
542
  this.renderState = this.tracker.renderTrajectories(
@@ -2,17 +2,21 @@
2
2
  * A very simple tracker style.
3
3
  * Display blue point for each train.
4
4
  */
5
- const canvas = document.createElement('canvas');
6
- canvas.width = 15;
7
- canvas.height = 15;
8
- const ctx = canvas.getContext('2d');
9
- ctx.arc(8, 8, 5, 0, 2 * Math.PI, false);
10
- ctx.fillStyle = '#8ED6FF';
11
- ctx.fill();
12
- ctx.lineWidth = 3;
13
- ctx.strokeStyle = 'black';
14
- ctx.stroke();
15
- ctx.lineWidth = 3;
16
-
17
- const style = () => canvas;
5
+ let canvas;
6
+ const style = () => {
7
+ if (!canvas) {
8
+ document.createElement('canvas');
9
+ canvas.width = 15;
10
+ canvas.height = 15;
11
+ const ctx = canvas.getContext('2d');
12
+ ctx.arc(8, 8, 5, 0, 2 * Math.PI, false);
13
+ ctx.fillStyle = '#8ED6FF';
14
+ ctx.fill();
15
+ ctx.lineWidth = 3;
16
+ ctx.strokeStyle = 'black';
17
+ ctx.stroke();
18
+ ctx.lineWidth = 3;
19
+ }
20
+ return canvas;
21
+ };
18
22
  export default style;