Skip to content

Commit

Permalink
Add botPath setting to userdata config file (#112)
Browse files Browse the repository at this point in the history
* Add botPath setting to userdata config file

* Enable drawing on load
  • Loading branch information
RolfKoenders authored and Max Leiter committed Jul 30, 2016
1 parent 259bee6 commit 6294ffb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
5 changes: 3 additions & 2 deletions config/userdata.js.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ var userInfo = {
userZoom: true,
zoom: 16,
userFollow: true,
gMapsAPIKey: "YOUR_API_KEY_HERE"
};
gMapsAPIKey: "YOUR_API_KEY_HERE",
botPath: true
};
22 changes: 14 additions & 8 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,19 @@ var mapView = {
});
});
},
setBotPathOptions: function(checked) {
var self = this;
for (var i = 0; i < self.settings.users.length; i++) {
self.user_data[self.settings.users[i]].trainerPath.setOptions({
strokeOpacity: checked ? 1.0 : 0.0
});
}
},
bindUi: function() {
var self = this;
$('#switchPan').prop('checked', self.settings.userFollow);
$('#switchZoom').prop('checked', self.settings.userZoom);
$('#strokeOn').prop('checked', false);
$('#strokeOn').prop('checked', self.settings.botPath);

$('#switchPan').change(function() {
if (this.checked) {
Expand All @@ -149,11 +157,8 @@ var mapView = {
});

$('#strokeOn').change(function() {
for (var i = 0; i < self.settings.users.length; i++) {
self.user_data[self.settings.users[i]].trainerPath.setOptions({
strokeOpacity: this.checked ? 1.0 : 0.0
});
}
self.settings.botPath = this.checked;
self.setBotPathOptions(this.checked);
});

$('#optionsButton').click(function() {
Expand Down Expand Up @@ -800,6 +805,7 @@ var mapView = {
} else {
self.user_data[self.settings.users[user_index]].trainerPath.setPath(self.pathcoords[self.settings.users[user_index]]);
}
self.setBotPathOptions(self.settings.botPath);
}
if (self.settings.users.length === 1 && self.settings.userZoom === true) {
self.map.setZoom(self.settings.zoom);
Expand Down Expand Up @@ -833,7 +839,7 @@ var mapView = {
xhr.open('GET', path, true);
xhr.send();
},

/*
loadJSON: function(path, success, error, successData) {
$.getJSON({
Expand All @@ -848,7 +854,7 @@ var mapView = {
});
},
*/

// Adds events to log panel and if it's closed sends Toast
log: function(log_object) {
var currentDate = new Date();
Expand Down

0 comments on commit 6294ffb

Please sign in to comment.