From ece5dac26f742496ef47bf6f9bcd59aa61b12ba1 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Tue, 3 Mar 2015 20:49:49 +0000 Subject: [PATCH] portal markers: tweaks to the sizes used for different levels --- code/portal_marker.js | 15 +++++++++++---- main.js | 3 --- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/code/portal_marker.js b/code/portal_marker.js index ba6cfe03..9a1e6d8e 100644 --- a/code/portal_marker.js +++ b/code/portal_marker.js @@ -5,7 +5,7 @@ window.portalMarkerScale = function() { var zoom = map.getZoom(); 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 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) { var scale = window.portalMarkerScale(); - var lvlWeight = Math.max(2, Math.floor(details.level) / 1.5) * scale; - var lvlRadius = (details.team === window.TEAM_NONE ? 7 : Math.floor(details.level) + 4) * scale; + // portal level 0 1 2 3 4 5 6 7 8 + 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 = { - radius: lvlRadius + (L.Browser.mobile ? PORTAL_RADIUS_ENLARGE_MOBILE*scale : 0), + radius: lvlRadius, stroke: true, color: COLORS[details.team], weight: lvlWeight, @@ -60,3 +66,4 @@ window.getMarkerStyleOptions = function(details) { return options; } + diff --git a/main.js b/main.js index 6725da73..3d7d044d 100644 --- a/main.js +++ b/main.js @@ -160,9 +160,6 @@ window.MOD_TYPE = {RES_SHIELD:'Shield', MULTIHACK:'Multi-hack', FORCE_AMP:'Force window.ACCESS_INDICATOR_COLOR = 'orange'; 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';