/
githubmirror
/
react-beautiful-dnd
Обзор
Документация
Войти
/
githubmirror
/
react-beautiful-dnd
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/state/get-max-scroll.js
30 строк
586 B
Alex Reardon
Merging dev to master (#607)
03 июл 2018, 10:20
Не верифицирован
03 июл 2018, 10:20
fc4e638
Код
Авторство
О чём код?
// @flow import { type Position } from 'css-box-model'; import { subtract } from './position'; type Args = {| scrollHeight: number, scrollWidth: number, height: number, width: number, |}; export default ({ scrollHeight, scrollWidth, height, width, }: Args): Position => { const maxScroll: Position = subtract( // full size { x: scrollWidth, y: scrollHeight }, // viewport size { x: width, y: height }, ); const adjustedMaxScroll: Position = { x: Math.max(0, maxScroll.x), y: Math.max(0, maxScroll.y), }; return adjustedMaxScroll; };