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.__upProps();
this.__trgCustom(); 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; return this;
}, },

8
src/style_manager/model/PropertyStack.js

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

Loading…
Cancel
Save