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")) storedUIOpts = JSON.parse(localStorage("project_list"))
recalculateProjectListHeight = () -> recalculateProjectListHeight = () ->
topOffset = $(".project-list-card")?.offset()?.top $projListCard = $(".project-list-card")
bottomOffset = $("footer").outerHeight() + 25 topOffset = $projListCard?.offset()?.top
sideBarHeight = $("aside").height() - 56 cardPadding = $projListCard?.outerHeight() - $projListCard?.height()
# When footer is visible and page doesn't need to scroll we just make it bottomOffset = $("footer").outerHeight()
# span between header and footer height = $window.innerHeight - topOffset - bottomOffset - cardPadding
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)
$scope.projectListHeight = height $scope.projectListHeight = height
angular.element($window).bind "resize", () -> angular.element($window).bind "resize", () ->
recalculateProjectListHeight() recalculateProjectListHeight()
$scope.$apply() $scope.$apply()