From f1c72e114ba764cd147ab4f6bb748cf6169b210f Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Sun, 1 Mar 2020 14:33:38 +0100 Subject: [PATCH] Fix parent style selecting for detached style properties --- src/style_manager/view/PropertyStackView.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/style_manager/view/PropertyStackView.js b/src/style_manager/view/PropertyStackView.js index c67187b46..6c565d9a7 100644 --- a/src/style_manager/view/PropertyStackView.js +++ b/src/style_manager/view/PropertyStackView.js @@ -165,7 +165,7 @@ export default PropertyCompositeView.extend({ const target = this.getTarget(); const valueComput = this.getComputedValue(); const selected = em.getSelected(); - let style, targetAlt, targetAltDevice; + let style, targetAlt, targetAltDevice, valueTargetAlt, valueTrgAltDvc; // With detached layers values will be assigned to their properties if (detached) { @@ -182,21 +182,22 @@ export default PropertyCompositeView.extend({ // that means the style might exist in some other place if (!keys(style).length && valueComput && selected) { // Styles of the same target but with a higher rule - targetAltDevice = this._getParentTarget(target, { - isValid: rule => hasDetachedStyle(rule) - }); + const parentOpts = { isValid: rule => hasDetachedStyle(rule) }; + targetAltDevice = this._getParentTarget(target, parentOpts); if (targetAltDevice) { style = targetAltDevice.getStyle(); } else { // The target is a component but the style is in the class rules targetAlt = this._getClassRule(); - const valueTargetAlt = - hasDetachedStyle(targetAlt) && targetAlt.getStyle(); + valueTargetAlt = hasDetachedStyle(targetAlt) && targetAlt.getStyle(); targetAltDevice = !valueTargetAlt && - this._getParentTarget(this._getClassRule({ skipAdd: 0 })); - const valueTrgAltDvc = + this._getParentTarget( + this._getClassRule({ skipAdd: 0 }), + parentOpts + ); + valueTrgAltDvc = hasDetachedStyle(targetAltDevice) && targetAltDevice.getStyle(); style = valueTargetAlt || valueTrgAltDvc || {}; }