From 0b67b198bdc439c62ac2e6a7cc18bd4be128faf7 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 7 Feb 2025 02:44:52 -0600 Subject: [PATCH] finally drag works everywhere --- eventMouse.go | 2 ++ eventMouseMove.go | 11 +++++++---- structs.go | 12 ++++++------ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/eventMouse.go b/eventMouse.go index fb1a4a9..4c779cb 100644 --- a/eventMouse.go +++ b/eventMouse.go @@ -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 } +*/ diff --git a/eventMouseMove.go b/eventMouseMove.go index 54ac2f8..b73c013 100644 --- a/eventMouseMove.go +++ b/eventMouseMove.go @@ -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 diff --git a/structs.go b/structs.go index 6c6ca45..b32c059 100644 --- a/structs.go +++ b/structs.go @@ -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