From 31343ce4cb44713001620237c73ff7372489574a Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Sun, 15 Nov 2020 23:18:12 +0100 Subject: [PATCH] Replace getTarget with getFirstTarget --- src/style_manager/view/PropertyStackView.js | 4 ++-- src/style_manager/view/PropertyView.js | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/style_manager/view/PropertyStackView.js b/src/style_manager/view/PropertyStackView.js index 2dc790155..446f7140a 100644 --- a/src/style_manager/view/PropertyStackView.js +++ b/src/style_manager/view/PropertyStackView.js @@ -191,7 +191,7 @@ export default PropertyCompositeView.extend({ const layers = this.getLayers(); const detached = model.get('detached'); const property = model.get('property'); - const target = this.getTarget(); + const target = this.getFirstTarget(); const valueComput = this.getComputedValue(); const selected = em.getSelected(); const updateOpts = { fromTarget: 1 }; @@ -281,7 +281,7 @@ export default PropertyCompositeView.extend({ getTargetValue(opts = {}) { const { model } = this; const { detached } = model.attributes; - const target = this.getTarget(); + const target = this.getFirstTarget(); let result = PropertyCompositeView.prototype.getTargetValue.call( this, opts diff --git a/src/style_manager/view/PropertyView.js b/src/style_manager/view/PropertyView.js index 427fea3b9..a6d672e89 100644 --- a/src/style_manager/view/PropertyView.js +++ b/src/style_manager/view/PropertyView.js @@ -170,6 +170,10 @@ export default Backbone.View.extend({ return targets || [this.getTarget()]; }, + getFirstTarget() { + return this.getTargets()[0]; + }, + /** * Returns Styleable model * @return {Model|null} @@ -212,7 +216,7 @@ export default Backbone.View.extend({ emitUpdateTarget: debounce(function() { const em = this.config.em; - em && em.trigger('styleManager:update:target', this.getTarget()); + em && em.trigger('styleManager:update:target', this.getFirstTarget()); }), _getTargetData() { @@ -345,7 +349,7 @@ export default Backbone.View.extend({ getTargetValue(opts = {}) { let result; const { model } = this; - const target = this.getTargets()[0]; + const target = this.getFirstTarget(); const customFetchValue = this.customValue; if (!target) { @@ -463,7 +467,7 @@ export default Backbone.View.extend({ */ updateTargetStyle(value, name = '', opts = {}) { const property = name || this.model.get('property'); - const target = opts.target || this.getTarget(); + const target = opts.target || this.getFirstTarget(); const style = target.getStyle(); if (value) { @@ -492,7 +496,7 @@ export default Backbone.View.extend({ * @return {Boolean} */ isTargetStylable(target) { - const trg = target || this.getTarget(); + const trg = target || this.getFirstTarget(); const model = this.model; const id = model.get('id'); const property = model.get('property');