Browse Source

Trigger only the custom event for layer change

up-style-manager
Artur Arseniev 5 years ago
parent
commit
21be13652f
  1. 6
      src/style_manager/index.js
  2. 8
      src/style_manager/model/PropertyStack.js

6
src/style_manager/index.js

@ -109,7 +109,11 @@ export default () => {
this.__upProps();
this.__trgCustom();
});
this.model.listenTo(em, `styleable:change ${evLayerSelect}`, upProps);
this.model.listenTo(em, 'styleable:change', upProps);
// Triggers only custom event
const trgCustom = debounce(() => this.__trgCustom());
this.model.listenTo(em, evLayerSelect, trgCustom);
return this;
},

8
src/style_manager/model/PropertyStack.js

@ -32,9 +32,6 @@ export default Property.extend({
// Layer preview
preview: 0,
// Parse single layer value string
parseLayer: null,
// Custom layer label function
layerLabel: null,
@ -59,8 +56,6 @@ export default Property.extend({
if (opts.__up || !layer) return;
const name = prop.getName();
layer.upValues({ [name]: prop.__getFullValue() });
// const value = this.__getFullValue();
// this.upValue(value, opts);
this.__upTargetsStyleProps(opts);
},
@ -90,8 +85,7 @@ export default Property.extend({
// Update properties by layer value
values &&
this.getProperties().forEach(prop => {
const name = prop.getName();
const value = values[name];
const value = values[prop.getId()];
!isUndefined(value) && prop.upValue(value, { ...opts, __up: true });
});

Loading…
Cancel
Save