Browse Source

Fix toggleVisibility for items in Layer Manager. Closes #530

pull/540/head
Artur Arseniev 9 years ago
parent
commit
47befeb3bb
  1. 34
      src/navigator/view/ItemView.js

34
src/navigator/view/ItemView.js

@ -185,24 +185,26 @@ module.exports = Backbone.View.extend({
* @return void * @return void
* */ * */
toggleVisibility(e) { toggleVisibility(e) {
e.stopPropagation(); e && e.stopPropagation();
const pfx = this.pfx; const pfx = this.pfx;
const model = this.model;
if(!this.$eye) const hClass = `${pfx}hide`;
this.$eye = this.$el.children(`#${pfx}btn-eye`); const style = model.getStyle();
const hideIcon = 'fa-eye-slash';
var cCss = _.clone(this.model.get('style')), const $el = this.$el;
hClass = this.pfx + 'hide'; !this.$eye && (this.$eye = $el.children(`#${pfx}btn-eye`));
if(this.isVisible()){
this.$el.addClass(hClass); if (this.isVisible()) {
this.$eye.addClass('fa-eye-slash'); $el.addClass(hClass);
cCss.display = 'none'; this.$eye.addClass(hideIcon);
}else{ style.display = 'none';
this.$el.removeClass(hClass); } else {
this.$eye.removeClass('fa-eye-slash'); $el.removeClass(hClass);
delete cCss.display; this.$eye.removeClass(hideIcon);
delete style.display;
} }
this.model.set('style', cCss);
model.setStyle(style);
}, },
/** /**

Loading…
Cancel
Save