Browse Source

Replace getTarget with getFirstTarget

pull/3147/head
Artur Arseniev 6 years ago
parent
commit
31343ce4cb
  1. 4
      src/style_manager/view/PropertyStackView.js
  2. 12
      src/style_manager/view/PropertyView.js

4
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

12
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');

Loading…
Cancel
Save