added motion detection
This commit is contained in:
parent
8f48b9952e
commit
1618d76db8
@ -11,7 +11,7 @@
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
const CACHE_VERSION = { 'version': '0.0.980' };
|
||||
const CACHE_VERSION = { 'version': '0.0.983' };
|
||||
const PRECACHE = `jubileeData-${CACHE_VERSION.version}`;
|
||||
const RUNTIME = 'runtime';
|
||||
|
||||
|
@ -97,6 +97,15 @@ const LocationModel = Backbone.Model.extend({
|
||||
const motion = this.get('motion');
|
||||
const now = new Date();
|
||||
const ts = now.getTime();
|
||||
|
||||
console.log('a*', JSON.stringify(motion));
|
||||
motion.prev = Object.assign({}, motion.cur);
|
||||
|
||||
motion.cur.lat = latitude;
|
||||
motion.cur.lon = longitude;
|
||||
motion.cur.ts = ts;
|
||||
console.log('b*', JSON.stringify(motion));
|
||||
|
||||
const timeS = (ts - motion.prev.ts) / 1000.0;
|
||||
|
||||
console.log('time dif', timeS);
|
||||
@ -105,14 +114,6 @@ const LocationModel = Backbone.Model.extend({
|
||||
|
||||
console.log('now ts', ts);
|
||||
|
||||
motion.prev = Object.assign({}, motion.cur);
|
||||
console.log('a*', JSON.stringify(motion));
|
||||
|
||||
motion.cur.lat = latitude;
|
||||
motion.cur.lon = longitude;
|
||||
motion.cur.ts = ts;
|
||||
console.log('b*', JSON.stringify(motion));
|
||||
|
||||
const dist = distance(motion.prev.lat, motion.prev.lon, latitude, longitude);
|
||||
console.log('Prev', motion.prev);
|
||||
console.log('Cur', motion.cur);
|
||||
|
Loading…
Reference in New Issue
Block a user