summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArjun Roychowdhury <pliablepixels@gmail.com>2015-09-23 15:45:40 -0400
committerArjun Roychowdhury <pliablepixels@gmail.com>2015-09-23 15:45:40 -0400
commit118da43241f5c381068232e66c3fd01032c6a59c (patch)
tree0e308b3f20c5c09c2bd857e0f625302337110f4e
parent1d1c2168ff30ac9452b0929db4ae1f5baa83657a (diff)
fixed pullup headerheight problem
-rw-r--r--www/external/ion-pullup.js56
1 files changed, 41 insertions, 15 deletions
diff --git a/www/external/ion-pullup.js b/www/external/ion-pullup.js
index 4b04d7ff..5ae5628b 100644
--- a/www/external/ion-pullup.js
+++ b/www/external/ion-pullup.js
@@ -8,7 +8,7 @@ angular.module('ionic-pullup', [])
HIDE: 'HIDE',
EXPAND: 'EXPAND'
})
- .directive('ionPullUpFooter', ['$timeout', '$rootScope', '$window', function($timeout, $rootScope, $window) {
+ .directive('ionPullUpFooter', ['$timeout', '$rootScope', '$window', '$ionicPlatform', function($timeout, $rootScope, $window, $ionicPlatform) {
return {
restrict: 'AE',
scope: {
@@ -17,7 +17,6 @@ angular.module('ionic-pullup', [])
onMinimize: '&'
},
controller: ['$scope', '$element', '$attrs', 'ionPullUpFooterState', 'ionPullUpFooterBehavior', function($scope, $element, $attrs, FooterState, FooterBehavior) {
- console.log ("***********ARC ************"+$attrs.maxHeight);
var
tabs = document.querySelector('.tabs'),
hasBottomTabs = document.querySelector('.tabs-bottom'),
@@ -37,15 +36,17 @@ angular.module('ionic-pullup', [])
};
function init() {
- $element.css({'-webkit-backface-visibility': 'hidden', 'backface-visibility': 'hidden', 'transition': '300ms ease-in-out', 'padding': 0});
+ $element.css({ '-webkit-backface-visibility': 'hidden',
+ 'backface-visibility': 'hidden',
+ 'transition': '300ms ease-in-out',
+ 'padding': 0});
if (tabs && hasBottomTabs) {
$element.css('bottom', tabs.offsetHeight + 'px');
}
}
function computeHeights() {
- // PP -20 added
- footer.height = footer.maxHeight > 0 ? footer.maxHeight : $window.innerHeight - headerHeight - handleHeight - tabsHeight -20;
+ footer.height = footer.maxHeight > 0 ? footer.maxHeight : $window.innerHeight - headerHeight - handleHeight - tabsHeight;
$element.css({'height': footer.height + 'px'});
if (footer.initialState == FooterState.MINIMIZED) {
@@ -55,9 +56,30 @@ angular.module('ionic-pullup', [])
}
}
+ function updateUI() {
+ $timeout(function() {
+ computeHeights();
+ }, 300);
+ }
+
+ function recomputeAllHeights()
+ {
+ // PP - Just in time recomputation
+ tabs = document.querySelector('.tabs');
+ hasBottomTabs = document.querySelector('.tabs-bottom');
+ header = document.querySelector('.bar-header');
+ tabsHeight = tabs ? tabs.offsetHeight : 0;
+ headerHeight = header ? header.offsetHeight : 0;
+ footer.height = footer.maxHeight > 0 ? footer.maxHeight : $window.innerHeight - headerHeight - handleHeight - tabsHeight;
+
+ }
+
function expand() {
+ //PP - lets recompute height right here to make sure we have the latest
+ recomputeAllHeights();
footer.lastPosY = 0;
- $element.css({'-webkit-transform': 'translate3d(0, 0, 0)', 'transform': 'translate3d(0, 0, 0)'});
+ //PP - lets adjust CSS values with new heights incase they changed
+ $element.css({'height':footer.height + 'px', '-webkit-transform': 'translate3d(0, 0, 0)', 'transform': 'translate3d(0, 0, 0)'});
$scope.onExpand();
footer.state = FooterState.EXPANDED;
}
@@ -135,10 +157,9 @@ angular.module('ionic-pullup', [])
}
};
- $window.addEventListener('orientationchange', function() {
- $timeout(function() {
- computeHeights();
- }, 500);
+ $ionicPlatform.ready(function() {
+ $window.addEventListener('orientationchange', updateUI);
+ $ionicPlatform.on("resume", updateUI);
});
init();
@@ -187,7 +208,7 @@ angular.module('ionic-pullup', [])
}
}
}])
- .directive('ionPullUpHandle', ['$ionicGesture', '$timeout', '$window', function($ionicGesture, $timeout, $window) {
+ .directive('ionPullUpHandle', ['$ionicGesture', '$ionicPlatform', '$timeout', '$window', function($ionicGesture, $ionicPlatform, $timeout, $window) {
return {
restrict: 'AE',
require: '^ionPullUpFooter',
@@ -206,8 +227,8 @@ angular.module('ionic-pullup', [])
left: (($window.innerWidth - width) / 2) + 'px',
height: height + 'px',
width: width + 'px',
- //margin: '0 auto',
- 'text-align': 'center'
+ 'text-align': 'center',
+
});
// add gesture
@@ -218,10 +239,15 @@ angular.module('ionic-pullup', [])
element.find('i').toggleClass(toggleClasses);
});
- $window.addEventListener('orientationchange', function() {
+ function updateUI() {
$timeout(function() {
element.css('left', (($window.innerWidth - width) / 2) + 'px');
- }, 500);
+ }, 300);
+ }
+
+ $ionicPlatform.ready(function() {
+ $window.addEventListener('orientationchange', updateUI);
+ $ionicPlatform.on("resume", updateUI);
});
}
}