From c34d7ee3a267ada2b66374498a201cb95c93addb Mon Sep 17 00:00:00 2001 From: Xelio Date: Sun, 10 Feb 2013 13:25:39 +0800 Subject: [PATCH 1/9] Resonator on map Change: Add "RESONATOR_DISPLAY_ZOOM_LEVEL" to control minimum zoom level resonator will display Add layerGroup "resonatorsLayers" to draw resonators on it. Add "window.resonators" to store references to resonators on map Resonator will have guid of portal with ".11" or ".12" replaced with ".r0"~".r7" Add function "window.renderResontor" to draw resonators (use sorgo's code [sorgo](https://github.com/sorgo)) "window.renderPortal" will call "window.renderResontor" before add portal to portalsLayers Change "window.removeByGuid" to handle resonators Change "window.cleanUp" to handle resonators cleanup --- code/boot.js | 9 +++++ code/map_data.js | 83 +++++++++++++++++++++++++++++++++++++++++++++- code/utils_misc.js | 12 +++++++ main.js | 8 +++-- 4 files changed, 109 insertions(+), 3 deletions(-) diff --git a/code/boot.js b/code/boot.js index 5c735d9a..531c5c60 100644 --- a/code/boot.js +++ b/code/boot.js @@ -81,6 +81,15 @@ window.setupMap = function() { map.addLayer(linksLayer, true); addLayers['Links'] = linksLayer; + resonatorsLayers = []; + for(var i = 1; i <= 8; i++) { + resonatorsLayers[i] = L.layerGroup([]); + map.addLayer(resonatorsLayers[i]); + var t = 'Level ' + i + ' Portal resonators'; + addLayers[t] = resonatorsLayers[i]; + } + + map.addControl(new L.Control.Layers({ 'OSM Cloudmade Midnight': views[0], 'OSM Cloudmade Minimal': views[1], diff --git a/code/map_data.js b/code/map_data.js index 6d12e7a7..f4c580fc 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -146,9 +146,15 @@ window.cleanUp = function() { portalsLayers[i].eachLayer(function(portal) { // portal must be in bounds and have a high enough level. Also don’t // remove if it is selected. - if(portal.options.guid == window.selectedPortal || + var portalGuid = portal.options.guid; + if(portalGuid == window.selectedPortal || (b.contains(portal.getLatLng()) && i >= minlvl)) return; + cnt[0]++; + + //remove attached resonators + for(var j = 0; j <= 7; j++) removeByGuid( portalResonatorGuid(portalGuid,j) ); + portalsLayers[i].removeLayer(portal); }); } @@ -162,6 +168,14 @@ window.cleanUp = function() { cnt[2]++; fieldsLayer.removeLayer(field); }); + // remove all resonator if zoom level become + // lower than RESONATOR_DISPLAY_ZOOM_LEVEL + if (map.getZoom() < RESONATOR_DISPLAY_ZOOM_LEVEL){ + for(var i = 1; i < resonatorsLayers.length; i++){ + resonatorsLayers[i].clearLayers(); + } + console.log('removed all resonators'); + } console.log('removed out-of-bounds: '+cnt[0]+' portals, '+cnt[1]+' links, '+cnt[2]+' fields'); } @@ -183,6 +197,10 @@ window.removeByGuid = function(guid) { if(!window.fields[guid]) return; fieldsLayer.removeLayer(window.fields[guid]); break; + case TYPE_RESONATOR: + if(!window.resonators[guid]) return; + resonatorsLayers[window.resonators[guid].options.pLevel].removeLayer(window.resonators[guid]); + break; default: console.warn('unknown GUID type: ' + guid); //window.debug.printStackTrace(); @@ -244,10 +262,73 @@ window.renderPortal = function(ent) { window.renderPortalDetails(ent[0]); window.map.setView(latlng, 17); }); + + window.renderResonator(ent); + // portalLevel contains a float, need to round down p.addTo(portalsLayers[parseInt(portalLevel)]); } +window.renderResonator = function(ent) { + + var portalLevel = getPortalLevel(ent[2]); + if(portalLevel < getMinPortalLevel() && ent[0] != selectedPortal) return; + + if(map.getZoom() < RESONATOR_DISPLAY_ZOOM_LEVEL) return; + + for(var i=0; i Date: Sun, 10 Feb 2013 16:06:13 +0800 Subject: [PATCH 2/9] Move resonator layer back to layerGroup "portalsLayers", to make it work with portal level filter. And modify cleanup code to work with this change. --- code/boot.js | 9 --------- code/map_data.js | 40 ++++++++++++++++++++++------------------ main.js | 2 +- 3 files changed, 23 insertions(+), 28 deletions(-) diff --git a/code/boot.js b/code/boot.js index 531c5c60..5c735d9a 100644 --- a/code/boot.js +++ b/code/boot.js @@ -81,15 +81,6 @@ window.setupMap = function() { map.addLayer(linksLayer, true); addLayers['Links'] = linksLayer; - resonatorsLayers = []; - for(var i = 1; i <= 8; i++) { - resonatorsLayers[i] = L.layerGroup([]); - map.addLayer(resonatorsLayers[i]); - var t = 'Level ' + i + ' Portal resonators'; - addLayers[t] = resonatorsLayers[i]; - } - - map.addControl(new L.Control.Layers({ 'OSM Cloudmade Midnight': views[0], 'OSM Cloudmade Minimal': views[1], diff --git a/code/map_data.js b/code/map_data.js index f4c580fc..4bf24c50 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -143,19 +143,31 @@ window.cleanUp = function() { var minlvl = getMinPortalLevel(); for(var i = 0; i < portalsLayers.length; i++) { // i is also the portal level - portalsLayers[i].eachLayer(function(portal) { + portalsLayers[i].eachLayer(function(item) { // portal must be in bounds and have a high enough level. Also don’t // remove if it is selected. - var portalGuid = portal.options.guid; - if(portalGuid == window.selectedPortal || - (b.contains(portal.getLatLng()) && i >= minlvl)) return; + var itemGuid = item.options.guid; + switch(getTypeByGuid(itemGuid)){ - cnt[0]++; + case TYPE_PORTAL: + if(itemGuid == window.selectedPortal || + (b.contains(item.getLatLng()) && i >= minlvl)) return; + + cnt[0]++; - //remove attached resonators - for(var j = 0; j <= 7; j++) removeByGuid( portalResonatorGuid(portalGuid,j) ); + //remove attached resonators + for(var j = 0; j <= 7; j++) removeByGuid( portalResonatorGuid(itemGuid,j) ); - portalsLayers[i].removeLayer(portal); + portalsLayers[i].removeLayer(item); + break; + + case TYPE_RESONATOR: + // remove all resonator if zoom level become + // lower than RESONATOR_DISPLAY_ZOOM_LEVEL + if (map.getZoom() < RESONATOR_DISPLAY_ZOOM_LEVEL) + portalsLayers[i].removeLayer(item); + break; + } }); } linksLayer.eachLayer(function(link) { @@ -168,14 +180,6 @@ window.cleanUp = function() { cnt[2]++; fieldsLayer.removeLayer(field); }); - // remove all resonator if zoom level become - // lower than RESONATOR_DISPLAY_ZOOM_LEVEL - if (map.getZoom() < RESONATOR_DISPLAY_ZOOM_LEVEL){ - for(var i = 1; i < resonatorsLayers.length; i++){ - resonatorsLayers[i].clearLayers(); - } - console.log('removed all resonators'); - } console.log('removed out-of-bounds: '+cnt[0]+' portals, '+cnt[1]+' links, '+cnt[2]+' fields'); } @@ -199,7 +203,7 @@ window.removeByGuid = function(guid) { break; case TYPE_RESONATOR: if(!window.resonators[guid]) return; - resonatorsLayers[window.resonators[guid].options.pLevel].removeLayer(window.resonators[guid]); + portalsLayers[window.resonators[guid].options.pLevel].removeLayer(window.resonators[guid]); break; default: console.warn('unknown GUID type: ' + guid); @@ -319,7 +323,7 @@ window.renderResonator = function(ent) { r.on('remove', function() { delete window.resonators[this.options.guid]; }); r.on('add', function() { window.resonators[this.options.guid] = this; }); - r.addTo(resonatorsLayers[parseInt(portalLevel)]); + r.addTo(portalsLayers[parseInt(portalLevel)]); } } diff --git a/main.js b/main.js index 4b61babe..6e2a1262 100644 --- a/main.js +++ b/main.js @@ -159,7 +159,7 @@ window.selectedPortal = null; window.portalRangeIndicator = null; window.portalAccessIndicator = null; window.mapRunsUserAction = false; -var portalsLayers, linksLayer, fieldsLayer, resonatorsLayers; +var portalsLayers, linksLayer, fieldsLayer; // contain references to all entities shown on the map. These are // automatically kept in sync with the items on *sLayer, so never ever From 444bcce988bb8723a447cdaaf9e2b17035090112 Mon Sep 17 00:00:00 2001 From: Xelio Date: Sun, 10 Feb 2013 20:58:15 +0800 Subject: [PATCH 3/9] Code cleanup and minor change Change: Code cleanup Loop over all portalsLayers when delete resonator --- code/map_data.js | 39 +++++++++++++++++---------------------- main.js | 5 +++++ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/code/map_data.js b/code/map_data.js index 4bf24c50..6c47155e 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -147,25 +147,25 @@ window.cleanUp = function() { // portal must be in bounds and have a high enough level. Also don’t // remove if it is selected. var itemGuid = item.options.guid; - switch(getTypeByGuid(itemGuid)){ + switch(getTypeByGuid(itemGuid)) { case TYPE_PORTAL: if(itemGuid == window.selectedPortal || - (b.contains(item.getLatLng()) && i >= minlvl)) return; + (b.contains(item.getLatLng()) && i >= minlvl)) return; cnt[0]++; //remove attached resonators - for(var j = 0; j <= 7; j++) removeByGuid( portalResonatorGuid(itemGuid,j) ); + for(var j = 0; j <= 7; j++) removeByGuid(portalResonatorGuid(itemGuid,j)); portalsLayers[i].removeLayer(item); break; case TYPE_RESONATOR: - // remove all resonator if zoom level become + // remove all resonators if zoom level become // lower than RESONATOR_DISPLAY_ZOOM_LEVEL if (map.getZoom() < RESONATOR_DISPLAY_ZOOM_LEVEL) - portalsLayers[i].removeLayer(item); + for(var j = 0; j <= 7; j++) portalsLayers[j].removeLayer(item); break; } }); @@ -203,7 +203,9 @@ window.removeByGuid = function(guid) { break; case TYPE_RESONATOR: if(!window.resonators[guid]) return; - portalsLayers[window.resonators[guid].options.pLevel].removeLayer(window.resonators[guid]); + var r = window.resonators[guid] + for(var i = 1; i < portalsLayers.length; i++) + portalsLayers[i].removeLayer(r); break; default: console.warn('unknown GUID type: ' + guid); @@ -267,41 +269,35 @@ window.renderPortal = function(ent) { window.map.setView(latlng, 17); }); - window.renderResonator(ent); + window.renderResonators(ent); // portalLevel contains a float, need to round down p.addTo(portalsLayers[parseInt(portalLevel)]); } -window.renderResonator = function(ent) { +window.renderResonators = function(ent) { var portalLevel = getPortalLevel(ent[2]); if(portalLevel < getMinPortalLevel() && ent[0] != selectedPortal) return; if(map.getZoom() < RESONATOR_DISPLAY_ZOOM_LEVEL) return; - for(var i=0; i Date: Sun, 10 Feb 2013 21:14:54 +0800 Subject: [PATCH 4/9] Resonators deletion of portal move Move Resonators deletion to 'remove' event of portal --- code/map_data.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/code/map_data.js b/code/map_data.js index 6c47155e..fd353a0a 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -155,9 +155,6 @@ window.cleanUp = function() { cnt[0]++; - //remove attached resonators - for(var j = 0; j <= 7; j++) removeByGuid(portalResonatorGuid(itemGuid,j)); - portalsLayers[i].removeLayer(item); break; @@ -255,7 +252,13 @@ window.renderPortal = function(ent) { details: ent[2], guid: ent[0]}); - p.on('remove', function() { delete window.portals[this.options.guid]; }); + p.on('remove', function() { + // remove attached resonators + var portalGuid = this.options.guid + for(var i = 0; i <= 7; i++) + removeByGuid(portalResonatorGuid(portalGuid,i)); + delete window.portals[portalGuid]; + }); p.on('add', function() { window.portals[this.options.guid] = this; // handles the case where a selected portal gets removed from the @@ -289,11 +292,11 @@ window.renderResonators = function(ent) { if (window.resonators[portalResonatorGuid(ent[0],i)]) continue; - // offsets in meters + // offset in meters var dn = rdata.distanceToPortal*SLOT_TO_LAT[rdata.slot]; var de = rdata.distanceToPortal*SLOT_TO_LNG[rdata.slot]; - // Coordinate offsets in radians + // Coordinate offset in radians var dLat = dn/EARTH_RADIUS; var dLon = de/(EARTH_RADIUS*Math.cos(Math.PI/180*(ent[2].locationE6.latE6/1E6))); From 6936ef1d051b1271e44726add7acdeacf2037dfa Mon Sep 17 00:00:00 2001 From: Xelio Date: Sun, 10 Feb 2013 22:23:01 +0800 Subject: [PATCH 5/9] Resonators deletion of zoom level move Change: Move resonators deletion to 'zoomend' event of map. Some clean up of code. --- code/boot.js | 17 ++++++++++++++++- code/map_data.js | 42 +++++++++++++++++++----------------------- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/code/boot.js b/code/boot.js index 5c735d9a..3d6d3912 100644 --- a/code/boot.js +++ b/code/boot.js @@ -93,7 +93,22 @@ window.setupMap = function() { map.attributionControl.setPrefix(''); // listen for changes and store them in cookies map.on('moveend', window.storeMapPosition); - map.on('zoomend', window.storeMapPosition); + map.on('zoomend', function() { + window.storeMapPosition; + + // remove all resonators if zoom out to < RESONATOR_DISPLAY_ZOOM_LEVEL + if (isResonatorsShow()) return; + for(var i = 1; i < portalsLayers.length; i++) { + portalsLayers[i].eachLayer(function(item) { + var itemGuid = item.options.guid; + // check if 'item' is a resonator + if(!window.resonators[itemGuid]) return; + portalsLayers[i].removeLayer(item); + }); + } + + console.log('Remove all resonators'); + }); $("[name='leaflet-base-layers']").change(function () { writeCookie('ingress.intelmap.type', $(this).parent().index()); }); diff --git a/code/map_data.js b/code/map_data.js index fd353a0a..2fef1534 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -144,27 +144,15 @@ window.cleanUp = function() { for(var i = 0; i < portalsLayers.length; i++) { // i is also the portal level portalsLayers[i].eachLayer(function(item) { + var itemGuid = item.options.guid; + // check if 'item' is a portal + if(!window.portals[itemGuid]) return; // portal must be in bounds and have a high enough level. Also don’t // remove if it is selected. - var itemGuid = item.options.guid; - switch(getTypeByGuid(itemGuid)) { - - case TYPE_PORTAL: - if(itemGuid == window.selectedPortal || - (b.contains(item.getLatLng()) && i >= minlvl)) return; - - cnt[0]++; - - portalsLayers[i].removeLayer(item); - break; - - case TYPE_RESONATOR: - // remove all resonators if zoom level become - // lower than RESONATOR_DISPLAY_ZOOM_LEVEL - if (map.getZoom() < RESONATOR_DISPLAY_ZOOM_LEVEL) - for(var j = 0; j <= 7; j++) portalsLayers[j].removeLayer(item); - break; - } + if(itemGuid == window.selectedPortal || + (b.contains(item.getLatLng()) && i >= minlvl)) return; + cnt[0]++; + portalsLayers[i].removeLayer(item); }); } linksLayer.eachLayer(function(link) { @@ -253,10 +241,14 @@ window.renderPortal = function(ent) { guid: ent[0]}); p.on('remove', function() { - // remove attached resonators var portalGuid = this.options.guid - for(var i = 0; i <= 7; i++) - removeByGuid(portalResonatorGuid(portalGuid,i)); + + // remove attached resonators, skip if + // all resonators have already removed by zooming + if (isResonatorsShow()) { + for(var i = 0; i <= 7; i++) + removeByGuid(portalResonatorGuid(portalGuid,i)); + } delete window.portals[portalGuid]; }); p.on('add', function() { @@ -283,7 +275,7 @@ window.renderResonators = function(ent) { var portalLevel = getPortalLevel(ent[2]); if(portalLevel < getMinPortalLevel() && ent[0] != selectedPortal) return; - if(map.getZoom() < RESONATOR_DISPLAY_ZOOM_LEVEL) return; + if(!isResonatorsShow()) return; for(var i=0; i < ent[2].resonatorArray.resonators.length; i++) { var rdata = ent[2].resonatorArray.resonators[i]; @@ -331,6 +323,10 @@ window.portalResonatorGuid = function(portalGuid, slot){ return portalGuid.slice(0,32) + '.r' + slot; } +window.isResonatorsShow = function(){ + return map.getZoom() >= RESONATOR_DISPLAY_ZOOM_LEVEL; +} + window.portalResetColor = function(portal) { portal.setStyle({color: portal.options.fillColor}); } From 370f34a793402d78ada25889cacb669d54238449 Mon Sep 17 00:00:00 2001 From: Xelio Date: Sun, 10 Feb 2013 22:52:11 +0800 Subject: [PATCH 6/9] Change guid format of resonator Change: Guid format of resonator change to following, [portal guid]-resonator-[slot] Some code cleanup --- code/boot.js | 2 +- code/map_data.js | 8 ++++---- code/utils_misc.js | 13 ++----------- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/code/boot.js b/code/boot.js index 3d6d3912..e77d4630 100644 --- a/code/boot.js +++ b/code/boot.js @@ -97,7 +97,7 @@ window.setupMap = function() { window.storeMapPosition; // remove all resonators if zoom out to < RESONATOR_DISPLAY_ZOOM_LEVEL - if (isResonatorsShow()) return; + if(isResonatorsShow()) return; for(var i = 1; i < portalsLayers.length; i++) { portalsLayers[i].eachLayer(function(item) { var itemGuid = item.options.guid; diff --git a/code/map_data.js b/code/map_data.js index 2fef1534..704abccc 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -245,7 +245,7 @@ window.renderPortal = function(ent) { // remove attached resonators, skip if // all resonators have already removed by zooming - if (isResonatorsShow()) { + if(isResonatorsShow()) { for(var i = 0; i <= 7; i++) removeByGuid(portalResonatorGuid(portalGuid,i)); } @@ -280,9 +280,9 @@ window.renderResonators = function(ent) { for(var i=0; i < ent[2].resonatorArray.resonators.length; i++) { var rdata = ent[2].resonatorArray.resonators[i]; - if (rdata == null) continue; + if(rdata == null) continue; - if (window.resonators[portalResonatorGuid(ent[0],i)]) continue; + if(window.resonators[portalResonatorGuid(ent[0],i)]) continue; // offset in meters var dn = rdata.distanceToPortal*SLOT_TO_LAT[rdata.slot]; @@ -320,7 +320,7 @@ window.renderResonators = function(ent) { // replace .11 or .12 in portal guid with .r[slot] to // get guid for resonators window.portalResonatorGuid = function(portalGuid, slot){ - return portalGuid.slice(0,32) + '.r' + slot; + return portalGuid + '-resonator-' + slot; } window.isResonatorsShow = function(){ diff --git a/code/utils_misc.js b/code/utils_misc.js index e8e59e1e..b9c60b5f 100644 --- a/code/utils_misc.js +++ b/code/utils_misc.js @@ -148,7 +148,7 @@ window.getTypeByGuid = function(guid) { // .c == player/creator // .d == chat messages // - // .r0~.r7 == resonators + // resonator guid is [portal guid]-resonator-[slot] switch(guid.slice(33)) { case '11': case '12': @@ -166,17 +166,8 @@ window.getTypeByGuid = function(guid) { case 'd': return TYPE_CHAT; - case 'r0': - case 'r1': - case 'r2': - case 'r3': - case 'r4': - case 'r5': - case 'r6': - case 'r7': - return TYPE_RESONATOR; - default: + if(guid.slice(-11,-2) == 'resonator') return TYPE_RESONATOR; return TYPE_UNKNOWN; } } From 36aabc321656ff8400f9160b370d07fb91153de5 Mon Sep 17 00:00:00 2001 From: Xelio Date: Sun, 10 Feb 2013 22:58:08 +0800 Subject: [PATCH 7/9] Comment correction Correct comment of "portalResonatorGuid" --- code/map_data.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/map_data.js b/code/map_data.js index 704abccc..5d29de6a 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -317,8 +317,7 @@ window.renderResonators = function(ent) { } } -// replace .11 or .12 in portal guid with .r[slot] to -// get guid for resonators +// append portal guid with -resonator-[slot] to get guid for resonators window.portalResonatorGuid = function(portalGuid, slot){ return portalGuid + '-resonator-' + slot; } From 259905b2242c6df557aa14476f90023e9551ac9b Mon Sep 17 00:00:00 2001 From: Xelio Date: Sun, 10 Feb 2013 23:21:53 +0800 Subject: [PATCH 8/9] Add contributor Add [sorgo](https://github.com/sorgo) as contributor for his rendering code. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b5a6486d..afd73b95 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ Contributors [mledoze](https://github.com/mledoze), [OshiHidra](https://github.com/OshiHidra), [Scrool](https://github.com/Scrool), +[sorgo](https://github.com/sorgo), [Xelio](https://github.com/Xelio), [ZauberNerd](https://github.com/ZauberNerd) From 7b7f229ac5b3ef814f39af86d234ec567d9af929 Mon Sep 17 00:00:00 2001 From: Xelio Date: Mon, 11 Feb 2013 02:22:35 +0800 Subject: [PATCH 9/9] Change resonators render min zoom level and radius Change: Resonators render minimum zoom level 16 -> 17 Resonators render radius 4 -> 3 Some cleanup and performance tuning --- code/boot.js | 2 +- code/map_data.js | 12 ++++++------ main.js | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/code/boot.js b/code/boot.js index e77d4630..ec9be61c 100644 --- a/code/boot.js +++ b/code/boot.js @@ -102,7 +102,7 @@ window.setupMap = function() { portalsLayers[i].eachLayer(function(item) { var itemGuid = item.options.guid; // check if 'item' is a resonator - if(!window.resonators[itemGuid]) return; + if(getTypeByGuid(itemGuid) != TYPE_RESONATOR) return true; portalsLayers[i].removeLayer(item); }); } diff --git a/code/map_data.js b/code/map_data.js index 5d29de6a..36b3fe7a 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -146,11 +146,11 @@ window.cleanUp = function() { portalsLayers[i].eachLayer(function(item) { var itemGuid = item.options.guid; // check if 'item' is a portal - if(!window.portals[itemGuid]) return; + if(getTypeByGuid(itemGuid) != TYPE_PORTAL) return true; // portal must be in bounds and have a high enough level. Also don’t // remove if it is selected. if(itemGuid == window.selectedPortal || - (b.contains(item.getLatLng()) && i >= minlvl)) return; + (b.contains(item.getLatLng()) && i >= minlvl)) return true; cnt[0]++; portalsLayers[i].removeLayer(item); }); @@ -188,7 +188,7 @@ window.removeByGuid = function(guid) { break; case TYPE_RESONATOR: if(!window.resonators[guid]) return; - var r = window.resonators[guid] + var r = window.resonators[guid]; for(var i = 1; i < portalsLayers.length; i++) portalsLayers[i].removeLayer(r); break; @@ -297,7 +297,7 @@ window.renderResonators = function(ent) { var lon0 = ent[2].locationE6.lngE6/1E6 + dLon * 180/Math.PI; var Rlatlng = [lat0, lon0]; var r = L.circleMarker(Rlatlng, { - radius: 4, + radius: 3, // #AAAAAA outline seems easier to see the fill opacity color: '#AAAAAA', opacity: 1, @@ -318,11 +318,11 @@ window.renderResonators = function(ent) { } // append portal guid with -resonator-[slot] to get guid for resonators -window.portalResonatorGuid = function(portalGuid, slot){ +window.portalResonatorGuid = function(portalGuid, slot) { return portalGuid + '-resonator-' + slot; } -window.isResonatorsShow = function(){ +window.isResonatorsShow = function() { return map.getZoom() >= RESONATOR_DISPLAY_ZOOM_LEVEL; } diff --git a/main.js b/main.js index d3a90b14..b27b56e6 100644 --- a/main.js +++ b/main.js @@ -145,7 +145,7 @@ var PLAYER = window.PLAYER; var CHAT_SHRINKED = 60; // Minimum zoom level resonator will display -var RESONATOR_DISPLAY_ZOOM_LEVEL = 16; +var RESONATOR_DISPLAY_ZOOM_LEVEL = 17; // Constants for resonator positioning var SLOT_TO_LAT = [0, Math.sqrt(2)/2, 1, Math.sqrt(2)/2, 0, -Math.sqrt(2)/2, -1, -Math.sqrt(2)/2];