ensure we don't break for artifacts without jarvis data (e.g. a future artifact type)

make shard marker semi-transparent - avoids the harsh white outline and makes the underlying portal and it's colour partly visible
This commit is contained in:
Jon Atkins 2013-11-20 06:20:30 +00:00
parent 2e16a001b9
commit 08b7a5ec6f

View File

@ -176,18 +176,22 @@ window.artifact.updateLayer = function() {
// jarvis shard icon // jarvis shard icon
var iconUrl = undefined; var iconUrl = undefined;
var iconSize = 0; var iconSize = 0;
var opacity = 1.0;
if (data.jarvis.fragments) { if (data.jarvis) {
iconUrl = '//commondatastorage.googleapis.com/ingress.com/img/map_icons/marker_images/jarvis_shard.png'; if (data.jarvis.target) {
iconSize = 60/2; // 60 pixels - half that size works better // target portal - show the target marker. use the count of fragments at the target to pick the right icon - it has segments that fill up
}
if (data.jarvis.target) {
// target portal - show the target marker. use the count of fragments at the target to pick the right icon - it has segments that fill up
var count = data.jarvis.fragments ? data.jarvis.fragments.length : 0; var count = data.jarvis.fragments ? data.jarvis.fragments.length : 0;
iconUrl = '//commondatastorage.googleapis.com/ingress.com/img/map_icons/marker_images/jarvis_shard_target_'+count+'.png';
iconSize = 100/2; // 100 pixels - half that size works better
} else if (data.jarvis.fragments) {
iconUrl = '//commondatastorage.googleapis.com/ingress.com/img/map_icons/marker_images/jarvis_shard.png';
iconSize = 60/2; // 60 pixels - half that size works better
opacity = 0.6; // these often hide portals - let's make them semi transparent
}
iconUrl = '//commondatastorage.googleapis.com/ingress.com/img/map_icons/marker_images/jarvis_shard_target_'+count+'.png';
iconSize = 100/2; // 100 pixels - half that size works better
} }
if (iconUrl) { if (iconUrl) {
@ -198,7 +202,7 @@ window.artifact.updateLayer = function() {
className: 'no-pointer-events' // the clickable: false below still blocks events going through to the svg underneath className: 'no-pointer-events' // the clickable: false below still blocks events going through to the svg underneath
}); });
var marker = L.marker (latlng, {icon: icon, clickable: false, keyboard: false}); var marker = L.marker (latlng, {icon: icon, clickable: false, keyboard: false, opacity: opacity });
artifact._layer.addLayer(marker); artifact._layer.addLayer(marker);
} else { } else {