[missions] add button to fit the mission onto the map and to open the mission creator
This commit is contained in:
parent
2933f596e9
commit
212b980683
@ -146,6 +146,11 @@ window.plugin.missions = {
|
||||
},
|
||||
collapseCallback: this.collapseFix,
|
||||
expandCallback: this.collapseFix
|
||||
}).dialog('option', 'buttons', {
|
||||
'Zoom to mission': function() {
|
||||
me.zoomToMission(mission);
|
||||
},
|
||||
'OK': function() { $(this).dialog('close'); },
|
||||
});
|
||||
},
|
||||
|
||||
@ -155,7 +160,10 @@ window.plugin.missions = {
|
||||
height: 'auto',
|
||||
width: '400px',
|
||||
collapseCallback: this.collapseFix,
|
||||
expandCallback: this.collapseFix
|
||||
expandCallback: this.collapseFix,
|
||||
}).dialog('option', 'buttons', {
|
||||
'Create new mission': function() { open('//mission-author-dot-betaspike.appspot.com'); },
|
||||
'OK': function() { $(this).dialog('close'); },
|
||||
});
|
||||
},
|
||||
|
||||
@ -165,6 +173,16 @@ window.plugin.missions = {
|
||||
}
|
||||
},
|
||||
|
||||
zoomToMission: function(mission) {
|
||||
var latlngs = mission.waypoints.filter(function(waypoint) {
|
||||
return !!waypoint.portal;
|
||||
}).map(function(waypoint) {
|
||||
return [waypoint.portal.latE6/1E6, waypoint.portal.lngE6/1E6];
|
||||
});
|
||||
|
||||
map.fitBounds(L.latLngBounds(latlngs), {maxZoom: 17});
|
||||
},
|
||||
|
||||
loadMissionsInBounds: function(bounds, callback, errorcallback) {
|
||||
var me = this;
|
||||
window.postAjax('getTopMissionsInBounds', {
|
||||
|
Loading…
x
Reference in New Issue
Block a user