window drag offset works
This commit is contained in:
parent
85eda6aeb8
commit
83e9787e75
|
@ -66,8 +66,10 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error {
|
||||||
}
|
}
|
||||||
for _, tk := range findByXY(mx, my) {
|
for _, tk := range findByXY(mx, my) {
|
||||||
if tk.node.WidgetType == widget.Window {
|
if tk.node.WidgetType == widget.Window {
|
||||||
log.Info("SENDING CLICK TO WINDOW")
|
tk.dragW = mx - tk.gocuiSize.w0
|
||||||
tk.doWidgetClick(mx, my)
|
tk.dragH = my - tk.gocuiSize.h0
|
||||||
|
log.Info("SENDING CLICK TO WINDOW", tk.dragW, tk.dragH)
|
||||||
|
tk.doWidgetClick(mx-tk.dragW, my-tk.dragH)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if tk.node.WidgetType == widget.Label {
|
if tk.node.WidgetType == widget.Label {
|
||||||
|
|
|
@ -93,7 +93,7 @@ func (tk *guiWidget) moveNew() {
|
||||||
w, h := me.baseGui.MousePosition()
|
w, h := me.baseGui.MousePosition()
|
||||||
if tk.node.WidgetType == widget.Window {
|
if tk.node.WidgetType == widget.Window {
|
||||||
tk.DrawAt(w, h)
|
tk.DrawAt(w, h)
|
||||||
tk.redrawWindow(w-2, h-2) // TODO: fix these hard coded things with offsets
|
tk.redrawWindow(w-tk.dragW, h-tk.dragH) // TODO: fix these hard coded things with offsets
|
||||||
// tk.dumpWidget(fmt.Sprintf("move(%dx%d) %s WIN", w, h, tk.cuiName))
|
// tk.dumpWidget(fmt.Sprintf("move(%dx%d) %s WIN", w, h, tk.cuiName))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,6 +101,8 @@ type guiWidget struct {
|
||||||
node *tree.Node // the pointer back to the tree
|
node *tree.Node // the pointer back to the tree
|
||||||
windowFrame *guiWidget // this is the frame for a window widget
|
windowFrame *guiWidget // this is the frame for a window widget
|
||||||
internal bool // indicates the widget is internal to gocui and should be treated differently
|
internal bool // indicates the widget is internal to gocui and should be treated differently
|
||||||
|
dragW int // when dragging a window, this is the offset to the mouse position
|
||||||
|
dragH int // when dragging a window, this is the offset to the mouse position
|
||||||
hasTabs bool // does the window have tabs?
|
hasTabs bool // does the window have tabs?
|
||||||
currentTab bool // the visible tab
|
currentTab bool // the visible tab
|
||||||
value string // ?
|
value string // ?
|
||||||
|
|
Loading…
Reference in New Issue