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)
This commit is contained in:
Steve Howell
2013-05-28 14:06:07 -04:00
parent ab093e7d9a
commit b3cb196452
2 changed files with 5 additions and 19 deletions

View File

@@ -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
});
};

View File

@@ -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;