dropdown menus work pretty well

This commit is contained in:
Jeff Carr 2025-02-06 05:52:00 -06:00
parent 6d991fef63
commit 87141b8d99
2 changed files with 10 additions and 4 deletions

View File

@ -43,14 +43,15 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error {
w, h := g.MousePosition()
log.Info("mouseDown() stopping here. dropdwon menu is in effect")
for _, tk := range findByXY(w, h) {
if tk.node.WidgetType == widget.Flag {
log.Info("SENDING CLICK TO Dropdown Flag")
if (tk.node.WidgetType == widget.Flag) && (tk == me.dropdown.tk) {
log.Info("SENDING CLICK TO Flag (dropdown)")
tk.doWidgetClick(w, h)
me.dropdown.active = false
return nil
}
}
log.Info("never found dropdown")
me.dropdown.active = false
log.Info("never found dropdown at", w, h)
// me.dropdown.active = false
return nil
}

View File

@ -33,6 +33,11 @@ func mouseMove(g *gocui.Gui) {
}
}
if me.globalMouseDown && me.dropdown.active {
log.Info("can't drag while dropdown is active", w, h)
return
}
if me.globalMouseDown {
// log.Info("msgMouseDown == true")
// plugin will segfault if you don't keep this inside a check for msgMouseDown