summaryrefslogtreecommitdiff
path: root/www/lib/ionic-pullup/dist/ion-pullup.js
diff options
context:
space:
mode:
authorpliablepixels <pliablepixels@gmail.com>2016-04-10 10:47:35 -0400
committerpliablepixels <pliablepixels@gmail.com>2016-04-10 10:47:35 -0400
commita29f9a676a6ea3bad56ede05cd1a1c82ffbbe8e9 (patch)
tree7e6e6bfb23390a64344fdfe2272a5da04c2dd97c /www/lib/ionic-pullup/dist/ion-pullup.js
parent42bc21f7d0b4acfeefa5f4c2708203be78f57778 (diff)
#219 - everything upgraded
Former-commit-id: 15f58d10df83feda8199a1b904433e625ef36b44
Diffstat (limited to 'www/lib/ionic-pullup/dist/ion-pullup.js')
-rw-r--r--www/lib/ionic-pullup/dist/ion-pullup.js63
1 files changed, 42 insertions, 21 deletions
diff --git a/www/lib/ionic-pullup/dist/ion-pullup.js b/www/lib/ionic-pullup/dist/ion-pullup.js
index c82cdc3d..30714d0c 100644
--- a/www/lib/ionic-pullup/dist/ion-pullup.js
+++ b/www/lib/ionic-pullup/dist/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,14 +17,8 @@ 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'),
- header = document.querySelector('.bar-header'),
- tabsHeight = tabs ? tabs.offsetHeight : 0,
- headerHeight = header ? header.offsetHeight : 0,
- handleHeight = 0,
+ tabs, hasBottomTabs, header, tabsHeight, headerHeight, handleHeight = 0,
footer = {
height: 0,
posY: 0,
@@ -37,15 +31,24 @@ angular.module('ionic-pullup', [])
};
function init() {
- $element.css({'-webkit-backface-visibility': 'hidden', 'backface-visibility': 'hidden', 'transition': '300ms ease-in-out', 'padding': 0});
+ computeDefaultHeights();
+
+ $element.css({'transition': '300ms ease-in-out', 'padding': 0});
if (tabs && hasBottomTabs) {
$element.css('bottom', tabs.offsetHeight + 'px');
}
}
+ function computeDefaultHeights() {
+ tabs = document.querySelector('.tabs');
+ hasBottomTabs = document.querySelector('.tabs-bottom');
+ header = document.querySelector('.bar-header');
+ tabsHeight = tabs ? tabs.offsetHeight : 0;
+ headerHeight = header ? header.offsetHeight : 0;
+ }
+
function computeHeights() {
- // PP
- 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 +58,23 @@ angular.module('ionic-pullup', [])
}
}
+ function updateUI() {
+ $timeout(function() {
+ computeHeights();
+ }, 300);
+ }
+
+ function recomputeAllHeights() {
+ computeDefaultHeights();
+ footer.height = footer.maxHeight > 0 ? footer.maxHeight : $window.innerHeight - headerHeight - handleHeight - tabsHeight;
+ }
+
function expand() {
+ // 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)'});
+ // adjust CSS values with new heights in case 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,13 +152,13 @@ angular.module('ionic-pullup', [])
}
};
- $window.addEventListener('orientationchange', function() {
- $timeout(function() {
- computeHeights();
- }, 500);
+ init();
+
+ $ionicPlatform.ready(function() {
+ $window.addEventListener('orientationchange', updateUI);
+ $ionicPlatform.on("resume", updateUI);
});
- init();
}],
compile: function(element, attrs) {
attrs.defaultHeight && element.css('height', parseInt(attrs.defaultHeight, 10) + 'px');
@@ -187,7 +204,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,7 +223,6 @@ angular.module('ionic-pullup', [])
left: (($window.innerWidth - width) / 2) + 'px',
height: height + 'px',
width: width + 'px',
- //margin: '0 auto',
'text-align': 'center'
});
@@ -218,10 +234,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);
});
}
}