layout: add NewContext, make zero value Contexts useful

While here, unexport the Queue and Config fields. The NewContext
cosntructor is shorter, and there is no reason to expose the fields
to accidental mutation.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-12-02 13:13:15 +01:00
parent bbdedfa4a7
commit 11506a974e
4 changed files with 53 additions and 36 deletions
+1 -1
View File
@@ -114,7 +114,7 @@ func (e *Editor) processPointer(gtx *layout.Context) {
axis = gesture.Vertical
smin, smax = sbounds.Min.Y, sbounds.Max.Y
}
sdist := e.scroller.Scroll(gtx.Config, gtx.Queue, gtx.Now(), axis)
sdist := e.scroller.Scroll(gtx, gtx, gtx.Now(), axis)
var soff int
if e.SingleLine {
e.scrollRel(sdist, 0)