/
githubmirror
/
fullPage.js
Обзор
Документация
Войти
/
githubmirror
/
fullPage.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/js/mouse/move.js
33 строки
886 B
Alvaro Trigo López
- v4 version
16 мар 2022, 21:03
16 мар 2022, 21:03
902c448
Код
Авторство
О чём код?
import { getIsScrollAllowed } from '../common/isScrollAllowed.js'; import { getOptions } from '../common/options.js'; import { moveSectionDown } from '../scroll/moveSectionDown.js'; import { moveSectionUp } from '../scroll/moveSectionUp.js'; import { state } from '../common/state.js'; let oldPageY = 0; /** * Detecting the direction of the mouse movement. * Used only for the middle button of the mouse. */ export function mouseMoveHandler(e) { if (!getOptions().autoScrolling) { return; } if (state.canScroll) { // moving up if (e.pageY < oldPageY && getIsScrollAllowed().m.up) { moveSectionUp(); } // moving down else if (e.pageY > oldPageY && getIsScrollAllowed().m.down) { moveSectionDown(); } } oldPageY = e.pageY; } export function setOldPageY(value){ oldPageY = value; }