diff --git a/aframe/examples/new-location-based/show-distance/clicker.js b/aframe/examples/new-location-based/show-distance/clicker.js index 93fc2ffc..078346d2 100644 --- a/aframe/examples/new-location-based/show-distance/clicker.js +++ b/aframe/examples/new-location-based/show-distance/clicker.js @@ -1,9 +1,8 @@ -/* AFRAME.registerComponent("clicker", { init: function() { this.el.addEventListener("click", e=> { - alert(this.el.components["gps-new-entity-place"].distance); + const dist = this.el.components["gps-new-entity-place"].distance; + alert(dist === undefined ? "Please move to a new location to obtain the distance" : `This object is ${dist} metres away.`); }); } }); -*/ diff --git a/aframe/examples/new-location-based/show-distance/index.js b/aframe/examples/new-location-based/show-distance/index.js index 31402741..1448b8da 100644 --- a/aframe/examples/new-location-based/show-distance/index.js +++ b/aframe/examples/new-location-based/show-distance/index.js @@ -1,12 +1,3 @@ -AFRAME.registerComponent("clicker", { - init: function() { - this.el.addEventListener("click", e=> { - const dist = this.el.components["gps-new-entity-place"].distance; - alert(dist === undefined ? "Please move to a new location to obtain the distance" : `This object is ${dist} metres away.`); - }); - } -}); - window.onload = () => { let testEntitiesAdded = false; alert('If testing the lat/lon manual input on a mobile device, please turn off your GPS to avoid the real location being detected.');