Skip to content

Commit

Permalink
FeathersControl: add missing parts of @:style implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtynjala authored Apr 26, 2024
1 parent 0dbd899 commit 034af41
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions src/feathers/core/FeathersControl.hx
Original file line number Diff line number Diff line change
Expand Up @@ -352,25 +352,32 @@ class FeathersControl extends MeasureSprite implements IUIControl implements IVa

private var _disabledAlpha:Null<Float> = 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
**/
@:style
public var disabledAlpha(get, set):Null<Float>;

private function get_disabledAlpha():Null<Float>
{
private function get_disabledAlpha():Null<Float> {
return this._disabledAlpha;
}

private function set_disabledAlpha(value:Null<Float>):Null<Float>
{
//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<Float>):Null<Float> {
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;
}

Expand Down Expand Up @@ -627,6 +634,13 @@ class FeathersControl extends MeasureSprite implements IUIControl implements IVa
return this._focusRectSkin;
}

@:noCompletion
private function clearStyle_disabledAlpha():Null<Float> {
this._disabledAlpha = null;
super.alpha = this._explicitAlpha;
return this._disabledAlpha;
}

@:noCompletion
private function clearStyle_focusPaddingTop():Float {
this._focusPaddingTop = 0.0;
Expand Down

0 comments on commit 034af41

Please sign in to comment.