[missions] use a dark yellow for mission layers and highlight the currently selected mission
This commit is contained in:
parent
48481dbae4
commit
02265fe276
@ -79,6 +79,10 @@ window.plugin.missions = {
|
|||||||
// 3 weeks.
|
// 3 weeks.
|
||||||
portalMissionsCacheTime: 21 * 24 * 3600 * 1E3,
|
portalMissionsCacheTime: 21 * 24 * 3600 * 1E3,
|
||||||
|
|
||||||
|
MISSION_COLOR: '#404000',
|
||||||
|
MISSION_COLOR_ACTIVE: '#7f7f00',
|
||||||
|
MISSION_COLOR_START: '#A6A600',
|
||||||
|
|
||||||
SYNC_DELAY: 5000,
|
SYNC_DELAY: 5000,
|
||||||
enableSync: false,
|
enableSync: false,
|
||||||
|
|
||||||
@ -137,7 +141,7 @@ window.plugin.missions = {
|
|||||||
|
|
||||||
showMissionDialog: function(mission) {
|
showMissionDialog: function(mission) {
|
||||||
var me = this;
|
var me = this;
|
||||||
var markers = this.highlightMissionPortals(mission);
|
var markers = this.drawMission(mission);
|
||||||
var content = this.renderMission(mission);
|
var content = this.renderMission(mission);
|
||||||
var id = mission.guid.replace(/\./g, '_'); // dots irritate the dialog framework and are not allowed in HTML IDs
|
var id = mission.guid.replace(/\./g, '_'); // dots irritate the dialog framework and are not allowed in HTML IDs
|
||||||
|
|
||||||
@ -146,6 +150,8 @@ window.plugin.missions = {
|
|||||||
this.tabHeaders[id].parentNode.querySelector('.ui-icon-close').click();
|
this.tabHeaders[id].parentNode.querySelector('.ui-icon-close').click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.tabMarkers[id] = markers;
|
||||||
|
|
||||||
var button = content.insertBefore(document.createElement('button'), content.lastChild);
|
var button = content.insertBefore(document.createElement('button'), content.lastChild);
|
||||||
button.textContent = 'Zoom to mission';
|
button.textContent = 'Zoom to mission';
|
||||||
button.addEventListener('click', function() {
|
button.addEventListener('click', function() {
|
||||||
@ -154,6 +160,8 @@ window.plugin.missions = {
|
|||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
var li = this.tabBar.appendChild(document.createElement('li'));
|
var li = this.tabBar.appendChild(document.createElement('li'));
|
||||||
|
li.dataset['mission_id'] = id;
|
||||||
|
|
||||||
var a = li.appendChild(document.createElement('a'));
|
var a = li.appendChild(document.createElement('a'));
|
||||||
a.textContent = mission.title;
|
a.textContent = mission.title;
|
||||||
a.href = '#mission_pane_'+id;
|
a.href = '#mission_pane_'+id;
|
||||||
@ -162,10 +170,11 @@ window.plugin.missions = {
|
|||||||
span.className = 'ui-icon ui-icon-close';
|
span.className = 'ui-icon ui-icon-close';
|
||||||
span.textContent = 'Close mission';
|
span.textContent = 'Close mission';
|
||||||
span.addEventListener('click', function() {
|
span.addEventListener('click', function() {
|
||||||
this.unhighlightMissionPortals(markers);
|
this.removeMissionLayers(markers);
|
||||||
li.parentNode.removeChild(li);
|
li.parentNode.removeChild(li);
|
||||||
content.parentNode.removeChild(content);
|
content.parentNode.removeChild(content);
|
||||||
delete this.tabHeaders[id];
|
delete this.tabHeaders[id];
|
||||||
|
delete this.tabMarkers[id];
|
||||||
$(this.tabs)
|
$(this.tabs)
|
||||||
.tabs('refresh')
|
.tabs('refresh')
|
||||||
.find('.ui-tabs-nav')
|
.find('.ui-tabs-nav')
|
||||||
@ -188,10 +197,13 @@ window.plugin.missions = {
|
|||||||
html: content,
|
html: content,
|
||||||
width: '450px',
|
width: '450px',
|
||||||
closeCallback: function() {
|
closeCallback: function() {
|
||||||
me.unhighlightMissionPortals(markers);
|
me.removeMissionLayers(markers);
|
||||||
},
|
},
|
||||||
collapseCallback: this.collapseFix,
|
collapseCallback: this.collapseFix,
|
||||||
expandCallback: this.collapseFix,
|
expandCallback: this.collapseFix,
|
||||||
|
focus: function() {
|
||||||
|
me.highlightMissionLayers(markers);
|
||||||
|
}
|
||||||
}).dialog('option', 'buttons', {
|
}).dialog('option', 'buttons', {
|
||||||
'Zoom to mission': function() {
|
'Zoom to mission': function() {
|
||||||
me.zoomToMission(mission);
|
me.zoomToMission(mission);
|
||||||
@ -732,7 +744,7 @@ window.plugin.missions = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
highlightMissionPortals: function(mission) {
|
drawMission: function(mission) {
|
||||||
var markers = [];
|
var markers = [];
|
||||||
var latlngs = [];
|
var latlngs = [];
|
||||||
|
|
||||||
@ -741,7 +753,7 @@ window.plugin.missions = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var radius = window.portals[waypoint.portal.guid] ? window.portals[waypoint.portal.guid].options.radius * 1.5 : 5;
|
var radius = window.portals[waypoint.portal.guid] ? window.portals[waypoint.portal.guid].options.radius * 1.75 : 5;
|
||||||
var ll = [waypoint.portal.latE6 / 1E6, waypoint.portal.lngE6 / 1E6];
|
var ll = [waypoint.portal.latE6 / 1E6, waypoint.portal.lngE6 / 1E6];
|
||||||
latlngs.push(ll);
|
latlngs.push(ll);
|
||||||
|
|
||||||
@ -749,7 +761,7 @@ window.plugin.missions = {
|
|||||||
radius: radius,
|
radius: radius,
|
||||||
weight: 3,
|
weight: 3,
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
color: '#222',
|
color: this.MISSION_COLOR,
|
||||||
fill: false,
|
fill: false,
|
||||||
dashArray: null,
|
dashArray: null,
|
||||||
clickable: false
|
clickable: false
|
||||||
@ -760,7 +772,7 @@ window.plugin.missions = {
|
|||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
var line = L.geodesicPolyline(latlngs, {
|
var line = L.geodesicPolyline(latlngs, {
|
||||||
color: '#222',
|
color: this.MISSION_COLOR,
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
weight: 2,
|
weight: 2,
|
||||||
clickable: false,
|
clickable: false,
|
||||||
@ -771,12 +783,22 @@ window.plugin.missions = {
|
|||||||
return markers;
|
return markers;
|
||||||
},
|
},
|
||||||
|
|
||||||
unhighlightMissionPortals: function(markers) {
|
removeMissionLayers: function(markers) {
|
||||||
markers.forEach(function(marker) {
|
markers.forEach(function(marker) {
|
||||||
this.missionLayer.removeLayer(marker);
|
this.missionLayer.removeLayer(marker);
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
highlightMissionLayers: function(markers) {
|
||||||
|
this.missionLayer.eachLayer(function(layer) {
|
||||||
|
var active = (markers.indexOf(layer) !== -1);
|
||||||
|
layer.setStyle({
|
||||||
|
color: active ? this.MISSION_COLOR_ACTIVE : this.MISSION_COLOR,
|
||||||
|
});
|
||||||
|
if(active) layer.bringToFront();
|
||||||
|
}, this);
|
||||||
|
},
|
||||||
|
|
||||||
onPortalChanged: function(type, guid, oldval) {
|
onPortalChanged: function(type, guid, oldval) {
|
||||||
var portal;
|
var portal;
|
||||||
if (type === 'add' || type === 'update') {
|
if (type === 'add' || type === 'update') {
|
||||||
@ -794,7 +816,7 @@ window.plugin.missions = {
|
|||||||
radius: portal.options.radius + Math.ceil(portal.options.radius / 2),
|
radius: portal.options.radius + Math.ceil(portal.options.radius / 2),
|
||||||
weight: 3,
|
weight: 3,
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
color: '#555',
|
color: this.MISSION_COLOR_START,
|
||||||
fill: false,
|
fill: false,
|
||||||
dashArray: null,
|
dashArray: null,
|
||||||
clickable: false
|
clickable: false
|
||||||
@ -989,9 +1011,18 @@ window.plugin.missions = {
|
|||||||
this.tabs = this.mobilePane.appendChild(document.createElement('div'));
|
this.tabs = this.mobilePane.appendChild(document.createElement('div'));
|
||||||
this.tabBar = this.tabs.appendChild(document.createElement('ul'));
|
this.tabBar = this.tabs.appendChild(document.createElement('ul'));
|
||||||
this.tabHeaders = {};
|
this.tabHeaders = {};
|
||||||
|
this.tabMarkers = {};
|
||||||
|
|
||||||
$(this.tabs)
|
$(this.tabs)
|
||||||
.tabs()
|
.tabs({
|
||||||
|
activate: function(event, ui) {
|
||||||
|
if(!ui.newTab) return;
|
||||||
|
|
||||||
|
var header = $(ui.newTab)[0];
|
||||||
|
var id = header.dataset['mission_id'];
|
||||||
|
this.highlightMissionLayers(this.tabMarkers[id]);
|
||||||
|
}.bind(this),
|
||||||
|
})
|
||||||
.find('.ui-tabs-nav').sortable({
|
.find('.ui-tabs-nav').sortable({
|
||||||
axis: 'x',
|
axis: 'x',
|
||||||
stop: function() {
|
stop: function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user