scrolling: Fix sidebar size calculation.

So the top navbar is above the left sidebar
on the z-axis, not the y-axis.

So it doesn't make sense to use the top
navbar in calculating the size of the left
sidebar.

It kind of coincidentally works, since these
two numbers are closely related:

    left sidebar top margin = 50
    navbar height = 40

Calculating `bottom_sidebar_height` correctly
decreases its value by 10.

And then the only value that depends on it
is `stream_filters_max_height`.  We were
subtracting out 10 there to make it work,
since `bottom_sidebar_height` was inaccurate
by +10.  Now that's fixed.

The comment there was inaccurate--the
`stream_filter` div actually has a bottom
margin of 22px.  The bottom margin does
have some consequences for scrolling,
but the main goal here is to make the
calculation return the same value but
be more accurate about what happens
toward the top of the screen.
This commit is contained in:
Steve Howell
2019-02-07 19:22:32 +00:00
committed by Tim Abbott
parent e7ead7383d
commit b5347c78b2

View File

@@ -56,15 +56,16 @@ function get_new_heights() {
res.main_div_min_height = viewport_height - top_navbar_height; res.main_div_min_height = viewport_height - top_navbar_height;
res.bottom_sidebar_height = viewport_height - top_navbar_height; res.bottom_sidebar_height = viewport_height
- parseInt($("#left-sidebar").css("marginTop"), 10)
- parseInt($(".bottom_sidebar").css("marginTop"), 10);
res.right_sidebar_height = viewport_height - parseInt($("#right-sidebar").css("marginTop"), 10); res.right_sidebar_height = viewport_height - parseInt($("#right-sidebar").css("marginTop"), 10);
res.stream_filters_max_height = res.stream_filters_max_height =
res.bottom_sidebar_height res.bottom_sidebar_height
- $("#global_filters").safeOuterHeight(true) - $("#global_filters").safeOuterHeight(true)
- $("#streams_header").safeOuterHeight(true) - $("#streams_header").safeOuterHeight(true);
- 10; // stream_filters margin-bottom
// Don't let us crush the stream sidebar completely out of view // Don't let us crush the stream sidebar completely out of view
res.stream_filters_max_height = Math.max(80, res.stream_filters_max_height); res.stream_filters_max_height = Math.max(80, res.stream_filters_max_height);