From 08b7a5ec6f58bea3852adbc6d8c48cbcc9b23206 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Wed, 20 Nov 2013 06:20:30 +0000 Subject: [PATCH] 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 --- code/artifact.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/code/artifact.js b/code/artifact.js index 48ddec8f..b15fafe4 100644 --- a/code/artifact.js +++ b/code/artifact.js @@ -176,18 +176,22 @@ window.artifact.updateLayer = function() { // jarvis shard icon var iconUrl = undefined; var iconSize = 0; + var opacity = 1.0; - 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 - } - 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 + if (data.jarvis) { + 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) { @@ -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 }); - 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); } else {