Skip to content

Commit

Permalink
list: focus on middle of selected element
Browse files Browse the repository at this point in the history
  • Loading branch information
mjl- committed Feb 20, 2018
1 parent b65709b commit af7334a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion list.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ func (ui *List) firstSelected() int {
}

func (ui *List) FirstFocus(dui *DUI, self *Kid) *image.Point {
p := image.Pt(0, maximum(0, ui.firstSelected())*ui.rowHeight(dui))
rowHeight := ui.rowHeight(dui)
p := image.Pt(self.R.Dx()/2, maximum(0, ui.firstSelected())*rowHeight+rowHeight/2)
return &p
}

Expand Down

0 comments on commit af7334a

Please sign in to comment.