~eliasnaur/gio

b796dd8e3bff5528190383409bdae8a303343ce4 — pierre a month ago b7dc407
layout: make list example use List.Position.Count

Counting the number of displayed elements via the ListElement function is incorrect.

Signed-off-by: pierre <pierre.curto@gmail.com>
1 files changed, 1 insertions(+), 3 deletions(-)

M layout/example_test.go
M layout/example_test.go => layout/example_test.go +1 -3
@@ 115,13 115,11 @@ func ExampleList() {
	const listLen = 1e6

	var list layout.List
	count := 0
	list.Layout(gtx, listLen, func(gtx layout.Context, i int) layout.Dimensions {
		count++
		return layoutWidget(gtx, 20, 20)
	})

	fmt.Println(count)
	fmt.Println(list.Position.Count)

	// Output:
	// 5