2
0
mirror of https://github.com/rivo/tview.git synced 2024-11-12 19:10:28 +00:00

Fixed wrong mouse click test on drop-downs. Fixes #600

This commit is contained in:
Oliver 2021-05-28 20:06:28 +02:00
parent c723ed0769
commit 21d1a2de10

View File

@ -515,8 +515,8 @@ func (d *DropDown) MouseHandler() func(action MouseAction, event *tcell.EventMou
return d.WrapMouseHandler(func(action MouseAction, event *tcell.EventMouse, setFocus func(p Primitive)) (consumed bool, capture Primitive) {
// Was the mouse event in the drop-down box itself (or on its label)?
x, y := event.Position()
_, rectY, _, _ := d.GetInnerRect()
inRect := y == rectY
rectX, rectY, rectWidth, _ := d.GetInnerRect()
inRect := y == rectY && x >= rectX && x < rectX+rectWidth
if !d.open && !inRect {
return d.InRect(x, y), nil // No, and it's not expanded either. Ignore.
}