dragged a label kinda. exposed the real problems

This commit is contained in:
Jeff Carr 2025-02-01 20:13:08 -06:00
parent a069e6c984
commit 3125bbb258
1 changed files with 14 additions and 5 deletions

View File

@ -34,7 +34,7 @@ func mouseMove(g *gocui.Gui) {
}
if msgMouseDown {
log.Info("msgMouseDown == true")
// log.Info("msgMouseDown == true")
// plugin will segfault if you don't keep this inside a check for msgMouseDown
// don't move this code out of here
for _, tk := range findByXY(w, h) {
@ -66,11 +66,20 @@ func mouseMove(g *gocui.Gui) {
// this is how the window gets dragged around
func (tk *guiWidget) moveNew(g *gocui.Gui) {
mx, my := g.MousePosition()
w, h := g.MousePosition()
if tk.node.WidgetType == widget.Label {
s := fmt.Sprintf("move(%dx%d) %s ###", w, h, tk.cuiName)
tk.dumpWidget(s)
g.SetView(tk.cuiName, w-xOffset, h-yOffset, w-xOffset+outputW, h-yOffset+outputH+me.FramePadH, 0)
me.startOutputW = w - xOffset
me.startOutputH = h - yOffset
g.SetViewOnBottom(tk.cuiName)
return
}
tk.dumpWidget("moveNew() on " + tk.cuiName)
g.SetView("msg", mx-xOffset, my-yOffset, mx-xOffset+outputW, my-yOffset+outputH+me.FramePadH, 0)
me.startOutputW = mx - xOffset
me.startOutputH = my - yOffset
g.SetView("msg", w-xOffset, h-yOffset, w-xOffset+outputW, h-yOffset+outputH+me.FramePadH, 0)
me.startOutputW = w - xOffset
me.startOutputH = h - yOffset
g.SetViewOnBottom("msg")
}