Skip to content

Commit 5bbbfb2

Browse files
committed
fix(scroll): fix js scrolling max and deceleration on touch start
1 parent c510100 commit 5bbbfb2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/util/scroll-view.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export class ScrollView {
194194
function setMax() {
195195
if (!max) {
196196
// ******** DOM READ ****************
197-
max = (ele.scrollHeight - ele.offsetHeight) + contentTop + contentBottom;
197+
max = ele.scrollHeight - ele.parentElement.offsetHeight + contentTop + contentBottom;
198198
}
199199
};
200200

@@ -208,6 +208,7 @@ export class ScrollView {
208208

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

@@ -242,6 +243,7 @@ export class ScrollView {
242243
function jsScrollTouchStart(touchEvent: TouchEvent) {
243244
positions.length = 0;
244245
max = null;
246+
self._dom.cancel(rafCancel);
245247
positions.push(pointerCoord(touchEvent).y, touchEvent.timeStamp);
246248
}
247249

0 commit comments

Comments
 (0)