From 793bfee6a2652a7b722c665f00f5c22b6659a56e Mon Sep 17 00:00:00 2001 From: Sebastiaan Pasma Date: Tue, 4 Sep 2018 16:36:05 +0200 Subject: [PATCH] Changed wallet details transition behaviour --- src/js/controllers/walletDetails.js | 40 +++++++++++++++++------------ src/sass/views/walletDetails.scss | 17 +++++++----- www/views/walletDetails.html | 2 +- 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/src/js/controllers/walletDetails.js b/src/js/controllers/walletDetails.js index ec787a5f4..f984a9209 100644 --- a/src/js/controllers/walletDetails.js +++ b/src/js/controllers/walletDetails.js @@ -283,25 +283,28 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun }; var prevPos; - + $scope.txHistoryPaddingBottom = 0; function getScrollPosition() { var scrollPosition = $ionicScrollDelegate.getScrollPosition(); if (!scrollPosition) { - $window.requestAnimationFrame(function() { + $timeout(function() { getScrollPosition(); - }); + }, 25); return; } var pos = scrollPosition.top; + if (pos > 0) { + $scope.txHistoryPaddingBottom = "200px"; + } if (pos === prevPos) { - $window.requestAnimationFrame(function() { + $timeout(function() { getScrollPosition(); - }); + }, 25); return; } prevPos = pos; refreshAmountSection(pos); - }; + } function refreshAmountSection(scrollPos) { var AMOUNT_HEIGHT_BASE = 210; @@ -355,18 +358,23 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun } var t = amountTop; - - $scope.altAmountOpacity = (amountHeight - 100) / 80; - $scope.buttonsOpacity = (amountHeight - 140) / 70; - $window.requestAnimationFrame(function() { - $scope.amountHeight = amountHeight + 'px'; - $scope.contentMargin = contentMargin + 'px'; - $scope.amountScale = 'scale3d(' + s + ',' + s + ',' + s + ') translateY(' + t + 'px)'; - $scope.$digest(); - getScrollPosition(); - }); + if (scrollPos > 50) { + contentMargin = amountHeight = 80; + $scope.altAmountOpacity = 0.01; + $scope.buttonsOpacity = 0.01; + } else { + contentMargin = amountHeight = 210; + $scope.altAmountOpacity = 1; + $scope.buttonsOpacity = 1; + } + $scope.amountHeight = amountHeight + 'px'; + $scope.contentMargin = contentMargin + 'px'; + $scope.amountScale = 'scale3d(' + s + ',' + s + ',' + s + ') translateY(' + t + 'px)'; + $scope.$digest(); + getScrollPosition(); } + var scrollEffectTimeout; var scrollWatcherInitialized; $scope.$on("$ionicView.enter", function(event, data) { diff --git a/src/sass/views/walletDetails.scss b/src/sass/views/walletDetails.scss index 858229d85..30b5da430 100644 --- a/src/sass/views/walletDetails.scss +++ b/src/sass/views/walletDetails.scss @@ -159,6 +159,7 @@ padding-top: 0; top: 0; + transition: margin-top 0.5s ease-in-out; margin-bottom: 16px; .scroll { @@ -199,7 +200,8 @@ width: 100%; position: absolute; bottom: 20px; - + transition-delay: 0.25s; + transition: opacity 0.4s ease-in-out; >.col { padding: 5px 10px; margin-bottom: 0; @@ -219,14 +221,15 @@ } } .amount { - width: 100%; - text-align: center; - color: #fff; - height: 230px; - padding-top: 40px; - display: block; align-items: center; + color: #fff; + display: block; + height: 230px; justify-content: center; + padding-top: 40px; + text-align: center; + transition: height 0.5s ease-in-out; + width: 100%; &__balance { -webkit-transform: scale3d(1, 1, 1) translateY(45px); diff --git a/www/views/walletDetails.html b/www/views/walletDetails.html index 6e05862aa..2341adcba 100644 --- a/www/views/walletDetails.html +++ b/www/views/walletDetails.html @@ -300,7 +300,7 @@ {{updatingTxHistoryProgress}} transactions downloaded -
+