Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 41 additions & 13 deletions dist/ion-pullup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -36,7 +36,10 @@ 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');
}
Expand All @@ -53,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;
}
Expand Down Expand Up @@ -133,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();
Expand Down Expand Up @@ -185,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',
Expand All @@ -204,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
Expand All @@ -216,11 +239,16 @@ 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);
});
}
}
}]);
}]);