Skip to content

Commit e837cfc

Browse files
committed
Add control of maximumAge to gps-new-camera and three location-based
1 parent b1e0631 commit e837cfc

File tree

7 files changed

+18
-7
lines changed

7 files changed

+18
-7
lines changed

aframe/build/aframe-ar-new-location-only.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aframe/build/aframe-ar-nft.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aframe/build/aframe-ar.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aframe/src/new-location-based/gps-new-camera.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ AFRAME.registerComponent("gps-new-camera", {
2121
},
2222
positionMinAccuracy: {
2323
type: "number",
24-
default: 1000,
24+
default: 100,
25+
},
26+
gpsTimeInterval: {
27+
type: "number",
28+
default: 0,
2529
},
2630
},
2731

@@ -71,6 +75,7 @@ AFRAME.registerComponent("gps-new-camera", {
7175
this.threeLoc.setGpsOptions({
7276
gpsMinAccuracy: this.data.positionMinAccuracy,
7377
gpsMinDistance: this.data.gpsMinDistance,
78+
maximumAge: this.data.gpsTimeInterval,
7479
});
7580
if (
7681
(this.data.simulateLatitude !== 0 || this.data.simulateLongitude !== 0) &&

aframe/src/new-location-based/gps-new-entity-place.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as THREE from "three";
12
import * as AFRAME from "aframe";
23

34
AFRAME.registerComponent("gps-new-entity-place", {
@@ -13,6 +14,7 @@ AFRAME.registerComponent("gps-new-entity-place", {
1314
},
1415

1516
init: function () {
17+
this.distance = Number.MAX_VALUE;
1618
const camera = document.querySelector("[gps-new-camera]");
1719
if (!camera.components["gps-new-camera"]) {
1820
console.error("gps-new-camera not initialised");

three.js/build/ar-threex-location-only.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

three.js/src/location-based/js/location-based.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ class LocationBased {
99
this._eventHandlers = {};
1010
this._lastCoords = null;
1111
this._gpsMinDistance = 0;
12-
this._gpsMinAccuracy = 1000;
12+
this._gpsMinAccuracy = 100;
13+
this._maximumAge = 0;
1314
this._watchPositionId = null;
1415
this.setGpsOptions(options);
1516
}
@@ -25,6 +26,9 @@ class LocationBased {
2526
if (options.gpsMinAccuracy !== undefined) {
2627
this._gpsMinAccuracy = options.gpsMinAccuracy;
2728
}
29+
if (options.maximumAge !== undefined) {
30+
this._maximumAge = options.maximumAge;
31+
}
2832
}
2933

3034
startGps(maximumAge = 0) {
@@ -42,7 +46,7 @@ class LocationBased {
4246
},
4347
{
4448
enableHighAccuracy: true,
45-
maximumAge: maximumAge,
49+
maximumAge: maximumAge != 0 ? maximumAge : this._maximumAge,
4650
}
4751
);
4852
return true;

0 commit comments

Comments
 (0)