Take potential padding into account when calculating proj list height.

This commit is contained in:
Paulo Reis 2017-10-12 14:19:31 +01:00
parent c488916c69
commit f47dac6414

View file

@ -26,23 +26,13 @@ define [
storedUIOpts = JSON.parse(localStorage("project_list"))
recalculateProjectListHeight = () ->
topOffset = $(".project-list-card")?.offset()?.top
bottomOffset = $("footer").outerHeight() + 25
sideBarHeight = $("aside").height() - 56
# When footer is visible and page doesn't need to scroll we just make it
# span between header and footer
height = $window.innerHeight - topOffset - bottomOffset
# When page is small enough that this pushes the project list smaller than
# the side bar, then the window going to have to scroll to take into account the
# footer. So we now start to track to the bottom of the window, with a 25px padding
# since the footer is hidden below the fold. Don't ever get bigger than the sidebar
# though since that's what triggered this happening in the first place.
# if height < sideBarHeight
# height = Math.min(sideBarHeight, $window.innerHeight - topOffset - 25)
$projListCard = $(".project-list-card")
topOffset = $projListCard?.offset()?.top
cardPadding = $projListCard?.outerHeight() - $projListCard?.height()
bottomOffset = $("footer").outerHeight()
height = $window.innerHeight - topOffset - bottomOffset - cardPadding
$scope.projectListHeight = height
angular.element($window).bind "resize", () ->
recalculateProjectListHeight()
$scope.$apply()