portal markers: tweaks to the sizes used for different levels

This commit is contained in:
Jon Atkins 2015-03-03 20:49:49 +00:00
parent 58b9d1c7d3
commit ece5dac26f
2 changed files with 11 additions and 7 deletions

View File

@ -5,7 +5,7 @@
window.portalMarkerScale = function() { window.portalMarkerScale = function() {
var zoom = map.getZoom(); var zoom = map.getZoom();
if (L.Browser.mobile) if (L.Browser.mobile)
return zoom >= 16 ? 1 : zoom >= 14 ? 0.8 : zoom >= 11 ? 0.65 : zoom >= 8 ? 0.5 : 0.35; return zoom >= 16 ? 1.5 : zoom >= 14 ? 1.2 : zoom >= 11 ? 1.0 : zoom >= 8 ? 0.65 : 0.5;
else else
return zoom >= 14 ? 1 : zoom >= 11 ? 0.8 : zoom >= 8 ? 0.65 : 0.5; return zoom >= 14 ? 1 : zoom >= 11 ? 0.8 : zoom >= 8 ? 0.65 : 0.5;
} }
@ -43,11 +43,17 @@ window.setMarkerStyle = function(marker, selected) {
window.getMarkerStyleOptions = function(details) { window.getMarkerStyleOptions = function(details) {
var scale = window.portalMarkerScale(); var scale = window.portalMarkerScale();
var lvlWeight = Math.max(2, Math.floor(details.level) / 1.5) * scale; // portal level 0 1 2 3 4 5 6 7 8
var lvlRadius = (details.team === window.TEAM_NONE ? 7 : Math.floor(details.level) + 4) * scale; var LEVEL_TO_WEIGHT = [2, 2, 2, 2, 2, 3, 3, 4, 4];
var LEVEL_TO_RADIUS = [7, 7, 7, 7, 8, 8, 9,10,11];
var level = Math.floor(details.level);
var lvlWeight = LEVEL_TO_WEIGHT[level] * scale;
var lvlRadius = LEVEL_TO_RADIUS[level] * scale;
var options = { var options = {
radius: lvlRadius + (L.Browser.mobile ? PORTAL_RADIUS_ENLARGE_MOBILE*scale : 0), radius: lvlRadius,
stroke: true, stroke: true,
color: COLORS[details.team], color: COLORS[details.team],
weight: lvlWeight, weight: lvlWeight,
@ -60,3 +66,4 @@ window.getMarkerStyleOptions = function(details) {
return options; return options;
} }

View File

@ -160,9 +160,6 @@ window.MOD_TYPE = {RES_SHIELD:'Shield', MULTIHACK:'Multi-hack', FORCE_AMP:'Force
window.ACCESS_INDICATOR_COLOR = 'orange'; window.ACCESS_INDICATOR_COLOR = 'orange';
window.RANGE_INDICATOR_COLOR = 'red' window.RANGE_INDICATOR_COLOR = 'red'
// by how much pixels should the portal range be expanded on mobile
// devices. This should make clicking them easier.
window.PORTAL_RADIUS_ENLARGE_MOBILE = 5;
window.DEFAULT_PORTAL_IMG = '//commondatastorage.googleapis.com/ingress.com/img/default-portal-image.png'; window.DEFAULT_PORTAL_IMG = '//commondatastorage.googleapis.com/ingress.com/img/default-portal-image.png';