hsaest commited on
Commit
337093d
·
1 Parent(s): 2360015

fix: keep original auto follow behavior

Browse files
Files changed (1) hide show
  1. app.py +2 -17
app.py CHANGED
@@ -3144,15 +3144,10 @@ function() {
3144
  return { top: doc.scrollTop, height: doc.scrollHeight, client: doc.clientHeight };
3145
  }
3146
 
3147
- function updateFollowFromScroll(previousTop) {
3148
  if (ignoreScroll) return;
3149
  var pos = scrollerPosition();
3150
  var distFromBottom = pos.height - pos.top - pos.client;
3151
- var movedUp = typeof previousTop === 'number' && pos.top < previousTop - 2;
3152
- if (movedUp) {
3153
- autoFollow = false;
3154
- return;
3155
- }
3156
  autoFollow = distFromBottom < 320;
3157
  }
3158
 
@@ -3186,19 +3181,9 @@ function() {
3186
  });
3187
  }
3188
 
3189
- // Pause following on genuine user attempts to move away from the live output.
3190
- window.addEventListener('wheel', function (e) {
3191
- if (e.deltaY < -2) autoFollow = false;
3192
- }, { passive: true });
3193
- window.addEventListener('touchstart', function () {
3194
- autoFollow = false;
3195
- }, { passive: true });
3196
-
3197
  // Pause following only on a genuine user scroll away from the bottom.
3198
- var lastPageTop = scrollerPosition().top;
3199
  window.addEventListener('scroll', function () {
3200
- updateFollowFromScroll(lastPageTop);
3201
- lastPageTop = scrollerPosition().top;
3202
  }, { passive: true });
3203
 
3204
  function watchOutput() {
 
3144
  return { top: doc.scrollTop, height: doc.scrollHeight, client: doc.clientHeight };
3145
  }
3146
 
3147
+ function updateFollowFromScroll() {
3148
  if (ignoreScroll) return;
3149
  var pos = scrollerPosition();
3150
  var distFromBottom = pos.height - pos.top - pos.client;
 
 
 
 
 
3151
  autoFollow = distFromBottom < 320;
3152
  }
3153
 
 
3181
  });
3182
  }
3183
 
 
 
 
 
 
 
 
 
3184
  // Pause following only on a genuine user scroll away from the bottom.
 
3185
  window.addEventListener('scroll', function () {
3186
+ updateFollowFromScroll();
 
3187
  }, { passive: true });
3188
 
3189
  function watchOutput() {