@wemap/camera 10.0.0-alpha.7 → 10.0.0
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 +3 -3
- package/src/Camera.js +4 -0
- package/src/CameraUtils.js +5 -1
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"directory": "packages/camera"
|
|
13
13
|
},
|
|
14
14
|
"name": "@wemap/camera",
|
|
15
|
-
"version": "10.0.0
|
|
15
|
+
"version": "10.0.0",
|
|
16
16
|
"bugs": {
|
|
17
17
|
"url": "https://github.com/wemap/wemap-modules-js/issues"
|
|
18
18
|
},
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
],
|
|
25
25
|
"license": "ISC",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@wemap/logger": "^
|
|
27
|
+
"@wemap/logger": "^10.0.0",
|
|
28
28
|
"@zxing/library": "^0.18.4",
|
|
29
29
|
"events": "^3.3.0"
|
|
30
30
|
},
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"@types/events": "^3.0.0"
|
|
33
33
|
},
|
|
34
34
|
"type": "module",
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "dabdfdf7dbb6dcdf507ec148160ef228457b0519"
|
|
36
36
|
}
|
package/src/Camera.js
CHANGED
|
@@ -239,6 +239,10 @@ class Camera extends EventEmitter {
|
|
|
239
239
|
|
|
240
240
|
_computeFov = () => {
|
|
241
241
|
|
|
242
|
+
if ([Camera.State.STOPPING, Camera.State.STOPPED].includes(this.state)) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
|
|
242
246
|
this.fov = calcDisplayedFov(
|
|
243
247
|
this.videoContainer,
|
|
244
248
|
this.videoElement,
|
package/src/CameraUtils.js
CHANGED
|
@@ -11,13 +11,17 @@ export function convertFov(angle, aspectRatio) {
|
|
|
11
11
|
* @param {HTMLDivElement} videoContainer
|
|
12
12
|
* @param {HTMLVideoElement} videoElement
|
|
13
13
|
* @param {number} hardwareVerticalFov
|
|
14
|
-
* @returns {object}
|
|
14
|
+
* @returns {object|null}
|
|
15
15
|
*/
|
|
16
16
|
export function calcDisplayedFov(videoContainer, videoElement, hardwareVerticalFov) {
|
|
17
17
|
|
|
18
18
|
const sourceWidth = videoElement.videoWidth;
|
|
19
19
|
const sourceHeight = videoElement.videoHeight;
|
|
20
20
|
|
|
21
|
+
if (!sourceWidth || !sourceHeight) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
const containerWidth = videoContainer.offsetWidth;
|
|
22
26
|
const containerHeight = videoContainer.offsetHeight;
|
|
23
27
|
|