mirror of
https://github.com/Ekokumppanit/Bicyclesim.git
synced 2026-02-25 04:51:06 +00:00
Stom moving after leaving sim page.
This commit is contained in:
@@ -129,7 +129,7 @@ Template.editing.owner = function () {
|
|||||||
return user.profile.name;
|
return user.profile.name;
|
||||||
};
|
};
|
||||||
|
|
||||||
init_edit = function init_edit() {
|
window.init_edit = function init_edit() {
|
||||||
|
|
||||||
Meteor.autorun(function () {
|
Meteor.autorun(function () {
|
||||||
if (Session.equals('page', 'edit') && Session.get('route')) {
|
if (Session.equals('page', 'edit') && Session.get('route')) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
maps_loaded = function maps_loaded() {
|
window.maps_loaded = function maps_loaded() {
|
||||||
|
|
||||||
window.markers = []; // fuu
|
window.markers = []; // fuu
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ Meteor.startup(function () {
|
|||||||
Backbone.history.start({pushState: true});
|
Backbone.history.start({pushState: true});
|
||||||
});
|
});
|
||||||
|
|
||||||
init_main = function init_main() {
|
window.init_main = function init_main() {
|
||||||
Meteor.autosubscribe(function () {
|
Meteor.autosubscribe(function () {
|
||||||
// When changing page
|
// When changing page
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ window.point = null;
|
|||||||
window.traveled = 0;
|
window.traveled = 0;
|
||||||
|
|
||||||
function move () {
|
function move () {
|
||||||
if (!window.point) return;
|
|
||||||
|
|
||||||
// var dist = localStorage['multiplier'] * c();
|
// var dist = localStorage['multiplier'] * c();
|
||||||
var dist = localStorage['multiplier'] * 0.1 * Session.get('speed');
|
var dist = localStorage['multiplier'] * 0.1 * Session.get('speed');
|
||||||
Session.set('distance', Session.get('distance') + dist);
|
Session.set('distance', Session.get('distance') + dist);
|
||||||
@@ -22,14 +20,13 @@ function move () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setInterval(move, 100);
|
|
||||||
|
|
||||||
var line = '';
|
var line = '';
|
||||||
$(document).on('keydown', function (e) {
|
$(document).on('keydown', function (e) {
|
||||||
if (e.keyCode === 13) { // enter
|
if (e.keyCode === 13) { // enter
|
||||||
if (line.length >= 1 && line[0] == 'S') {
|
if (line.length >= 1 && line[0] == 'S') {
|
||||||
var speed = Number(line.slice(1));
|
var speed = Number(line.slice(1));
|
||||||
Session.set('speed', speed);
|
Session.set('speed', speed);
|
||||||
|
$('.speedSlider').slider('value', speed);
|
||||||
}
|
}
|
||||||
line = '';
|
line = '';
|
||||||
} else {
|
} else {
|
||||||
@@ -54,8 +51,9 @@ Template.sim.helpers({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
init_sim = function init_sim() {
|
window.init_sim = function init_sim() {
|
||||||
|
|
||||||
|
var i;
|
||||||
Meteor.autosubscribe(function () {
|
Meteor.autosubscribe(function () {
|
||||||
if (Session.equals('page', 'sim')) {
|
if (Session.equals('page', 'sim')) {
|
||||||
var route = Routes.findOne({_id: Session.get('route')});
|
var route = Routes.findOne({_id: Session.get('route')});
|
||||||
@@ -76,6 +74,8 @@ Meteor.autosubscribe(function () {
|
|||||||
maps.lines.route.add(p.latlng);
|
maps.lines.route.add(p.latlng);
|
||||||
p = Points.findOne({_id: p.next});
|
p = Points.findOne({_id: p.next});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i = setInterval(move, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.speedSlider').slider({
|
$('.speedSlider').slider({
|
||||||
@@ -88,6 +88,8 @@ Meteor.autosubscribe(function () {
|
|||||||
Session.set('speed', ui.value);
|
Session.set('speed', ui.value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
i = clearInterval(i);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user