Compare commits

...

2 Commits

View File

@ -24,6 +24,8 @@ func NewLabelSwatch (value color.Color, text string) *LabelSwatch {
box.SetRole(tomo.R("objects", "LabelSwatch")) box.SetRole(tomo.R("objects", "LabelSwatch"))
box.swatch.label = text box.swatch.label = text
box.label.SetAttr(tomo.AAlign(tomo.AlignStart, tomo.AlignMiddle)) box.label.SetAttr(tomo.AAlign(tomo.AlignStart, tomo.AlignMiddle))
box.label.SetSelectable(false)
box.label.SetFocusable(false)
box.Add(box.swatch) box.Add(box.swatch)
box.Add(box.label) box.Add(box.label)
box.SetAttr(tomo.ALayout(layouts.Row { false, true })) box.SetAttr(tomo.ALayout(layouts.Row { false, true }))
@ -61,12 +63,12 @@ func (this *LabelSwatch) OnConfirm (callback func ()) event.Cookie {
} }
func (this *LabelSwatch) handleButtonDown (button input.Button) bool { func (this *LabelSwatch) handleButtonDown (button input.Button) bool {
if button != input.ButtonLeft { return true } if !isClickingButton(button) { return true }
return true return true
} }
func (this *LabelSwatch) handleButtonUp (button input.Button) bool { func (this *LabelSwatch) handleButtonUp (button input.Button) bool {
if button != input.ButtonLeft { return true } if !isClickingButton(button) { return true }
if this.Window().MousePosition().In(this.Bounds()) { if this.Window().MousePosition().In(this.Bounds()) {
this.swatch.SetFocused(true) this.swatch.SetFocused(true)
this.swatch.Choose() this.swatch.Choose()