Skip to content

Commit

Permalink
do not draw a garbage frame while we are moving a window
Browse files Browse the repository at this point in the history
  • Loading branch information
aarzilli committed Sep 18, 2018
1 parent 44e883e commit d9b3ac4
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions nucular.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,26 @@ func (win *Window) style() *nstyle.Window {
}

func panelBegin(ctx *context, win *Window, title string) {
win.usingSub = false
in := &ctx.Input
style := &ctx.Style
font := style.Font
in := &ctx.Input
wstyle := win.style()

// window dragging
if win.moving {
if in == nil || !in.Mouse.Down(mouse.ButtonLeft) {
if win.flags&windowDocked == 0 && in != nil {
win.ctx.DockedWindows.Dock(win, in.Mouse.Pos, win.ctx.Windows[0].Bounds, win.ctx.Style.Scaling)
}
win.moving = false
} else {
win.move(in.Mouse.Delta, in.Mouse.Pos)
}
}

win.usingSub = false
in.Mouse.clip = nk_null_rect
layout := win.layout
wstyle := win.style()

window_padding := wstyle.Padding
item_spacing := wstyle.Spacing
Expand Down Expand Up @@ -358,17 +371,7 @@ func panelBegin(ctx *context, win *Window, title string) {
dwh.Draw(&win.ctx.Style, &win.cmds)
}

// window dragging
if win.moving {
if in == nil || !in.Mouse.Down(mouse.ButtonLeft) {
if win.flags&windowDocked == 0 && in != nil {
win.ctx.DockedWindows.Dock(win, in.Mouse.Pos, win.ctx.Windows[0].Bounds, win.ctx.Style.Scaling)
}
win.moving = false
} else {
win.move(in.Mouse.Delta, in.Mouse.Pos)
}
} else if (win.flags&WindowMovable != 0) && win.toplevel() {
if (win.flags&WindowMovable != 0) && win.toplevel() {
var move rect.Rect
move.X = win.Bounds.X
move.Y = win.Bounds.Y
Expand Down

0 comments on commit d9b3ac4

Please sign in to comment.