@wemap/providers 6.1.1 → 6.1.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
@@ -12,7 +12,7 @@
12
12
  "@wemap/geo": "^6.0.0",
13
13
  "@wemap/geomagnetism": "^0.1.1",
14
14
  "@wemap/logger": "^6.0.0",
15
- "@wemap/map": "^6.0.2",
15
+ "@wemap/map": "^6.1.2",
16
16
  "@wemap/maths": "^6.0.0",
17
17
  "@wemap/osm": "^6.0.0",
18
18
  "@wemap/utils": "^6.0.0"
@@ -40,6 +40,6 @@
40
40
  "url": "git+https://github.com/wemap/wemap-modules-js.git"
41
41
  },
42
42
  "type": "module",
43
- "version": "6.1.1",
44
- "gitHead": "b3cb15c80ce9428bcffa00c946d63fd71688a384"
43
+ "version": "6.1.2",
44
+ "gitHead": "ffb6fe1f940d915e839024bc5b9aa5a986ad88a9"
45
45
  }
@@ -104,7 +104,7 @@ class Vps extends Provider {
104
104
  camera.on('started', this._internalStart);
105
105
  camera.on('stopped', this._internalStop);
106
106
 
107
- if (camera.isStarted) {
107
+ if (camera.state === Camera.State.STARTED) {
108
108
  this._internalStart();
109
109
  }
110
110
  }
@@ -114,13 +114,13 @@ class Vps extends Provider {
114
114
 
115
115
  this._serverError = false;
116
116
 
117
- let lastTimestamp = -1;
118
-
119
117
  while (this.state !== ProviderState.STOPPPED) {
120
118
 
121
- const diffTime = TimeUtils.preciseTime() - lastTimestamp;
122
- const timeToWait = Math.max(0, Vps.MIN_TIME_BETWEEN_TWO_REQUESTS - diffTime);
123
- await new Promise(resolve => setTimeout(resolve, timeToWait));
119
+ if (this.lastEvent) {
120
+ const diffTime = TimeUtils.preciseTime() - this.lastEvent.data.time * 1e3;
121
+ const timeToWait = Math.max(0, Vps.MIN_TIME_BETWEEN_TWO_REQUESTS - diffTime);
122
+ await new Promise(resolve => setTimeout(resolve, timeToWait));
123
+ }
124
124
 
125
125
  if (this.state === ProviderState.STOPPPED) {
126
126
  break;
@@ -159,8 +159,6 @@ class Vps extends Provider {
159
159
  if (events.length) {
160
160
  this.notify(...events);
161
161
  }
162
-
163
- lastTimestamp = TimeUtils.preciseTime();
164
162
  }
165
163
 
166
164
  if (this.state !== ProviderState.STOPPPED) {
@@ -182,7 +180,7 @@ class Vps extends Provider {
182
180
 
183
181
  // Retrieve the image
184
182
  const image = await camera.currentImage;
185
- const time = TimeUtils.preciseTime();
183
+ const time = TimeUtils.preciseTime() / 1e3;
186
184
  // TODO: move the grayscale conversion in the currentImage getter
187
185
  CameraUtils.convertToGrayscale(image);
188
186
  const reducedImage = CameraUtils.reduceImageSize(image, 1280);