diff --git a/aframe/build/aframe-ar.js b/aframe/build/aframe-ar.js
index a9c189b4451b22a13a9bd513f3cf611545643aeb..7881f4ac27a617a109dcc61714699396d3f6fc59 100644
--- a/aframe/build/aframe-ar.js
+++ b/aframe/build/aframe-ar.js
@@ -8733,7 +8733,7 @@ AFRAME.registerComponent('gps-camera', {
minDistance: {
type: 'int',
default: 0,
- }
+ },
},
init: function () {
@@ -8772,6 +8772,9 @@ AFRAME.registerComponent('gps-camera', {
window.addEventListener(eventName, this._onDeviceOrientation, false);
+ window.dispatchEvent(new CustomEvent('gps-camera-ready'));
+ console.debug('gps-camera-ready');
+
this._watchPositionId = this._initWatchGPS(function (position) {
this.currentCoords = position.coords;
this._updatePosition();
@@ -9020,6 +9023,10 @@ AFRAME.registerComponent('gps-entity-place', {
},
},
init: function () {
+ window.addEventListener('gps-camera-ready', () => {
+ this._updatePosition();
+ });
+
this._positionXDebug = 0;
this.debugUIAddedHandler = function () {
@@ -9041,8 +9048,6 @@ AFRAME.registerComponent('gps-entity-place', {
return;
}
- this._updatePosition();
- return true;
},
/**
diff --git a/aframe/examples/only-html/index.html b/aframe/examples/only-html/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..b960e06b925101b96709b9c1cc87f195e71da6c8
--- /dev/null
+++ b/aframe/examples/only-html/index.html
@@ -0,0 +1,31 @@
+
+
+
+
+
+ GeoAR.js demo
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/aframe/examples/places-name/places.js b/aframe/examples/places-name/places.js
index 55c3422598f2ee612bdb74d264b0184e864a73ab..ad0b2483ff3eb6c4d1cc34813762d596a4d9f1a6 100644
--- a/aframe/examples/places-name/places.js
+++ b/aframe/examples/places-name/places.js
@@ -2,36 +2,33 @@
window.onload = () => {
let method = 'dynamic';
- // if you want to statically add places, de-comment following line
- // method = 'static';
-
- if (method === 'static') {
- // setTimeout is a temporary fix
- setTimeout(() => {
+ window.addEventListener('gps-camera-ready', () => {
+ // if you want to statically add places, de-comment following line:
+ method = 'static';
+ if (method === 'static') {
let places = staticLoadPlaces();
- renderPlaces(places);
- }, 3000);
- }
-
- if (method !== 'static') {
+ return renderPlaces(places);
+ }
- // first get current user location
- return navigator.geolocation.getCurrentPosition(function (position) {
+ if (method !== 'static') {
+ // first get current user location
+ return navigator.geolocation.getCurrentPosition(function (position) {
- // than use it to load from remote APIs some places nearby
- dynamicLoadPlaces(position.coords)
- .then((places) => {
- renderPlaces(places);
- })
- },
- (err) => console.error('Error in retrieving position', err),
- {
- enableHighAccuracy: true,
- maximumAge: 0,
- timeout: 27000,
- }
- );
- }
+ // than use it to load from remote APIs some places nearby
+ dynamicLoadPlaces(position.coords)
+ .then((places) => {
+ renderPlaces(places);
+ })
+ },
+ (err) => console.error('Error in retrieving position', err),
+ {
+ enableHighAccuracy: true,
+ maximumAge: 0,
+ timeout: 27000,
+ }
+ );
+ }
+ });
};
function staticLoadPlaces() {
@@ -39,17 +36,10 @@ function staticLoadPlaces() {
{
name: "Your place name",
location: {
- lat: 0, // add here latitude if using static data
- lng: 0, // add here longitude if using static data
+ lat: 44.496470, // change here latitude if using static data
+ lng: 11.320220, // change here longitude if using static data
}
},
- {
- name: 'Another place name',
- location: {
- lat: 0,
- lng: 0,
- }
- }
];
}
diff --git a/aframe/src/location-based/gps-camera.js b/aframe/src/location-based/gps-camera.js
index 9b332fbfd30ba743b96f7a3cb1e3c10409589d5f..e0da862155cb79b9366e4c3ecbe5d21ab1110902 100644
--- a/aframe/src/location-based/gps-camera.js
+++ b/aframe/src/location-based/gps-camera.js
@@ -17,7 +17,7 @@ AFRAME.registerComponent('gps-camera', {
minDistance: {
type: 'int',
default: 0,
- }
+ },
},
init: function () {
@@ -56,6 +56,9 @@ AFRAME.registerComponent('gps-camera', {
window.addEventListener(eventName, this._onDeviceOrientation, false);
+ window.dispatchEvent(new CustomEvent('gps-camera-ready'));
+ console.debug('gps-camera-ready');
+
this._watchPositionId = this._initWatchGPS(function (position) {
this.currentCoords = position.coords;
this._updatePosition();
diff --git a/aframe/src/location-based/gps-entity-place.js b/aframe/src/location-based/gps-entity-place.js
index ca4edbb65e1304ff2b7aa7c95ae2cf50a8e2685e..d60c772e784fff561fc2334f0814189bcc7ef2ad 100644
--- a/aframe/src/location-based/gps-entity-place.js
+++ b/aframe/src/location-based/gps-entity-place.js
@@ -11,6 +11,10 @@ AFRAME.registerComponent('gps-entity-place', {
},
},
init: function () {
+ window.addEventListener('gps-camera-ready', () => {
+ this._updatePosition();
+ });
+
this._positionXDebug = 0;
this.debugUIAddedHandler = function () {
@@ -32,8 +36,6 @@ AFRAME.registerComponent('gps-entity-place', {
return;
}
- this._updatePosition();
- return true;
},
/**