You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2016/09/05 09:33:08 UTC

incubator-ponymail git commit: revert scroll experiment

Repository: incubator-ponymail
Updated Branches:
  refs/heads/coffee-and-cake a5173b174 -> ef0fcb477


revert scroll experiment

it didn't quite work... :(


Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/ef0fcb47
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/ef0fcb47
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/ef0fcb47

Branch: refs/heads/coffee-and-cake
Commit: ef0fcb4771b7b2e9bc79d927ceb1ba90d7962534
Parents: a5173b1
Author: Daniel Gruno <hu...@apache.org>
Authored: Mon Sep 5 11:32:54 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Mon Sep 5 11:32:54 2016 +0200

----------------------------------------------------------------------
 site/js/coffee/listview_basic.coffee | 27 +++++++++++----------------
 site/js/ponymail-coffee.js           | 28 +++++++++++-----------------
 2 files changed, 22 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/ef0fcb47/site/js/coffee/listview_basic.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/listview_basic.coffee b/site/js/coffee/listview_basic.coffee
index 61a0ddf..183b34a 100644
--- a/site/js/coffee/listview_basic.coffee
+++ b/site/js/coffee/listview_basic.coffee
@@ -245,11 +245,11 @@ class BasicListView
     ### swipe: go to next or previous page of emails, depending on mouse wheel direction ###
     swipe: (e) ->
         @lastSwipe = @lastSwipe || 0
-        @direction = ""
+        direction = ""
         if typeof e is 'string'
-            @direction = e
+            direction = e
         else
-            @direction = if ((e.wheelDelta || -e.detail) < 0) then 'down' else 'up'
+            direction = if ((e.wheelDelta || -e.detail) < 0) then 'down' else 'up'
         style = document.body.currentStyle || window.getComputedStyle(document.body, "")
         
         ### Use the footer to determine whether scrollbar is present or not ###
@@ -260,22 +260,17 @@ class BasicListView
         if ponymail_email_open.length > 0 or scrollBar
             return
         
-        ### set scroll to happen 50ms from now ###
-        if @scrollTimer
-            clearTimeout(@scrollTimer)
-            @scrollTimer = null
-        
-        me = this
-        @scrollTimer = window.setTimeout( () ->
-            me.swipeDirection()
-        , 150)
-        
-    swipeDirection: () ->
-        if @direction == 'down'
+        ### Make sure we don't swipe too fast! ###
+        now = new Date().getTime()
+        if now - @lastSwipe < 300
+            return
+        @lastSwipe = now
+        if direction == 'down'
             ### Next page? ###
             if @listsize > (@pos+@rpp+1)
                 @scroll(@rpp, @pos+@rpp)
-        else if @direction == 'up'
+        else if direction == 'up'
             ### Previous page? ###
             if @pos > 0
                 @scroll(@rpp, Math.max(0,@pos-@rpp))
+                
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/ef0fcb47/site/js/ponymail-coffee.js
----------------------------------------------------------------------
diff --git a/site/js/ponymail-coffee.js b/site/js/ponymail-coffee.js
index 82c6214..cc21032 100644
--- a/site/js/ponymail-coffee.js
+++ b/site/js/ponymail-coffee.js
@@ -1533,13 +1533,13 @@ BasicListView = (function() {
   /* swipe: go to next or previous page of emails, depending on mouse wheel direction */
 
   BasicListView.prototype.swipe = function(e) {
-    var me, obj, scrollBar, style;
+    var direction, now, obj, scrollBar, style;
     this.lastSwipe = this.lastSwipe || 0;
-    this.direction = "";
+    direction = "";
     if (typeof e === 'string') {
-      this.direction = e;
+      direction = e;
     } else {
-      this.direction = (e.wheelDelta || -e.detail) < 0 ? 'down' : 'up';
+      direction = (e.wheelDelta || -e.detail) < 0 ? 'down' : 'up';
     }
     style = document.body.currentStyle || window.getComputedStyle(document.body, "");
 
@@ -1552,25 +1552,19 @@ BasicListView = (function() {
       return;
     }
 
-    /* set scroll to happen 50ms from now */
-    if (this.scrollTimer) {
-      clearTimeout(this.scrollTimer);
-      this.scrollTimer = null;
+    /* Make sure we don't swipe too fast! */
+    now = new Date().getTime();
+    if (now - this.lastSwipe < 300) {
+      return;
     }
-    me = this;
-    return this.scrollTimer = window.setTimeout(function() {
-      return me.swipeDirection();
-    }, 150);
-  };
-
-  BasicListView.prototype.swipeDirection = function() {
-    if (this.direction === 'down') {
+    this.lastSwipe = now;
+    if (direction === 'down') {
 
       /* Next page? */
       if (this.listsize > (this.pos + this.rpp + 1)) {
         return this.scroll(this.rpp, this.pos + this.rpp);
       }
-    } else if (this.direction === 'up') {
+    } else if (direction === 'up') {
 
       /* Previous page? */
       if (this.pos > 0) {