Commit cfc9bab4fc428e2e8861ef1b092b3170e95c8d4a
e.coords.lat...
Dominic Tarr committed on 7/8/2017, 1:45:49 AMParent: dec26f6ec81d00aedd3d88a9967ada91e9749814
Files changed
index.js | changed |
index.js | |||
---|---|---|---|
@@ -23,15 +23,18 @@ | |||
23 | 23 … | //keep just one minute's worth of locations. | |
24 | 24 … | if(e.timestamp < Date.now() - 60e3) // one minute | |
25 | 25 … | positions.shift() | |
26 | 26 … | ||
27 … | + var lat = e.coords.latitude, log = e.coords.longitude | ||
27 | 28 … | var movement = positions.map(function (_e) { | |
28 | - _e = _e.coords | ||
29 … | + var _lat = _e.coords.latitude, _log = _e.coords.longitude | ||
29 | 30 … | return { | |
30 | - distance: GreatCircle.distance(_e.latitude, _e.longitude, e.latitude, e.longitude, 'NM'), | ||
31 | - heading: GreatCircle.bearing(_e.latitude, _e.longitude, e.latitude, e.longitude) | ||
31 … | + distance: GreatCircle.distance(_lat, _long, lat, long, 'NM'), | ||
32 … | + heading: GreatCircle.bearing(_lat, _long, lat, long) | ||
32 | 33 … | } | |
33 | 34 … | }) | |
34 | 35 … | ||
35 | 36 … | pre.textContent = JSON.stringify({current: flatten(e), movement: movement}, null, 2) | |
36 | 37 … | }) | |
37 | 38 … | ||
39 … | + | ||
40 … | + |
Built with git-ssb-web