Skip to content

Commit 5e28d4c

Browse files
committed
rename originCoordsProjected to originCoords in gps-projected-camera to ease maintainability
1 parent 5311572 commit 5e28d4c

File tree

4 files changed

+36
-36
lines changed

4 files changed

+36
-36
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,7 +1273,7 @@ function formatDistance(distance) {
12731273

12741274
AFRAME.registerComponent('gps-projected-camera', {
12751275
_watchPositionId: null,
1276-
originCoordsProjected: null, // original coords now in Spherical Mercator
1276+
originCoords: null, // original coords now in Spherical Mercator
12771277
currentCoords: null,
12781278
lookControls: null,
12791279
heading: null,
@@ -1320,7 +1320,7 @@ AFRAME.registerComponent('gps-projected-camera', {
13201320
this.currentCoords = localPosition;
13211321

13221322
// re-trigger initialization for new origin
1323-
this.originCoordsProjected = null;
1323+
this.originCoords = null;
13241324
this._updatePosition();
13251325
}
13261326
},
@@ -1397,7 +1397,7 @@ AFRAME.registerComponent('gps-projected-camera', {
13971397
this.currentCoords
13981398
);
13991399

1400-
if(distMoved >= this.data.gpsMinDistance || !this.originCoordsProjected) {
1400+
if(distMoved >= this.data.gpsMinDistance || !this.originCoords) {
14011401
this._updatePosition();
14021402
this.lastPosition = {
14031403
longitude: this.currentCoords.longitude,
@@ -1503,11 +1503,11 @@ AFRAME.registerComponent('gps-projected-camera', {
15031503
document.body.removeChild(alertPopup);
15041504
}
15051505

1506-
if (!this.originCoordsProjected) {
1506+
if (!this.originCoords) {
15071507
// first camera initialization
1508-
// Now store originCoordsProjected as PROJECTED original lat/lon, so that
1508+
// Now store originCoords as PROJECTED original lat/lon, so that
15091509
// we can set the world origin to the original position in "metres"
1510-
this.originCoordsProjected = this._project(this.currentCoords.latitude, this.currentCoords.longitude);
1510+
this.originCoords = this._project(this.currentCoords.latitude, this.currentCoords.longitude);
15111511
this._setPosition();
15121512

15131513
var loader = document.querySelector('.arjs-loader');
@@ -1536,7 +1536,7 @@ AFRAME.registerComponent('gps-projected-camera', {
15361536
this.el.setAttribute('position', position);
15371537

15381538
// add the sphmerc position to the event (for testing only)
1539-
window.dispatchEvent(new CustomEvent('gps-camera-update-position', { detail: { position: this.currentCoords, origin: this.originCoordsProjected } }));
1539+
window.dispatchEvent(new CustomEvent('gps-camera-update-position', { detail: { position: this.currentCoords, origin: this.originCoords } }));
15401540
},
15411541
/**
15421542
* Returns distance in meters between camera and destination input.
@@ -1580,7 +1580,7 @@ AFRAME.registerComponent('gps-projected-camera', {
15801580
latLonToWorld: function(lat, lon) {
15811581
var projected = this._project(lat, lon);
15821582
// Sign of z needs to be reversed compared to projected coordinates
1583-
return [projected[0] - this.originCoordsProjected[0], -(projected[1] - this.originCoordsProjected[1])];
1583+
return [projected[0] - this.originCoords[0], -(projected[1] - this.originCoords[1])];
15841584
},
15851585
/**
15861586
* Converts latitude/longitude to Spherical Mercator coordinates.
@@ -1713,7 +1713,7 @@ AFRAME.registerComponent('gps-projected-camera', {
17131713

17141714
_onGpsEntityPlaceAdded: function() {
17151715
// if places are added after camera initialization is finished
1716-
if (this.originCoordsProjected) {
1716+
if (this.originCoords) {
17171717
window.dispatchEvent(new CustomEvent('gps-camera-origin-coord-set'));
17181718
}
17191719
if (this.loader && this.loader.parentElement) {

aframe/build/aframe-ar-nft.js

Lines changed: 9 additions & 9 deletions
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: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
AFRAME.registerComponent('gps-projected-camera', {
3333
_watchPositionId: null,
34-
originCoordsProjected: null, // original coords now in Spherical Mercator
34+
originCoords: null, // original coords now in Spherical Mercator
3535
currentCoords: null,
3636
lookControls: null,
3737
heading: null,
@@ -78,7 +78,7 @@ AFRAME.registerComponent('gps-projected-camera', {
7878
this.currentCoords = localPosition;
7979

8080
// re-trigger initialization for new origin
81-
this.originCoordsProjected = null;
81+
this.originCoords = null;
8282
this._updatePosition();
8383
}
8484
},
@@ -155,7 +155,7 @@ AFRAME.registerComponent('gps-projected-camera', {
155155
this.currentCoords
156156
);
157157

158-
if(distMoved >= this.data.gpsMinDistance || !this.originCoordsProjected) {
158+
if(distMoved >= this.data.gpsMinDistance || !this.originCoords) {
159159
this._updatePosition();
160160
this.lastPosition = {
161161
longitude: this.currentCoords.longitude,
@@ -261,11 +261,11 @@ AFRAME.registerComponent('gps-projected-camera', {
261261
document.body.removeChild(alertPopup);
262262
}
263263

264-
if (!this.originCoordsProjected) {
264+
if (!this.originCoords) {
265265
// first camera initialization
266-
// Now store originCoordsProjected as PROJECTED original lat/lon, so that
266+
// Now store originCoords as PROJECTED original lat/lon, so that
267267
// we can set the world origin to the original position in "metres"
268-
this.originCoordsProjected = this._project(this.currentCoords.latitude, this.currentCoords.longitude);
268+
this.originCoords = this._project(this.currentCoords.latitude, this.currentCoords.longitude);
269269
this._setPosition();
270270

271271
var loader = document.querySelector('.arjs-loader');
@@ -294,7 +294,7 @@ AFRAME.registerComponent('gps-projected-camera', {
294294
this.el.setAttribute('position', position);
295295

296296
// add the sphmerc position to the event (for testing only)
297-
window.dispatchEvent(new CustomEvent('gps-camera-update-position', { detail: { position: this.currentCoords, origin: this.originCoordsProjected } }));
297+
window.dispatchEvent(new CustomEvent('gps-camera-update-position', { detail: { position: this.currentCoords, origin: this.originCoords } }));
298298
},
299299
/**
300300
* Returns distance in meters between camera and destination input.
@@ -338,7 +338,7 @@ AFRAME.registerComponent('gps-projected-camera', {
338338
latLonToWorld: function(lat, lon) {
339339
var projected = this._project(lat, lon);
340340
// Sign of z needs to be reversed compared to projected coordinates
341-
return [projected[0] - this.originCoordsProjected[0], -(projected[1] - this.originCoordsProjected[1])];
341+
return [projected[0] - this.originCoords[0], -(projected[1] - this.originCoords[1])];
342342
},
343343
/**
344344
* Converts latitude/longitude to Spherical Mercator coordinates.
@@ -471,7 +471,7 @@ AFRAME.registerComponent('gps-projected-camera', {
471471

472472
_onGpsEntityPlaceAdded: function() {
473473
// if places are added after camera initialization is finished
474-
if (this.originCoordsProjected) {
474+
if (this.originCoords) {
475475
window.dispatchEvent(new CustomEvent('gps-camera-origin-coord-set'));
476476
}
477477
if (this.loader && this.loader.parentElement) {

0 commit comments

Comments
 (0)