mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 04:12:02 +00:00
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:
@@ -64,23 +64,15 @@ exports.system_initiated_animate_scroll = function (scroll_amount) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.user_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
|
in_stoppable_autoscroll = false; // defensive
|
||||||
|
|
||||||
|
var viewport_offset = exports.scrollTop();
|
||||||
|
|
||||||
// We use $('html, body') because you can't animate window.scrollTop
|
// We use $('html, body') because you can't animate window.scrollTop
|
||||||
// on Chrome (http://bugs.jquery.com/ticket/10419).
|
// on Chrome (http://bugs.jquery.com/ticket/10419).
|
||||||
$('html, body').animate({
|
$("html, body").animate({
|
||||||
scrollTop: viewport.scrollTop() + scroll_amount
|
scrollTop: viewport_offset + 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);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ var load_more_enabled = true;
|
|||||||
// not load_more_messages().
|
// not load_more_messages().
|
||||||
var have_scrolled_away_from_top = true;
|
var have_scrolled_away_from_top = true;
|
||||||
|
|
||||||
var disable_pointer_movement = false;
|
|
||||||
|
|
||||||
// Toggles re-centering the pointer in the window
|
// Toggles re-centering the pointer in the window
|
||||||
// when Home is next clicked by the user
|
// when Home is next clicked by the user
|
||||||
var recenter_pointer_on_display = false;
|
var recenter_pointer_on_display = false;
|
||||||
@@ -1124,10 +1122,6 @@ function keep_pointer_in_view() {
|
|||||||
var candidate;
|
var candidate;
|
||||||
var next_row = current_msg_list.selected_row();
|
var next_row = current_msg_list.selected_row();
|
||||||
|
|
||||||
if (disable_pointer_movement) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (next_row.length === 0)
|
if (next_row.length === 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user