Plugin Draw Resonators: Add styler: Highlight L8 resonators
This commit is contained in:
parent
2fdec66f84
commit
43788477f0
@ -485,6 +485,7 @@ window.plugin.drawResonators.ListDialogEntry.prototype.getSelectId = function()
|
|||||||
window.plugin.drawResonators.setupStyler = function() {
|
window.plugin.drawResonators.setupStyler = function() {
|
||||||
var thisPlugin = window.plugin.drawResonators;
|
var thisPlugin = window.plugin.drawResonators;
|
||||||
|
|
||||||
|
// Styler for highlighting resonators deployed by me
|
||||||
var myReso = {
|
var myReso = {
|
||||||
name: 'Highlight my resonators',
|
name: 'Highlight my resonators',
|
||||||
otherOptions: {
|
otherOptions: {
|
||||||
@ -517,6 +518,41 @@ window.plugin.drawResonators.setupStyler = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
thisPlugin.render.addStyler(new thisPlugin.Styler(myReso));
|
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.addEntry('use-styler', stylerDialogEntry);
|
||||||
|
|
||||||
thisPlugin.dialog.addLink();
|
thisPlugin.dialog.addLink();
|
||||||
|
|
||||||
// TODO: Add dialog entry for styler
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PLUGIN END //////////////////////////////////////////////////////////
|
// PLUGIN END //////////////////////////////////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user