summaryrefslogtreecommitdiff
path: root/find.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-05 11:51:14 -0600
committerJeff Carr <[email protected]>2025-02-05 11:51:14 -0600
commitec68f448affd0af92142ff7d0a66850a2523e5c2 (patch)
treef85577522b3015a5483e1d9c37cf6ba470ed67b6 /find.go
parentae339cc587c57dfbe3263ad017258cfe8e7bfbc8 (diff)
dragging sometimes
Diffstat (limited to 'find.go')
-rw-r--r--find.go70
1 files changed, 66 insertions, 4 deletions
diff --git a/find.go b/find.go
index 3c76755..672fc40 100644
--- a/find.go
+++ b/find.go
@@ -32,6 +32,13 @@ func findByXY(w int, h int) []*guiWidget {
return rootW.findByXYreal(w, h)
}
+func (r rectType) inRect(w int, h int) bool {
+ if (r.w0 <= w) && (w <= r.w1) && (r.h0 <= h) && (h <= r.h1) {
+ return true
+ }
+ return false
+}
+
// this checks a widget to see if it is under (W,H), then checks the widget's children
// anything that matches is passed back as an array of widgets
func (tk *guiWidget) findByXYreal(w int, h int) []*guiWidget {
@@ -43,9 +50,16 @@ func (tk *guiWidget) findByXYreal(w int, h int) []*guiWidget {
// check the location to see if this is under (W,H)
// if it is, return this widget
- if (tk.gocuiSize.w0 <= w) && (w <= tk.gocuiSize.w1) &&
- (tk.gocuiSize.h0 <= h) && (h <= tk.gocuiSize.h1) {
+ // if (tk.gocuiSize.w0 <= w) && (w <= tk.gocuiSize.w1) &&
+ // (tk.gocuiSize.h0 <= h) && (h <= tk.gocuiSize.h1) {
+ if tk.gocuiSize.inRect(w, h) {
widgets = append(widgets, tk)
+ } else {
+ // if (tk.full.w0 <= w) && (w <= tk.full.w1) &&
+ // (tk.full.h0 <= h) && (h <= tk.full.h1) {
+ if tk.full.inRect(w, h) {
+ widgets = append(widgets, tk)
+ }
// log.Log(GOCUI, "findByXY() found", widget.node.WidgetType, w, h)
}
}
@@ -79,6 +93,54 @@ func (tk *guiWidget) findWindows() []*guiWidget {
return found
}
+/*
+var wtf bool
+
+func (tk *guiWidget) verifyRect() bool {
+ if !tk.Visible() {
+ // log.Info("verifyRect() tk is not visible", tk.cuiName)
+ return false
+ }
+ vw0, vh0, vw1, vh1, err := me.baseGui.ViewPosition(tk.cuiName)
+ if err != nil {
+ // log.Printf("verifyRect() gocui err=%v cuiName=%s v.Name=%s", err, tk.cuiName, tk.v.Name())
+ vw0, vh0, vw1, vh1, err = me.baseGui.ViewPosition(tk.v.Name())
+ if err != nil {
+ log.Printf("verifyRect() ACTUAL FAIL gocui err=%v cuiName=%s v.Name=%s", err, tk.cuiName, tk.v.Name())
+ return false
+ }
+ // return false
+ }
+ var ok bool = true
+ if vw0 != tk.full.w0 {
+ // log.Info("verifyRect() FIXING w0", tk.cuiName, vw0, vw1, vh0, vh1, tk.gocuiSize.w0, "w0 =", vw0)
+ tk.full.w0 = vw0
+ ok = false
+ }
+ if vw1 != tk.full.w1 {
+ // log.Info("verifyRect() FIXING w1", tk.cuiName, vw0, vw1, vh0, vh1, tk.gocuiSize.w1, "w1 =", vw1)
+ tk.full.w1 = vw1
+ ok = false
+ }
+ if vh0 != tk.full.h0 {
+ // log.Info("verifyRect() FIXING h0", tk.cuiName, vw0, vw1, vh0, vh1, tk.gocuiSize.h0)
+ tk.full.h0 = vh0
+ ok = false
+ }
+ if vh1 != tk.full.h1 {
+ // log.Info("verifyRect() FIXING h1", tk.cuiName, vw0, vw1, vh0, vh1, tk.gocuiSize.h1)
+ tk.full.h1 = vh1
+ ok = false
+ }
+ if !ok {
+ // 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())
+ return true
+}
+*/
+
func (tk *guiWidget) setFullSize() bool {
r := tk.getFullSize()
@@ -121,10 +183,10 @@ func (tk *guiWidget) gridFullSize() rectType {
r.w1 = cr.w1
r.h1 = cr.h1
first = false
- child.dumpWidget(fmt.Sprintf("grid(f)"))
+ // child.dumpWidget(fmt.Sprintf("grid(f)"))
continue
}
- child.dumpWidget(fmt.Sprintf("grid()"))
+ // child.dumpWidget(fmt.Sprintf("grid()"))
// use the lowest width and hight from children widgets
if r.w0 > cr.w0 {
r.w0 = cr.w0