windows kinda move around
This commit is contained in:
parent
acb0e43945
commit
d2c681f573
|
@ -52,11 +52,6 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error {
|
||||||
var found bool = false
|
var found bool = false
|
||||||
for _, tk := range findByXY(mx, my) {
|
for _, tk := range findByXY(mx, my) {
|
||||||
tk.dumpWidget("mouseDown()")
|
tk.dumpWidget("mouseDown()")
|
||||||
if tk.node.WidgetType == widget.Window {
|
|
||||||
log.Info("SENDING CLICK TO WINDOW")
|
|
||||||
tk.doWidgetClick(mx, my)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if tk.node.WidgetType == widget.Button {
|
if tk.node.WidgetType == widget.Button {
|
||||||
log.Info("SENDING CLICK TO Button")
|
log.Info("SENDING CLICK TO Button")
|
||||||
tk.doWidgetClick(mx, my)
|
tk.doWidgetClick(mx, my)
|
||||||
|
@ -67,6 +62,14 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error {
|
||||||
tk.doWidgetClick(mx, my)
|
tk.doWidgetClick(mx, my)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
found = true
|
||||||
|
}
|
||||||
|
for _, tk := range findByXY(mx, my) {
|
||||||
|
if tk.node.WidgetType == widget.Window {
|
||||||
|
log.Info("SENDING CLICK TO WINDOW")
|
||||||
|
tk.doWidgetClick(mx, my)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if tk.node.WidgetType == widget.Label {
|
if tk.node.WidgetType == widget.Label {
|
||||||
log.Info("IGNORE LABLE")
|
log.Info("IGNORE LABLE")
|
||||||
found = false
|
found = false
|
||||||
|
|
|
@ -27,10 +27,6 @@ func (tk *guiWidget) doWidgetClick(w int, h int) {
|
||||||
me.currentWindow.isCurrent = true
|
me.currentWindow.isCurrent = true
|
||||||
tk.active = false
|
tk.active = false
|
||||||
|
|
||||||
full := tk.getFullSize()
|
|
||||||
tk.gocuiSize.w1 = full.w1
|
|
||||||
tk.gocuiSize.h1 = full.h1
|
|
||||||
|
|
||||||
// draw the current window
|
// draw the current window
|
||||||
w := tk.gocuiSize.w0 + 4
|
w := tk.gocuiSize.w0 + 4
|
||||||
h := tk.gocuiSize.h0 + 4
|
h := tk.gocuiSize.h0 + 4
|
||||||
|
@ -38,6 +34,11 @@ func (tk *guiWidget) doWidgetClick(w int, h int) {
|
||||||
tk.setColor(&colorActiveW)
|
tk.setColor(&colorActiveW)
|
||||||
tk.showWidgets()
|
tk.showWidgets()
|
||||||
tk.placeWidgets(w, h) // compute the sizes & places for each widget
|
tk.placeWidgets(w, h) // compute the sizes & places for each widget
|
||||||
|
|
||||||
|
full := tk.getFullSize()
|
||||||
|
tk.gocuiSize.w1 = full.w1
|
||||||
|
tk.gocuiSize.h1 = full.h1
|
||||||
|
me.baseGui.SetView(tk.cuiName, tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1, 0)
|
||||||
case widget.Group:
|
case widget.Group:
|
||||||
if tk.active {
|
if tk.active {
|
||||||
tk.active = false
|
tk.active = false
|
||||||
|
@ -116,6 +117,14 @@ func click(g *gocui.Gui, v *gocui.View) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Button widgets
|
||||||
|
for _, tk := range findByXY(w, h) {
|
||||||
|
if tk.node.WidgetType == widget.Button {
|
||||||
|
tk.doWidgetClick(w, h)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, tk := range findByXY(w, h) {
|
for _, tk := range findByXY(w, h) {
|
||||||
// will show you everything found on a mouse click. great for debugging!
|
// will show you everything found on a mouse click. great for debugging!
|
||||||
// tk.dumpWidget("click()")
|
// tk.dumpWidget("click()")
|
||||||
|
|
Loading…
Reference in New Issue