From e10c08ce87714e9017f213be2f2bfc575d3408ad Mon Sep 17 00:00:00 2001 From: Josef Citrine Date: Thu, 2 Jun 2016 17:30:52 +0100 Subject: [PATCH] Fixed sidebar not animating sometimes --- .../scripts/app/controllers/sidebar.coffee | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/resources/assets/scripts/app/controllers/sidebar.coffee b/resources/assets/scripts/app/controllers/sidebar.coffee index 9ef54a7e..499cb95b 100644 --- a/resources/assets/scripts/app/controllers/sidebar.coffee +++ b/resources/assets/scripts/app/controllers/sidebar.coffee @@ -15,8 +15,8 @@ # along with this program. If not, see . module.exports = angular.module('ponyfm').controller "sidebar", [ - '$scope', '$modal', 'playlists', '$rootScope' - ($scope, $modal, playlists, $rootScope) -> + '$scope', '$modal', 'playlists', '$rootScope', '$timeout' + ($scope, $modal, playlists, $rootScope, $timeout) -> $scope.playlists = playlists.pinnedPlaylists $scope.menuVisible = false $scope.menuActive = false @@ -24,13 +24,25 @@ module.exports = angular.module('ponyfm').controller "sidebar", [ $scope.navStyle = {} $rootScope.$on('sidebarToggled', () -> - $scope.menuVisible = !$scope.menuVisible - $scope.menuActive = $scope.menuVisible + $timeout(() -> + if $scope.menuVisible + $scope.navStyle.transform = '' + $scope.menuAnimated = true + + $scope.menuVisible = !$scope.menuVisible + $scope.menuActive = $scope.menuVisible + + console.log $scope.menuActive + ) ) $rootScope.$on('sidebarHide', () -> - $scope.menuVisible = false - $scope.menuActive = false + $timeout(() -> + $scope.navStyle.transform = '' + $scope.menuAnimated = true + $scope.menuVisible = false + $scope.menuActive = false + ) ) $scope.createPlaylist = () -> @@ -78,6 +90,7 @@ module.exports = angular.module('ponyfm').controller "sidebar", [ touchingNav = false onStart = (e) -> + if !$scope.menuVisible return