finally drag works everywhere

This commit is contained in:
Jeff Carr 2025-02-07 02:44:52 -06:00
parent 7813fc126d
commit 0b67b198bd
3 changed files with 15 additions and 10 deletions

View File

@ -121,6 +121,7 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error {
// return nil
}
/*
// this needs to go
// event triggers when you push down on a mouse button
func msgDown(g *gocui.Gui, v *gocui.View) error {
@ -150,3 +151,4 @@ func msgDown(g *gocui.Gui, v *gocui.View) error {
// msgMouseDown = true
return nil
}
*/

View File

@ -119,7 +119,8 @@ func (tk *guiWidget) moveNew() {
s := fmt.Sprintf("move(%dx%d) %s ###", w, h, tk.cuiName)
tk.dumpWidget(s)
return
} else {
}
if tk.node.WidgetType == widget.Stdout {
if me.stdout.resize {
newW := w - me.stdout.lastW
newH := h - me.stdout.lastH
@ -130,10 +131,12 @@ func (tk *guiWidget) moveNew() {
// me.stdout.lastH = h - me.stdout.mouseOffsetH
tk.relocateStdout(me.stdout.lastW, me.stdout.lastH)
} else {
// tk.dumpWidget(fmt.Sprintf("move(%dx%d) %s", w, h, tk.cuiName))
// log.Info("Resize false", w, h)
me.stdout.lastW = w - me.stdout.mouseOffsetW
me.stdout.lastH = h - me.stdout.mouseOffsetH
tk.relocateStdout(me.stdout.lastW, me.stdout.lastH)
// me.stdout.lastW = w - me.stdout.mouseOffsetW
// me.stdout.lastH = h - me.stdout.mouseOffsetH
// tk.relocateStdout(me.stdout.lastW, me.stdout.lastH)
tk.relocateStdout(w-tk.dragW, h-tk.dragH)
}
}
// always place the help menu on top

View File

@ -83,12 +83,12 @@ type stdout struct {
outputOffscreen bool // is the STDOUT window offscreen?
lastW int // the last 'w' location (used to move from offscreen to onscreen)
lastH int // the last 'h' location (used to move from offscreen to onscreen)
mouseOffsetW int // the current 'w' offset
mouseOffsetH int // the current 'h' offset
init bool // moves the window offscreen on startup
resize bool // user is resizing the window
outputS []string // the buffer of all the output
pager int // allows the user to page through the buffer
// mouseOffsetW int // the current 'w' offset
// mouseOffsetH int // the current 'h' offset
init bool // moves the window offscreen on startup
resize bool // user is resizing the window
outputS []string // the buffer of all the output
pager int // allows the user to page through the buffer
}
// settings for the dropdown window