mouse click vs drag works

This commit is contained in:
Jeff Carr 2025-02-08 08:12:39 -06:00
parent 0aa82f5ba5
commit 44264df09d
3 changed files with 11 additions and 8 deletions

View File

@ -22,6 +22,10 @@ func mouseUp(g *gocui.Gui, v *gocui.View) error {
}
*/
if time.Since(me.mouse.down) < me.mouse.clicktime {
log.Info("was a mouse click, not a drag")
}
me.mouse.mouseUp = true
me.globalMouseDown = false
me.currentDrag = nil
@ -35,8 +39,8 @@ func mouseUp(g *gocui.Gui, v *gocui.View) error {
// widget was underneath so you can active
// the right response for the toolkit user's app
func mouseDown(g *gocui.Gui, v *gocui.View) error {
me.globalMouseDown = true
if me.mouse.mouseUp {
me.globalMouseDown = true
me.mouse.mouseUp = false
me.mouse.down = time.Now()
w, h := g.MousePosition()

View File

@ -13,6 +13,7 @@ package main
import (
"fmt"
"time"
"github.com/awesome-gocui/gocui"
log "go.wit.com/log"
@ -32,12 +33,10 @@ func mouseMove(g *gocui.Gui) {
}
}
/*
if time.Since(me.mouse.down) < me.mouse.clicktime {
log.Info("not yet")
// log.Info("not yet")
return
}
*/
w, h := g.MousePosition()
// toggle off all highlight vies except for whatever is under the mouse

View File

@ -51,7 +51,7 @@ func init() {
me.stdout.wId = -4
me.mouse.mouseUp = true
me.mouse.clicktime = time.Millisecond * 500
me.mouse.clicktime = time.Millisecond * 100
me.myTree = tree.New()
me.myTree.PluginName = "gocui"