Skip to content

Commit d1e98d3

Browse files
committed
Start and stop GPS listening in play() and pause() (issue #174)
1 parent c5f22b9 commit d1e98d3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ AFRAME.registerComponent('gps-camera', {
112112

113113
window.addEventListener(eventName, this._onDeviceOrientation, false);
114114

115+
},
116+
117+
play: function() {
115118
this._watchPositionId = this._initWatchGPS(function (position) {
116119
var localPosition = {
117120
latitude: position.coords.latitude,
@@ -155,11 +158,14 @@ AFRAME.registerComponent('gps-camera', {
155158
this._updateRotation();
156159
},
157160

158-
remove: function () {
161+
pause: function() {
159162
if (this._watchPositionId) {
160163
navigator.geolocation.clearWatch(this._watchPositionId);
161164
}
162165
this._watchPositionId = null;
166+
},
167+
168+
remove: function () {
163169

164170
var eventName = this._getDeviceOrientationEventName();
165171
window.removeEventListener(eventName, this._onDeviceOrientation, false);

0 commit comments

Comments
 (0)