|
|
|
@ -621,10 +621,6 @@ func (f *Form) focusIndex() int {
|
|
|
|
|
// MouseHandler returns the mouse handler for this primitive.
|
|
|
|
|
func (f *Form) MouseHandler() func(action MouseAction, event *tcell.EventMouse, setFocus func(p Primitive)) (consumed bool, capture Primitive) {
|
|
|
|
|
return f.WrapMouseHandler(func(action MouseAction, event *tcell.EventMouse, setFocus func(p Primitive)) (consumed bool, capture Primitive) {
|
|
|
|
|
if !f.InRect(event.Position()) {
|
|
|
|
|
return false, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// At the end, update f.focusedElement and prepare current item/button.
|
|
|
|
|
defer func() {
|
|
|
|
|
if consumed {
|
|
|
|
@ -651,7 +647,7 @@ func (f *Form) MouseHandler() func(action MouseAction, event *tcell.EventMouse,
|
|
|
|
|
|
|
|
|
|
// A mouse click anywhere else will return the focus to the last selected
|
|
|
|
|
// element.
|
|
|
|
|
if action == MouseLeftClick {
|
|
|
|
|
if action == MouseLeftClick && f.InRect(event.Position()) {
|
|
|
|
|
consumed = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|