From 0f78406cde7890f3f9b16cd0ba55afac4c9065cf Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 25 Jun 2025 17:10:24 -0500 Subject: improve prompt cancellation The cancel button was overlaying the submit button preventing the submission of a prompt. Distinguish between cancelable and mandatory prompt. Only^ allow cancelable prompts to be removed. Fixes: 37acd982 --- go/ui/prompt.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'go/ui') diff --git a/go/ui/prompt.go b/go/ui/prompt.go index a7f2ce07..a289ae13 100644 --- a/go/ui/prompt.go +++ b/go/ui/prompt.go @@ -17,6 +17,7 @@ type Prompt struct { y, width int action game.Action components []Widget + cancelable bool } func NewPrompt(y, width int, action game.Action, promptText string) *Prompt { @@ -30,10 +31,15 @@ func NewPrompt(y, width int, action game.Action, promptText string) *Prompt { return p } -func (p *Prompt) Action() game.Action { - return p.action +func NewCancelablePrompt(y, width int, action game.Action, promptText string) *Prompt { + p := NewPrompt(y, width, action, promptText) + p.cancelable = true + return p } +func (p *Prompt) Cancelable() bool { return p.cancelable } +func (p *Prompt) Action() game.Action { return p.action } + func (p *Prompt) Add(obj interface{}) error { if handCard, ok := obj.(HandCard); ok { obj = handCard.C -- cgit v1.2.3