mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
Fix broken viewport.message_viewport_info() calculations
`#tab_bar_underpadding` overlaps some with `.message_header`,
so adding `#tab_bar_underpadding.bottom + .message_header.height`
gave us a nonsense message viewport top.
Doing the calculation this way is more robust, as long as:
1) `$(".floating_recipient").offset().top` continues to give us a sensical number
and is the last element just before the top of the viewport.
2) nothing appears between the composebox and viewport.
In this commit I also removed the other couple of places where the #tab_bar_underpadding
was being used as a viewport reference, that no longer makes sense.
(imported from commit c7f35e41309900c581d5e2329c1becf161d501d3)
This commit is contained in:
@@ -493,7 +493,6 @@ exports.resize_bottom_whitespace = function (h) {
|
|||||||
exports.resize_page_components = function () {
|
exports.resize_page_components = function () {
|
||||||
var composebox = $("#compose");
|
var composebox = $("#compose");
|
||||||
var floating_recipient_bar = $("#floating_recipient_bar");
|
var floating_recipient_bar = $("#floating_recipient_bar");
|
||||||
var tab_bar_under = $("#tab_bar_underpadding");
|
|
||||||
var desired_width;
|
var desired_width;
|
||||||
if (exports.home_tab_obscured() === 'other_tab') {
|
if (exports.home_tab_obscured() === 'other_tab') {
|
||||||
desired_width = $("div.tab-pane.active").outerWidth();
|
desired_width = $("div.tab-pane.active").outerWidth();
|
||||||
|
|||||||
@@ -20,19 +20,16 @@ exports.message_viewport_info = function () {
|
|||||||
|
|
||||||
var res = {};
|
var res = {};
|
||||||
|
|
||||||
var element_just_above_us = $("#tab_bar_underpadding");
|
var element_just_above_us = $(".floating_recipient");
|
||||||
|
|
||||||
res.visible_top =
|
res.visible_top = element_just_above_us.offset().top
|
||||||
element_just_above_us.position().top
|
+ element_just_above_us.outerHeight();
|
||||||
+ element_just_above_us.height()
|
|
||||||
+ $(".message_header").outerHeight();
|
|
||||||
|
|
||||||
var element_just_below_us = $("#compose");
|
var element_just_below_us = $("#compose");
|
||||||
|
|
||||||
res.visible_height =
|
res.visible_height =
|
||||||
element_just_below_us.position().top
|
element_just_below_us.position().top
|
||||||
- element_just_above_us.position().top
|
- res.visible_top;
|
||||||
- $(".message_header").outerHeight();
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@@ -133,7 +130,7 @@ function add_to_visible(candidates, visible,
|
|||||||
|
|
||||||
var top_of_feed = new util.CachedValue({
|
var top_of_feed = new util.CachedValue({
|
||||||
compute_value: function () {
|
compute_value: function () {
|
||||||
return $("#tab_bar_underpadding")[0].getBoundingClientRect().bottom;
|
return $(".floating_recipient").offset().top + $(".floating_recipient").outerHeight();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user