Skip to content

Commit d1a5d70

Browse files
authored
fix: FancyButton loses disabled appearance when its views are replaced (test case attached) #223 (#224)
1 parent 8414036 commit d1a5d70

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/FancyButton.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,10 @@ export class FancyButton extends ButtonContainer
608608
set defaultView(view: GetViewSettings | null)
609609
{
610610
this.updateView('defaultView', view);
611+
if (this._views.disabledView && this.state !== 'default')
612+
{
613+
this._views.disabledView.visible = false;
614+
}
611615
}
612616

613617
/** Returns the default view of the button. */
@@ -639,7 +643,7 @@ export class FancyButton extends ButtonContainer
639643
set pressedView(view: GetViewSettings | null)
640644
{
641645
this.updateView('pressedView', view);
642-
if (this._views.pressedView)
646+
if (this._views.pressedView && this.state !== 'pressed')
643647
{
644648
this._views.pressedView.visible = false;
645649
}
@@ -655,7 +659,7 @@ export class FancyButton extends ButtonContainer
655659
set disabledView(view: GetViewSettings | null)
656660
{
657661
this.updateView('disabledView', view);
658-
if (this._views.disabledView)
662+
if (this._views.disabledView && this.state !== 'disabled')
659663
{
660664
this._views.disabledView.visible = false;
661665
}

0 commit comments

Comments
 (0)