Skip to content

Commit

Permalink
Merge pull request #560 from AR-js-org/issue500
Browse files Browse the repository at this point in the history
Allow real GPS position to be used, even after fake GPS has been set
  • Loading branch information
nickw1 committed Aug 28, 2023
2 parents 8609ac9 + b069f2a commit 0259764
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion aframe/build/aframe-ar-new-location-only.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion aframe/build/aframe-ar-nft.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion aframe/build/aframe-ar.js

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions aframe/src/new-location-based/gps-new-camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ AFRAME.registerComponent("gps-new-camera", {
init: function () {
this._testForOrientationControls();

this.fakeGpsStarted = false;

this.threeLoc = new THREEx.LocationBased(
this.el.sceneEl.object3D,
this.el.object3D,
Expand Down Expand Up @@ -96,6 +98,7 @@ AFRAME.registerComponent("gps-new-camera", {
maximumAge: this.data.gpsTimeInterval,
});
if (
!this.fakeGpsStarted &&
(this.data.simulateLatitude !== 0 || this.data.simulateLongitude !== 0) &&
(this.data.simulateLatitude != oldData.simulateLatitude ||
this.data.simulateLongitude != oldData.simulateLongitude)
Expand All @@ -105,8 +108,7 @@ AFRAME.registerComponent("gps-new-camera", {
this.data.simulateLongitude,
this.data.simulateLatitude
);
this.data.simulateLatitude = 0;
this.data.simulateLongitude = 0;
this.fakeGpsStarted = true;
}
if (this.data.simulateAltitude > -Number.MAX_VALUE) {
this.threeLoc.setElevation(this.data.simulateAltitude + 1.6);
Expand Down

0 comments on commit 0259764

Please sign in to comment.