From 745e78170b110f2604a7734da0a04c24a3fd1716 Mon Sep 17 00:00:00 2001 From: Xelio Date: Tue, 3 Sep 2013 00:34:16 +0800 Subject: [PATCH] Plugin Draw Resonators: add comment for Render and change an ambiguous function name --- plugins/draw-resonators.user.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/plugins/draw-resonators.user.js b/plugins/draw-resonators.user.js index a4aa8291..f7f73b25 100644 --- a/plugins/draw-resonators.user.js +++ b/plugins/draw-resonators.user.js @@ -32,7 +32,14 @@ window.plugin.drawResonators.render; // As long as 'window.Render.prototype.createPortalEntity' delete and recreate portal // on any change of data, this resonator render should make resonator create and remove // with portal correctly. - +// +// Resonators will create when +// 1.Portal added to map +// 2.Zooming in to enable zoom level +// +// Resonators will remove when +// 1.Portal removed from map +// 2.Zooming out beyond enable zoom level window.plugin.drawResonators.Render = function(options) { this.enableZoomLevel = options['enableZoomLevel']; @@ -160,16 +167,13 @@ window.plugin.drawResonators.Render.prototype.handleResonatorEntitiesAfterZoom = // Redraw all resonators if they were deleted if(!this.isResonatorsShowBeforeZoom()) { for(var guid in window.portals) { - // Need this checking? - if(! guid in this.resonators) { - this.createResonatorEntities(window.portals[guid]); - } + this.createResonatorEntities(window.portals[guid]); } } } } -window.plugin.drawResonators.Render.prototype.changeStyle = function(portalGuid) { +window.plugin.drawResonators.Render.prototype.toggleSelectedStyle = function(portalGuid) { if (portalGuid in this.resonators) { var render = this; var portalSelected = selectedPortal === portalGuid; @@ -340,7 +344,7 @@ var setup = function() { window.addLayerGroup('Resonators', window.plugin.drawResonators.render.resonatorLayerGroup, true); // TODO: add runHooks('portalSelected', {oldSelectedPortalGuid, newSelectedPortalGuid}); - // to window.selectPortal, call render.changeStyle to change style of selected and unselected + // to window.selectPortal, call render.toggleSelectedStyle to change style of selected and unselected // resonators. // TODO: add options dialog to change options