From 43788477f0059b4a1e74b88d4f21a9acf3e54d2b Mon Sep 17 00:00:00 2001 From: Xelio Date: Thu, 12 Sep 2013 00:28:04 +0800 Subject: [PATCH] Plugin Draw Resonators: Add styler: Highlight L8 resonators --- plugins/draw-resonators.user.js | 38 +++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/plugins/draw-resonators.user.js b/plugins/draw-resonators.user.js index 2fd6b385..7468f96d 100644 --- a/plugins/draw-resonators.user.js +++ b/plugins/draw-resonators.user.js @@ -485,6 +485,7 @@ window.plugin.drawResonators.ListDialogEntry.prototype.getSelectId = function() window.plugin.drawResonators.setupStyler = function() { var thisPlugin = window.plugin.drawResonators; + // Styler for highlighting resonators deployed by me var myReso = { name: 'Highlight my resonators', otherOptions: { @@ -517,6 +518,41 @@ window.plugin.drawResonators.setupStyler = function() { }; thisPlugin.render.addStyler(new thisPlugin.Styler(myReso)); + + // Styler for highlighting L8 resonators + var l8Reso = { + name: 'Highlight L8 resonators', + otherOptions: { + highlightedReso : {color: '#fff', weight: 2, radius: 4, opacity: 1, clickable: false}, + normalReso : {color: '#aaa', weight: 1, radius: 3, opacity: 1, clickable: false}, + selectedReso : {color: '#eee', weight: 1.1, radius: 4, opacity: 1, clickable: false}, + highlightedConn : {opacity: 0.7, weight: 3, color: '#FFA000', dashArray: '0,10,999', color: '#FFA000', fill: false, clickable: false}, + normalConn : {opacity: 0.25, weight: 2, color: '#FFA000', dashArray: '0,10' + (new Array(25).join(',8,4')), fill: false, clickable: false}, + selectedConn : {opacity: 0.7, weight: 3, color: '#FFA000', dashArray: '0,10' + (new Array(25).join(',8,4')), fill: false, clickable: false} + }, + resonatorStyleFunc: function(resoDetail, selected) { + var l8 = resoDetail.level === 8; + var resoSharedStyle = l8 + ? this.otherOptions.highlightedReso + : (selected ? this.otherOptions.selectedReso : this.otherOptions.normalReso); + + var resoStyle = $.extend({ + fillColor: COLORS_LVL[resoDetail.level], + fillOpacity: resoDetail.energyTotal/RESO_NRG[resoDetail.level] * (l8 ? 1 : 0.75) + }, resoSharedStyle); + return resoStyle; + }, + connectorStyleFunc: function(resoDetail, selected) { + var l8 = resoDetail.level === 8; + var connStyle = l8 + ? this.otherOptions.highlightedConn + : (selected ? this.otherOptions.selectedConn : this.otherOptions.normalConn); + return connStyle; + } + }; + + thisPlugin.render.addStyler(new thisPlugin.Styler(l8Reso)); + } @@ -569,8 +605,6 @@ var setup = function() { thisPlugin.dialog.addEntry('use-styler', stylerDialogEntry); thisPlugin.dialog.addLink(); - - // TODO: Add dialog entry for styler } // PLUGIN END //////////////////////////////////////////////////////////