From b3cb1964522e0037831ceb541a63bb5a8361948a Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Tue, 28 May 2013 14:06:07 -0400 Subject: [PATCH] Stabilize pointer after reply-to clicks.. The reply-to autoscroll was using a flag that was redundant to suppress_scroll_pointer_update and then updating it prematurely, which caused the pointer to move when you clicked on a message to reply to it. Now the pointer goes to the message you replied to. (imported from commit e2f49fd6bd0da9a3f4b58c0eb08192ef0ee9abf0) --- zephyr/static/js/viewport.js | 18 +++++------------- zephyr/static/js/zephyr.js | 6 ------ 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/zephyr/static/js/viewport.js b/zephyr/static/js/viewport.js index c1e66b37fa..4e1ef2848d 100644 --- a/zephyr/static/js/viewport.js +++ b/zephyr/static/js/viewport.js @@ -64,23 +64,15 @@ exports.system_initiated_animate_scroll = function (scroll_amount) { }; exports.user_initiated_animate_scroll = function (scroll_amount) { - disable_pointer_movement = true; + suppress_scroll_pointer_update = true; // Gets set to false in the scroll handler. in_stoppable_autoscroll = false; // defensive + var viewport_offset = exports.scrollTop(); + // We use $('html, body') because you can't animate window.scrollTop // on Chrome (http://bugs.jquery.com/ticket/10419). - $('html, body').animate({ - scrollTop: viewport.scrollTop() + scroll_amount - }, { - complete: function () { - // The complete callback is actually called before the - // scrolling has completed, so we try to let scrolling - // finish before allowing pointer movements again or the - // pointer may still move. - setTimeout(function () { - disable_pointer_movement = false; - }, 50); - } + $("html, body").animate({ + scrollTop: viewport_offset + scroll_amount }); }; diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js index 1bd9f1d9d5..c857192457 100644 --- a/zephyr/static/js/zephyr.js +++ b/zephyr/static/js/zephyr.js @@ -20,8 +20,6 @@ var load_more_enabled = true; // not load_more_messages(). var have_scrolled_away_from_top = true; -var disable_pointer_movement = false; - // Toggles re-centering the pointer in the window // when Home is next clicked by the user var recenter_pointer_on_display = false; @@ -1124,10 +1122,6 @@ function keep_pointer_in_view() { var candidate; var next_row = current_msg_list.selected_row(); - if (disable_pointer_movement) { - return; - } - if (next_row.length === 0) return;