From 034af414227dd15287ba3ce1635501b8003fee23 Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Fri, 26 Apr 2024 14:50:22 -0700 Subject: [PATCH] FeathersControl: add missing parts of @:style implementation --- src/feathers/core/FeathersControl.hx | 32 ++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/feathers/core/FeathersControl.hx b/src/feathers/core/FeathersControl.hx index b589809c..8bedcac6 100644 --- a/src/feathers/core/FeathersControl.hx +++ b/src/feathers/core/FeathersControl.hx @@ -352,7 +352,7 @@ class FeathersControl extends MeasureSprite implements IUIControl implements IVa private var _disabledAlpha:Null = null; /** - When `_disabledAlpha` is not `null`, sets the `alpha` property to this + When `disabledAlpha` is not `null`, sets the `alpha` property to this value when the the `enabled` property is set to `false`. @since 1.0.0 @@ -360,17 +360,24 @@ class FeathersControl extends MeasureSprite implements IUIControl implements IVa @:style public var disabledAlpha(get, set):Null; - private function get_disabledAlpha():Null - { + private function get_disabledAlpha():Null { return this._disabledAlpha; } - private function set_disabledAlpha(value:Null):Null - { - //Avoids removing the same value check in the enabled property setter - this._enabled = !this._enabled; - _disabledAlpha = value; - this.set_enabled(!this._enabled); + private function set_disabledAlpha(value:Null):Null { + if (!this.setStyle("disabledAlpha")) { + return this._disabledAlpha; + } + // in a -final build, this forces the clearStyle + // function to be kept if the property is kept + // otherwise, it would be removed by dce + this._previousClearStyle = this.clearStyle_disabledAlpha; + this._disabledAlpha = value; + if (this._enabled || this._disabledAlpha == null) { + super.alpha = this._explicitAlpha; + } else if (!this._enabled && this._disabledAlpha != null) { + super.alpha = this._disabledAlpha; + } return this._disabledAlpha; } @@ -627,6 +634,13 @@ class FeathersControl extends MeasureSprite implements IUIControl implements IVa return this._focusRectSkin; } + @:noCompletion + private function clearStyle_disabledAlpha():Null { + this._disabledAlpha = null; + super.alpha = this._explicitAlpha; + return this._disabledAlpha; + } + @:noCompletion private function clearStyle_focusPaddingTop():Float { this._focusPaddingTop = 0.0;