Browse Source

Fix preview when not requested

pull/1518/head
Artur Arseniev 8 years ago
parent
commit
3e582175a4
  1. 12
      src/style_manager/view/LayerView.js

12
src/style_manager/view/LayerView.js

@ -41,10 +41,6 @@ module.exports = Backbone.View.extend({
this.listenTo(model, 'change:active', this.updateVisibility); this.listenTo(model, 'change:active', this.updateVisibility);
this.listenTo(model.get('properties'), 'change', this.updatePreview); this.listenTo(model.get('properties'), 'change', this.updatePreview);
if (!model.get('preview')) {
this.$el.addClass(this.pfx + 'no-preview');
}
// For the sorter // For the sorter
model.view = this; model.view = this;
model.set({ droppable: 0, draggable: 1 }); model.set({ droppable: 0, draggable: 1 });
@ -152,9 +148,8 @@ module.exports = Backbone.View.extend({
render() { render() {
const PropertiesView = require('./PropertiesView'); const PropertiesView = require('./PropertiesView');
const propsConfig = this.propsConfig; const propsConfig = this.propsConfig;
const className = `${this.pfx}layer`; const { model, el, pfx } = this;
const model = this.model; const preview = model.get('preview');
const el = this.el;
const properties = new PropertiesView({ const properties = new PropertiesView({
collection: model.get('properties'), collection: model.get('properties'),
config: this.config, config: this.config,
@ -163,8 +158,9 @@ module.exports = Backbone.View.extend({
propTarget: propsConfig.propTarget, propTarget: propsConfig.propTarget,
onChange: propsConfig.onChange onChange: propsConfig.onChange
}).render().el; }).render().el;
el.innerHTML = this.template(model); el.innerHTML = this.template(model);
el.className = className; el.className = `${pfx}layer${!preview ? ` ${pfx}no-preview` : ''}`;
this.getPropertiesWrapper().appendChild(properties); this.getPropertiesWrapper().appendChild(properties);
this.updateVisibility(); this.updateVisibility();
this.updatePreview(); this.updatePreview();

Loading…
Cancel
Save