From 40ce4e0accecc2df224d3535f915d78e7c1ddf8b Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Fri, 31 May 2013 17:45:40 -0400 Subject: [PATCH] Streamline recentering code. When you make a call to set_message_position(), you already know that the pointer is gonna be onscreen, so set the flag to suppress scroll pointer updates. This should be faster and also avoid future confusing bugs where recenter_view() and keep_pointer_in_view() run for the same event. (Both callers to recenter_view pass in the selected message, and then the calls to set_message_position() set the scrollTop so that the selected message shows onscreen.) (imported from commit f1a6f189b7899b280a6316ea7eb03f015d3d4ae3) --- zephyr/static/js/viewport.js | 1 + 1 file changed, 1 insertion(+) diff --git a/zephyr/static/js/viewport.js b/zephyr/static/js/viewport.js index cd8f9dcaaa..b8807ef5a9 100644 --- a/zephyr/static/js/viewport.js +++ b/zephyr/static/js/viewport.js @@ -39,6 +39,7 @@ exports.set_message_position = function (message_top, viewport_info, ratio) { message_top - message_offset; + suppress_scroll_pointer_update = true; // Gets set to false in the scroll handler. jwindow.scrollTop(new_scroll_top); };