in packages/core/src/rendering/render-scroll-view.ts [243:265]
private fitIntoScrollBounds(scrollOffset: Point) {
const offset: Mut<Point> = Point.clone(scrollOffset)
if (this._scrollBounds & ScrollBounds.Horizontal) {
const { scrollLeftMax } = this
if (offset.x < 0) {
offset.x = 0
} else if (offset.x > scrollLeftMax) {
offset.x = scrollLeftMax
}
}
if (this._scrollBounds & ScrollBounds.Vertical) {
const { scrollTopMax } = this
if (offset.y < 0) {
offset.y = 0
} else if (offset.y > scrollTopMax) {
offset.y = scrollTopMax
}
}
return offset
}