Skip to content

Commit

Permalink
chore(touch): remove useless vars
Browse files Browse the repository at this point in the history
  • Loading branch information
idiotWu committed Nov 17, 2017
1 parent 768f80e commit 222434c
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/events/touch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import {
TouchRecord,
} from '../utils/';

let activeScrollbar: I.Scrollbar | null;

export function touchHandler(scrollbar: I.Scrollbar) {
const MIN_EAING_MOMENTUM = 50;
const EASING_MULTIPLIER = /Android/.test(navigator.userAgent) ? 3 : 2;
Expand Down Expand Up @@ -35,18 +33,13 @@ export function touchHandler(scrollbar: I.Scrollbar) {
});

addEvent(container, 'touchmove', (evt: TouchEvent) => {
if (activeScrollbar && activeScrollbar !== scrollbar) return;
evt.preventDefault();

touchRecord.update(evt);

const { x, y } = touchRecord.getDelta();

scrollbar.addTransformableMomentum(x, y, evt, (willScroll) => {
if (willScroll) {
evt.preventDefault();
activeScrollbar = scrollbar;
}
});
scrollbar.addTransformableMomentum(x, y, evt);
});

addEvent(container, 'touchcancel touchend', (evt: TouchEvent) => {
Expand Down Expand Up @@ -74,6 +67,5 @@ export function touchHandler(scrollbar: I.Scrollbar) {
}

touchRecord.release(evt);
activeScrollbar = null;
});
}

0 comments on commit 222434c

Please sign in to comment.