Clamps a scroll offset so the content never pulls away from the top or leaves a gap past the bottom. When the content is shorter than the viewport the only offset is 0.
import { scrollOffset } from '@datamoc/mw_games/two-d/ui';console.log(scrollOffset(-5, 500, 200)); // 0console.log(scrollOffset(900, 500, 200)); // 300 Copy
import { scrollOffset } from '@datamoc/mw_games/two-d/ui';console.log(scrollOffset(-5, 500, 200)); // 0console.log(scrollOffset(900, 500, 200)); // 300
Clamps a scroll offset so the content never pulls away from the top or leaves a gap past the bottom. When the content is shorter than the viewport the only offset is 0.