summaryrefslogtreecommitdiff
path: root/find.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-03 15:29:44 -0600
committerJeff Carr <[email protected]>2025-02-03 15:29:44 -0600
commit65622d01cd303f6e357d32e4ad6ab8b42755f74c (patch)
tree1fe480478ca2ee2c9594db341b9f5c3e5030550f /find.go
parentd61e03b87782945a6e96dee660dff05aac99253f (diff)
compute window size
Diffstat (limited to 'find.go')
-rw-r--r--find.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/find.go b/find.go
index b8f4d4c..30344de 100644
--- a/find.go
+++ b/find.go
@@ -57,6 +57,36 @@ func (tk *guiWidget) findByXYreal(w int, h int) []*guiWidget {
return widgets
}
+// 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) getFullSize() rectType {
+ var r rectType
+
+ r.w0 = tk.gocuiSize.w0
+ r.w1 = tk.gocuiSize.w1
+ r.h0 = tk.gocuiSize.h0
+ r.h1 = tk.gocuiSize.h1
+
+ // search through the children widgets in the binary tree
+ for _, child := range tk.children {
+ cr := child.getFullSize()
+ if r.w0 > cr.w0 {
+ r.w0 = cr.w0
+ }
+ if r.h0 > cr.h0 {
+ r.h0 = cr.h0
+ }
+ if r.w1 < cr.w1 {
+ r.w1 = cr.w1
+ }
+ if r.h1 < cr.h1 {
+ r.h1 = cr.h1
+ }
+ }
+
+ return r
+}
+
// returns the "highest priority widget under the mouse
func findUnderMouse() *guiWidget {
w, h := me.baseGui.MousePosition()