Added ScrollContainer

This commit is contained in:
2023-09-15 01:47:58 -04:00
parent 71bc235c0e
commit e45e391f6d
2 changed files with 174 additions and 1 deletions

View File

@@ -278,7 +278,13 @@ func (this scrollbarLayout) Arrange (hints tomo.LayoutHints, boxes []tomo.Box) {
// calculate handle length
handleLength := gutterLength * this.viewportContentRatio()
if handleLength < handleMin { handleLength = handleMin }
if handleLength > gutterLength { handleLength = gutterLength }
if handleLength >= gutterLength {
// just hide the handle if it isn't needed.
// TODO: we need a way to hide and show boxes, this is janky as
// fuck
boxes[0].SetBounds(image.Rect(-16, -16, 0, 0))
return
}
if this.vertical {
handle.Max.Y = int(handleLength)
} else {