Browse Source

Pass parent ref to layers properties

pull/2675/head
Artur Arseniev 6 years ago
parent
commit
0f219fcfc3
  1. 16
      src/style_manager/model/Layer.js

16
src/style_manager/model/Layer.js

@ -12,16 +12,15 @@ export default Backbone.Model.extend({
},
initialize() {
const properties = this.get('properties');
const prp = this.get('properties');
var value = this.get('value');
this.set(
'properties',
properties instanceof Properties ? properties : new Properties(properties)
prp instanceof Properties ? prp : new Properties(prp)
);
this.get('properties').forEach(item => {
const { collection } = this;
item.parent = collection && collection.property;
});
const props = this.get('properties');
props.forEach(this.onPropAdd, this);
this.listenTo(props, 'add', this.onPropAdd);
// If there is no value I'll try to get it from values
// I need value setted to make preview working
@ -37,6 +36,11 @@ export default Backbone.Model.extend({
}
},
onPropAdd(prop) {
const coll = this.collection;
prop.parent = coll && coll.property;
},
/**
* Get property at some index
* @param {Number} index

Loading…
Cancel
Save