mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 11:22:04 +00:00
message_viewport.js: Add setter for last_movement_direction.
After migration to an ES6 module, `last_movement_direction` would no longer be mutable from outside the module. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
committed by
Tim Abbott
parent
15192d4417
commit
6e4ae95994
@@ -9,6 +9,9 @@ var in_stoppable_autoscroll = false;
|
|||||||
// Includes both scroll and arrow events. Negative means scroll up,
|
// Includes both scroll and arrow events. Negative means scroll up,
|
||||||
// positive means scroll down.
|
// positive means scroll down.
|
||||||
exports.last_movement_direction = 1;
|
exports.last_movement_direction = 1;
|
||||||
|
exports.set_last_movement_direction = function (value) {
|
||||||
|
exports.last_movement_direction = value;
|
||||||
|
};
|
||||||
|
|
||||||
exports.at_top = function () {
|
exports.at_top = function () {
|
||||||
return exports.scrollTop() <= 0;
|
return exports.scrollTop() <= 0;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ function go_to_row(msg_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
exports.up = function () {
|
exports.up = function () {
|
||||||
message_viewport.last_movement_direction = -1;
|
message_viewport.set_last_movement_direction(-1);
|
||||||
var msg_id = current_msg_list.prev();
|
var msg_id = current_msg_list.prev();
|
||||||
if (msg_id === undefined) {
|
if (msg_id === undefined) {
|
||||||
return;
|
return;
|
||||||
@@ -19,7 +19,7 @@ exports.up = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.down = function (with_centering) {
|
exports.down = function (with_centering) {
|
||||||
message_viewport.last_movement_direction = 1;
|
message_viewport.set_last_movement_direction(1);
|
||||||
|
|
||||||
if (current_msg_list.is_at_end()) {
|
if (current_msg_list.is_at_end()) {
|
||||||
if (with_centering) {
|
if (with_centering) {
|
||||||
@@ -43,7 +43,7 @@ exports.down = function (with_centering) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.to_home = function () {
|
exports.to_home = function () {
|
||||||
message_viewport.last_movement_direction = -1;
|
message_viewport.set_last_movement_direction(-1);
|
||||||
var first_id = current_msg_list.first().id;
|
var first_id = current_msg_list.first().id;
|
||||||
current_msg_list.select_id(first_id, {then_scroll: true,
|
current_msg_list.select_id(first_id, {then_scroll: true,
|
||||||
from_scroll: true});
|
from_scroll: true});
|
||||||
@@ -51,7 +51,7 @@ exports.to_home = function () {
|
|||||||
|
|
||||||
exports.to_end = function () {
|
exports.to_end = function () {
|
||||||
var next_id = current_msg_list.last().id;
|
var next_id = current_msg_list.last().id;
|
||||||
message_viewport.last_movement_direction = 1;
|
message_viewport.set_last_movement_direction(1);
|
||||||
current_msg_list.select_id(next_id, {then_scroll: true,
|
current_msg_list.select_id(next_id, {then_scroll: true,
|
||||||
from_scroll: true});
|
from_scroll: true});
|
||||||
unread_ops.mark_current_list_as_read();
|
unread_ops.mark_current_list_as_read();
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ exports.initialize_kitchen_sink_stuff = function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
message_viewport.last_movement_direction = delta;
|
message_viewport.set_last_movement_direction(delta);
|
||||||
}, 50);
|
}, 50);
|
||||||
|
|
||||||
message_viewport.message_pane.on('wheel', function (e) {
|
message_viewport.message_pane.on('wheel', function (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user