mouse click vs drag works
This commit is contained in:
parent
0aa82f5ba5
commit
44264df09d
|
@ -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.mouse.mouseUp = true
|
||||||
me.globalMouseDown = false
|
me.globalMouseDown = false
|
||||||
me.currentDrag = nil
|
me.currentDrag = nil
|
||||||
|
@ -35,8 +39,8 @@ func mouseUp(g *gocui.Gui, v *gocui.View) error {
|
||||||
// widget was underneath so you can active
|
// widget was underneath so you can active
|
||||||
// the right response for the toolkit user's app
|
// the right response for the toolkit user's app
|
||||||
func mouseDown(g *gocui.Gui, v *gocui.View) error {
|
func mouseDown(g *gocui.Gui, v *gocui.View) error {
|
||||||
me.globalMouseDown = true
|
|
||||||
if me.mouse.mouseUp {
|
if me.mouse.mouseUp {
|
||||||
|
me.globalMouseDown = true
|
||||||
me.mouse.mouseUp = false
|
me.mouse.mouseUp = false
|
||||||
me.mouse.down = time.Now()
|
me.mouse.down = time.Now()
|
||||||
w, h := g.MousePosition()
|
w, h := g.MousePosition()
|
||||||
|
|
|
@ -13,6 +13,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/awesome-gocui/gocui"
|
"github.com/awesome-gocui/gocui"
|
||||||
log "go.wit.com/log"
|
log "go.wit.com/log"
|
||||||
|
@ -32,12 +33,10 @@ func mouseMove(g *gocui.Gui) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
if time.Since(me.mouse.down) < me.mouse.clicktime {
|
||||||
if time.Since(me.mouse.down) < me.mouse.clicktime {
|
// log.Info("not yet")
|
||||||
log.Info("not yet")
|
return
|
||||||
return
|
}
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
w, h := g.MousePosition()
|
w, h := g.MousePosition()
|
||||||
// toggle off all highlight vies except for whatever is under the mouse
|
// toggle off all highlight vies except for whatever is under the mouse
|
||||||
|
|
2
init.go
2
init.go
|
@ -51,7 +51,7 @@ func init() {
|
||||||
me.stdout.wId = -4
|
me.stdout.wId = -4
|
||||||
|
|
||||||
me.mouse.mouseUp = true
|
me.mouse.mouseUp = true
|
||||||
me.mouse.clicktime = time.Millisecond * 500
|
me.mouse.clicktime = time.Millisecond * 100
|
||||||
|
|
||||||
me.myTree = tree.New()
|
me.myTree = tree.New()
|
||||||
me.myTree.PluginName = "gocui"
|
me.myTree.PluginName = "gocui"
|
||||||
|
|
Loading…
Reference in New Issue