Browse Source

Update property value on render

no-jquery
Artur Arseniev 9 years ago
parent
commit
e87b78f946
  1. 1
      src/style_manager/view/LayerView.js
  2. 2
      src/style_manager/view/LayersView.js
  3. 17
      src/style_manager/view/PropertyStackView.js
  4. 1
      src/style_manager/view/PropertyView.js

1
src/style_manager/view/LayerView.js

@ -211,7 +211,6 @@ module.exports = Backbone.View.extend({
const className = `${this.pfx}layer`; const className = `${this.pfx}layer`;
const model = this.model; const model = this.model;
const el = this.el; const el = this.el;
console.log(propsConfig);
const properties = new PropertiesView({ const properties = new PropertiesView({
collection: model.get('properties'), collection: model.get('properties'),
config: this.config, config: this.config,

2
src/style_manager/view/LayersView.js

@ -64,7 +64,7 @@ module.exports = Backbone.View.extend({
if(typeof this.preview !== 'undefined'){ if(typeof this.preview !== 'undefined'){
model.set('preview', this.preview); model.set('preview', this.preview);
} }
console.log('Layer addToCollection', model.get('properties'));
var view = new LayerView({ var view = new LayerView({
model, model,
config, config,

17
src/style_manager/view/PropertyStackView.js

@ -176,8 +176,7 @@ module.exports = PropertyCompositeView.extend({
this.elementUpdated(); this.elementUpdated();
// If not detached I'll just put all the values from layers to property // If not detached I'll just put all the values from layers to property
// eg. // eg. background: layer1Value, layer2Value, layer3Value, ...
// background: layer1Value, layer2Value, layer3Value, ...
if (!model.get('detached')) { if (!model.get('detached')) {
model.set('value', this.getLayerValues()); model.set('value', this.getLayerValues());
} else { } else {
@ -187,6 +186,20 @@ module.exports = PropertyCompositeView.extend({
} }
}, },
/**
* The value that should update view inputs.
* In case of a detached property the value might something like this
* @param {string} value
* @param {Object} [opts={}]
* @private
*/
setValue(value, opts = {}) {
const model = this.model;
let val = value || model.get('value') || model.getDefaultValue();
//const input = this.getInputEl();
//input && (input.value = val);
},
/** /**
* Create value by layers * Create value by layers
* @return string * @return string

1
src/style_manager/view/PropertyView.js

@ -442,6 +442,7 @@ module.exports = Backbone.View.extend({
const onRender = this.onRender && this.onRender.bind(this); const onRender = this.onRender && this.onRender.bind(this);
onRender && onRender(); onRender && onRender();
this.setValue(model.get('value'));
}, },
}); });

Loading…
Cancel
Save