diff options
Diffstat (limited to 'eventMouseDrag.go')
| -rw-r--r-- | eventMouseDrag.go | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/eventMouseDrag.go b/eventMouseDrag.go index 649b755..2829708 100644 --- a/eventMouseDrag.go +++ b/eventMouseDrag.go @@ -27,12 +27,14 @@ func mouseMove(g *gocui.Gui) { // this runs while the user moves the mouse. this highlights text // toggle off all highlight views except for whatever is under the mouse + // START HIGHLIGHTING for _, view := range g.Views() { view.Highlight = false } w, h := g.MousePosition() + // TODO: try to highlight entire grid rows if v, err := g.ViewByPosition(w, h); err == nil { - // todo: identify and highlight grid rows here + // block anything from highlighting while a dialog box is open if me.dropdown.active || me.textbox.active { if me.dropdown.tk != nil && me.dropdown.tk.v == v { v.Highlight = true @@ -44,8 +46,9 @@ func mouseMove(g *gocui.Gui) { v.Highlight = true } } + // END HIGHLIGHTING - // very useful for debugging in the past. also, just fun + // Super Mouse Mode. very useful for debugging in the past. also, just fun if me.supermouse { w, h := g.MousePosition() for _, tk := range findByXY(w, h) { @@ -54,10 +57,13 @@ func mouseMove(g *gocui.Gui) { } } + // how long has the mouse button been pressed down? if time.Since(me.mouse.down) < me.mouse.clicktime { // log.Info("not yet") return } + // okay, the mouse button has been pressed down for a while. + // below here is mouse dragging if me.dropdown.active || me.textbox.active { // can't drag or do anything when dropdown or textbox are visible @@ -107,13 +113,15 @@ func (tk *guiWidget) moveNew() { tk.makeWindowActive() return } - if tk.node.WidgetType == widget.Flag { - me.baseGui.SetView(tk.cuiName, w-3, h-3, w+20, h+20, 0) - // tk.verifyRect() - s := fmt.Sprintf("move(%dx%d) %s ###", w, h, tk.cuiName) - tk.dumpWidget(s) - return - } + /* + if tk.node.WidgetType == widget.Flag { + me.baseGui.SetView(tk.cuiName, w-3, h-3, w+20, h+20, 0) + // tk.verifyRect() + s := fmt.Sprintf("move(%dx%d) %s ###", w, h, tk.cuiName) + tk.dumpWidget(s) + return + } + */ if tk.node.WidgetType == widget.Stdout { if me.mouse.resize { newW := w - me.stdout.lastW @@ -132,7 +140,6 @@ func (tk *guiWidget) moveNew() { tk.relocateStdout(newW, newH) // log.Info("Resize false", w, h, newW, newH) } + setThingsOnTop() // sets help, Stdout, etc on the top after windows have been redrawn } - // always place the help menu on top - setThingsOnTop() // sets help, Stdout, etc on the top after windows have been redrawn } |
