From c5e6c66338cdf7ddbd53dd64b265ab4a041ef59a Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 3 Feb 2025 00:07:48 -0600 Subject: [PATCH] can almost drag two different things --- eventBindings.go | 18 +++++++++++------- eventMouse.go | 1 + eventMouseMove.go | 12 +++++++----- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/eventBindings.go b/eventBindings.go index fe7b214..43c469b 100644 --- a/eventBindings.go +++ b/eventBindings.go @@ -75,26 +75,30 @@ func (tk *guiWidget) verifyRect() bool { } var ok bool = true if vw0 != tk.gocuiSize.w0 { - tk.dumpWidget("verifyRect() err w0") + // tk.dumpWidget("verifyRect() err w0") + tk.gocuiSize.w0 = vw0 ok = false } if vw1 != tk.gocuiSize.w1 { - tk.dumpWidget("verifyRect() err w1") + // tk.dumpWidget("verifyRect() err w1") + tk.gocuiSize.w0 = vw1 ok = false } if vh0 != tk.gocuiSize.h0 { - tk.dumpWidget("verifyRect() err h0") + // tk.dumpWidget("verifyRect() err h0") + tk.gocuiSize.h0 = vh0 ok = false } if vh1 != tk.gocuiSize.h1 { - tk.dumpWidget("verifyRect() err h1") + tk.gocuiSize.h1 = vh1 + // tk.dumpWidget("verifyRect() err h1") ok = false } if !ok { - log.Info("verifyRect() NEED TO FIX RECT HERE", tk.cuiName) - tk.dumpWidget("verifyRect() FIXME") + // log.Info("verifyRect() NEED TO FIX RECT HERE", tk.cuiName) + // tk.dumpWidget("verifyRect() FIXME") } - log.Printf("verifyRect() OK cuiName=%s v.Name=%s", tk.cuiName, tk.v.Name()) + // log.Printf("verifyRect() OK cuiName=%s v.Name=%s", tk.cuiName, tk.v.Name()) return true } diff --git a/eventMouse.go b/eventMouse.go index 9132a48..4ecfa57 100644 --- a/eventMouse.go +++ b/eventMouse.go @@ -25,6 +25,7 @@ func mouseUp(g *gocui.Gui, v *gocui.View) error { log.Info("mouseUp() setting me.globalMouseDown = false") me.globalMouseDown = false + currentDrag = nil dropdownUnclicked(w, h) diff --git a/eventMouseMove.go b/eventMouseMove.go index 51835cb..7c383a5 100644 --- a/eventMouseMove.go +++ b/eventMouseMove.go @@ -53,7 +53,7 @@ func mouseMove(g *gocui.Gui) { } for _, tk := range findByXY(w, h) { if tk.node.WidgetType == widget.Stdout { - // currentDrag = tk + currentDrag = tk // tk.moveNew(g) return } @@ -90,12 +90,14 @@ func (tk *guiWidget) moveNew(g *gocui.Gui) { if tk.node.WidgetType == widget.Flag { log.Info("MOVE FLAG") log.Info("MOVE FLAG") + // outputW, outputH := tk.Size() + // g.SetView(tk.cuiName, w-xOffset, h-yOffset, w-xOffset+outputW+20, h-yOffset+outputH+me.FramePadH+20, 0) + g.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) - outputW, outputH := tk.Size() - g.SetView(tk.cuiName, w-xOffset, h-yOffset, w-xOffset+outputW+20, h-yOffset+outputH+me.FramePadH+20, 0) - me.startOutputW = w - xOffset - me.startOutputH = h - yOffset + // me.startOutputW = w - xOffset + // me.startOutputH = h - yOffset // g.SetViewOnBottom(tk.cuiName) return } else {