From 21be13652f91dcea8f13f1206ed43aa1d9e5e7b6 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Tue, 14 Dec 2021 16:36:38 +0100 Subject: [PATCH] Trigger only the custom event for layer change --- src/style_manager/index.js | 6 +++++- src/style_manager/model/PropertyStack.js | 8 +------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/style_manager/index.js b/src/style_manager/index.js index 21372cf0e..98d311b10 100644 --- a/src/style_manager/index.js +++ b/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; }, diff --git a/src/style_manager/model/PropertyStack.js b/src/style_manager/model/PropertyStack.js index 0cefc13fd..8b09efb2e 100644 --- a/src/style_manager/model/PropertyStack.js +++ b/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 }); });