Skip to content

Commit

Permalink
fix(scroll): fix js scrolling max and deceleration on touch start
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Dec 10, 2016
1 parent c510100 commit 5bbbfb2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/util/scroll-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export class ScrollView {
function setMax() {
if (!max) {
// ******** DOM READ ****************
max = (ele.scrollHeight - ele.offsetHeight) + contentTop + contentBottom;
max = ele.scrollHeight - ele.parentElement.offsetHeight + contentTop + contentBottom;
}
};

Expand All @@ -208,6 +208,7 @@ export class ScrollView {

// update top with updated velocity
// clamp top within scroll limits
// ******** DOM READ ****************
setMax();
self._t = Math.min(Math.max(self._t + ev.velocityY, 0), max);

Expand Down Expand Up @@ -242,6 +243,7 @@ export class ScrollView {
function jsScrollTouchStart(touchEvent: TouchEvent) {
positions.length = 0;
max = null;
self._dom.cancel(rafCancel);
positions.push(pointerCoord(touchEvent).y, touchEvent.timeStamp);
}

Expand Down

0 comments on commit 5bbbfb2

Please sign in to comment.