mirror of https://github.com/zulip/zulip.git
message_viewport: Move height definition before use.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
b5dbe259a8
commit
07863d1c8a
|
@ -7,6 +7,24 @@ let jwindow;
|
|||
const dimensions = {};
|
||||
let in_stoppable_autoscroll = false;
|
||||
|
||||
function make_dimen_wrapper(dimen_name, dimen_func) {
|
||||
dimensions[dimen_name] = new util.CachedValue({
|
||||
compute_value() {
|
||||
return dimen_func.call(exports.message_pane);
|
||||
},
|
||||
});
|
||||
return function viewport_dimension_wrapper(...args) {
|
||||
if (args.length !== 0) {
|
||||
dimensions[dimen_name].reset();
|
||||
return dimen_func.apply(exports.message_pane, args);
|
||||
}
|
||||
return dimensions[dimen_name].get();
|
||||
};
|
||||
}
|
||||
|
||||
exports.height = make_dimen_wrapper("height", $(exports.message_pane).height);
|
||||
exports.width = make_dimen_wrapper("width", $(exports.message_pane).width);
|
||||
|
||||
// Includes both scroll and arrow events. Negative means scroll up,
|
||||
// positive means scroll down.
|
||||
exports.last_movement_direction = 1;
|
||||
|
@ -279,24 +297,6 @@ exports.scrollTop = function viewport_scrollTop(target_scrollTop) {
|
|||
return ret;
|
||||
};
|
||||
|
||||
function make_dimen_wrapper(dimen_name, dimen_func) {
|
||||
dimensions[dimen_name] = new util.CachedValue({
|
||||
compute_value() {
|
||||
return dimen_func.call(exports.message_pane);
|
||||
},
|
||||
});
|
||||
return function viewport_dimension_wrapper(...args) {
|
||||
if (args.length !== 0) {
|
||||
dimensions[dimen_name].reset();
|
||||
return dimen_func.apply(exports.message_pane, args);
|
||||
}
|
||||
return dimensions[dimen_name].get();
|
||||
};
|
||||
}
|
||||
|
||||
exports.height = make_dimen_wrapper("height", $(exports.message_pane).height);
|
||||
exports.width = make_dimen_wrapper("width", $(exports.message_pane).width);
|
||||
|
||||
exports.stop_auto_scrolling = function () {
|
||||
if (in_stoppable_autoscroll) {
|
||||
exports.message_pane.stop();
|
||||
|
|
Loading…
Reference in New Issue