ctrlutil.go
func ThumbPosition(itemNo, itemCount, length int) int {
	length -= 2
	if itemNo < 0 {
		return -1
	}
	if itemNo >= itemCount-1 {
		return length - 1
	}

	if length < 4 {
		return 0
	}

	ydiff := int(float32(itemNo) / float32(itemCount-1.0) * float32(length-1))
	return ydiff
}
func ThumbPosition(itemNo, itemCount, length int) int {
	length -= 2
	if itemNo < 0 {
		return -1
	}
	if itemNo >= itemCount-1 {
		return length - 1
	}

	if length < 4 {
		return 0
	}

	ydiff := int(float32(itemNo) / float32(itemCount-1.0) * float32(length-1))
	return ydiff
}
func ThumbPosition ( itemNo , itemCount , length int ) int { length -= 2 if itemNo < 0 { return - 1 } if itemNo >= itemCount - 1 { return length - 1 } if length < 4 { return 0 } ydiff := int ( float32 ( itemNo ) / float32 ( itemCount - 1.0 ) * float32 ( length - 1 ) ) return ydiff }
// ThumbPosition returns a scrollbar thumb position depending
// on currently active item(itemNo), total number of items
// (itemCount), and length/height of the scrollbar(length)
// including arrows. Returns position in interval of (1..lenght-2)
// or -1 if the thumb is not visible
ThumbPosition returns a scrollbar thumb position depending on currently active item ( itemNo ) total number of items ( itemCount ) and length / height of the scrollbar ( length ) including arrows . Returns position in interval of ( 1 .. lenght - 2 ) or - 1 if the thumb is not visible