Skip to content

Commit d9b3ac4

Browse files
committed
do not draw a garbage frame while we are moving a window
1 parent 44e883e commit d9b3ac4

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

nucular.go

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,26 @@ func (win *Window) style() *nstyle.Window {
216216
}
217217

218218
func panelBegin(ctx *context, win *Window, title string) {
219-
win.usingSub = false
219+
in := &ctx.Input
220220
style := &ctx.Style
221221
font := style.Font
222-
in := &ctx.Input
222+
wstyle := win.style()
223+
224+
// window dragging
225+
if win.moving {
226+
if in == nil || !in.Mouse.Down(mouse.ButtonLeft) {
227+
if win.flags&windowDocked == 0 && in != nil {
228+
win.ctx.DockedWindows.Dock(win, in.Mouse.Pos, win.ctx.Windows[0].Bounds, win.ctx.Style.Scaling)
229+
}
230+
win.moving = false
231+
} else {
232+
win.move(in.Mouse.Delta, in.Mouse.Pos)
233+
}
234+
}
235+
236+
win.usingSub = false
223237
in.Mouse.clip = nk_null_rect
224238
layout := win.layout
225-
wstyle := win.style()
226239

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

361-
// window dragging
362-
if win.moving {
363-
if in == nil || !in.Mouse.Down(mouse.ButtonLeft) {
364-
if win.flags&windowDocked == 0 && in != nil {
365-
win.ctx.DockedWindows.Dock(win, in.Mouse.Pos, win.ctx.Windows[0].Bounds, win.ctx.Style.Scaling)
366-
}
367-
win.moving = false
368-
} else {
369-
win.move(in.Mouse.Delta, in.Mouse.Pos)
370-
}
371-
} else if (win.flags&WindowMovable != 0) && win.toplevel() {
374+
if (win.flags&WindowMovable != 0) && win.toplevel() {
372375
var move rect.Rect
373376
move.X = win.Bounds.X
374377
move.Y = win.Bounds.Y

0 commit comments

Comments
 (0)