pointer.js: Add setter for recenter_pointer_on_display.

After migration to an ES6 module, `recenter_pointer_on_display` would
no longer be mutable from outside the module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg 2018-08-04 02:38:54 -04:00 committed by Tim Abbott
parent 055ebe76aa
commit e559662c8c
3 changed files with 5 additions and 2 deletions

View File

@ -133,7 +133,7 @@ exports.maybe_scroll_to_selected = function () {
// selected message, then do so
if (pointer.recenter_pointer_on_display) {
exports.scroll_to_selected();
pointer.recenter_pointer_on_display = false;
pointer.set_recenter_pointer_on_display(false);
}
};

View File

@ -6,6 +6,9 @@ var pointer = (function () {
var exports = {};
exports.recenter_pointer_on_display = false;
exports.set_recenter_pointer_on_display = function (value) {
exports.recenter_pointer_on_display = value;
};
// Toggles re-centering the pointer in the window
// when All Messages is next clicked by the user

View File

@ -38,7 +38,7 @@ exports.update_is_muted = function (sub, value) {
// In case we added messages to what's visible in the home view, we need to re-scroll to
// make sure the pointer is still visible. We don't want the auto-scroll handler to move
// our pointer to the old scroll location before we have a chance to update it.
pointer.recenter_pointer_on_display = true;
pointer.set_recenter_pointer_on_display(true);
pointer.suppress_scroll_pointer_update = true;
if (!home_msg_list.empty()) {