Browse Source

Add name prop to fromStyle

pull/4144/head
Artur Arseniev 4 years ago
parent
commit
b7a8fb1d11
  1. 5
      src/style_manager/model/PropertyComposite.js
  2. 2
      src/style_manager/model/PropertyStack.js

5
src/style_manager/model/PropertyComposite.js

@ -272,14 +272,15 @@ export default class PropertyComposite extends Property {
if (!this.__styleHasProps(style)) return null;
const { byName } = opts;
const name = this.getName();
const props = this.getProperties();
const sep = this.getSplitSeparator();
const fromStyle = this.get('fromStyle');
let result = fromStyle ? fromStyle(style, { property: this, separator: sep }) : {};
let result = fromStyle ? fromStyle(style, { property: this, name, separator: sep }) : {};
if (!fromStyle) {
// Get props from the main property
result = this.__getSplitValue(style[this.getName()] || '', { byName });
result = this.__getSplitValue(style[name] || '', { byName });
// Get props from the inner properties
props.forEach(prop => {

2
src/style_manager/model/PropertyStack.js

@ -373,7 +373,7 @@ export default class PropertyStack extends PropertyComposite {
const props = this.getProperties();
const sep = this.getLayerSeparator();
const fromStyle = this.get('fromStyle');
let result = fromStyle ? fromStyle(style, { property: this, separatorLayers: sep }) : [];
let result = fromStyle ? fromStyle(style, { property: this, name, separatorLayers: sep }) : [];
if (!fromStyle) {
// Get layers from the main property

Loading…
Cancel
Save