diff --git a/bower.json b/bower.json index 8f8c1a2fbf..202e71b810 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ionic", - "version": "0.9.12", + "version": "0.9.13", "homepage": "https://github.com/driftyco/ionic", "authors": [ "Max Lynch ", diff --git a/component.json b/component.json index 41d6c0abd3..4c1b565ae7 100644 --- a/component.json +++ b/component.json @@ -1,7 +1,7 @@ { "repo": "driftyco/ionic", "development": {}, - "version": "0.9.12", + "version": "0.9.13", "styles": [ "dist/css/ionic.css" ], diff --git a/dist/js/ionic-angular.js b/dist/js/ionic-angular.js index cd683cdec7..e7eb491fdc 100644 --- a/dist/js/ionic-angular.js +++ b/dist/js/ionic-angular.js @@ -1397,6 +1397,10 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture']) isVisible: true }; $scope.navController = this; + + this.goBack = function() { + $scope.direction = 'back'; + } }], link: function($scope, $element, $attr) { @@ -1405,6 +1409,9 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture']) $element.addClass('noop-animation'); var isFirst = true; + // Store whether we did an animation yet, to know if + // we should let the first state animate + var didAnimate = false; var initTransition = function() { //$element.addClass($scope.animation); @@ -1427,14 +1434,15 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture']) $scope.$on('$routeChangeStart', function(e, next, current) { var back, historyState = $window.history.state; - back = !!(historyState && historyState.position <= $rootScope.stackCursorPosition); + back = $scope.direction == 'back' || (!!(historyState && historyState.position <= $rootScope.stackCursorPosition)); if(isFirst || (next && next.$$route.originalPath === "")) { // Don't animate return; } - if($rootScope.stackCursorPosition > 0) { + if(didAnimate || $rootScope.stackCursorPosition > 0) { + didAnimate = true; if(back) { reverseTransition(); } else { @@ -1456,7 +1464,6 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture']) // going forwards or back $scope.$watch(function () { return $location.path() }, function (newLocation, oldLocation) { if($rootScope.actualLocation === newLocation) { - if(oldLocation == '' || newLocation == '/') { // initial route, skip this return; @@ -1464,7 +1471,7 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture']) var back, historyState = $window.history.state; - back = !!(historyState && historyState.position <= $rootScope.stackCursorPosition); + back = $scope.direction == 'back' || (!!(historyState && historyState.position <= $rootScope.stackCursorPosition)); if (back) { //back button @@ -1473,6 +1480,8 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture']) //forward button $rootScope.stackCursorPosition++; } + + $scope.direction = 'forwards'; } else { var currentRouteBeforeChange = $route.current; @@ -1715,6 +1724,9 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture']) // Only trigger back if the stack is greater than zero if($rootScope.stackCursorPosition > 0) { $window.history.back(); + + // Fallback for bad history supporting devices + navCtrl.goBack(); } e.alreadyHandled = true; return false; @@ -1860,7 +1872,9 @@ angular.module('ionic.ui.sideMenu', ['ionic.service.gesture']) e.gesture.srcEvent.preventDefault(); }; - var dragGesture = Gesture.on('drag', dragFn, $element); + //var dragGesture = Gesture.on('drag', dragFn, $element); + var dragRightGesture = Gesture.on('dragright', dragFn, $element); + var dragLeftGesture = Gesture.on('dragleft', dragFn, $element); var dragReleaseFn = function(e) { if(!defaultPrevented) { @@ -1895,7 +1909,8 @@ angular.module('ionic.ui.sideMenu', ['ionic.service.gesture']) // Cleanup $scope.$on('$destroy', function() { - Gesture.off(dragGesture, 'drag', dragFn); + Gesture.off(dragLeftGesture, 'drag', dragFn); + Gesture.off(dragRightGesture, 'drag', dragFn); Gesture.off(releaseGesture, 'release', dragReleaseFn); }); }; diff --git a/dist/js/ionic.js b/dist/js/ionic.js index 720b3b9429..31f208aaed 100644 --- a/dist/js/ionic.js +++ b/dist/js/ionic.js @@ -1840,7 +1840,6 @@ window.ionic = { return inputTapPolyfill(ele.control, e); } } else if( ele.tagName === "A" || ele.tagName === "BUTTON" ) { - var href = ele.getAttribute('href'); ionic.trigger('click', { target: ele }); diff --git a/js/ext/angular/src/directive/ionicNavRouter.js b/js/ext/angular/src/directive/ionicNavRouter.js index 6db1db4fa6..a5437e2f84 100644 --- a/js/ext/angular/src/directive/ionicNavRouter.js +++ b/js/ext/angular/src/directive/ionicNavRouter.js @@ -34,6 +34,10 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture']) isVisible: true }; $scope.navController = this; + + this.goBack = function() { + $scope.direction = 'back'; + } }], link: function($scope, $element, $attr) { @@ -42,6 +46,9 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture']) $element.addClass('noop-animation'); var isFirst = true; + // Store whether we did an animation yet, to know if + // we should let the first state animate + var didAnimate = false; var initTransition = function() { //$element.addClass($scope.animation); @@ -64,14 +71,15 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture']) $scope.$on('$routeChangeStart', function(e, next, current) { var back, historyState = $window.history.state; - back = !!(historyState && historyState.position <= $rootScope.stackCursorPosition); + back = $scope.direction == 'back' || (!!(historyState && historyState.position <= $rootScope.stackCursorPosition)); - if(isFirst || (next && next.$$route.originalPath === "")) { + if(isFirst || (next && next.$$route && next.$$route.originalPath === "")) { // Don't animate return; } - if($rootScope.stackCursorPosition > 0) { + if(didAnimate || $rootScope.stackCursorPosition > 0) { + didAnimate = true; if(back) { reverseTransition(); } else { @@ -93,7 +101,6 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture']) // going forwards or back $scope.$watch(function () { return $location.path() }, function (newLocation, oldLocation) { if($rootScope.actualLocation === newLocation) { - if(oldLocation == '' || newLocation == '/') { // initial route, skip this return; @@ -101,7 +108,7 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture']) var back, historyState = $window.history.state; - back = !!(historyState && historyState.position <= $rootScope.stackCursorPosition); + back = $scope.direction == 'back' || (!!(historyState && historyState.position <= $rootScope.stackCursorPosition)); if (back) { //back button @@ -110,6 +117,8 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture']) //forward button $rootScope.stackCursorPosition++; } + + $scope.direction = 'forwards'; } else { var currentRouteBeforeChange = $route.current; @@ -352,6 +361,9 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture']) // Only trigger back if the stack is greater than zero if($rootScope.stackCursorPosition > 0) { $window.history.back(); + + // Fallback for bad history supporting devices + navCtrl.goBack(); } e.alreadyHandled = true; return false; diff --git a/js/ext/angular/src/directive/ionicSideMenu.js b/js/ext/angular/src/directive/ionicSideMenu.js index b10e45748b..0d0f838406 100644 --- a/js/ext/angular/src/directive/ionicSideMenu.js +++ b/js/ext/angular/src/directive/ionicSideMenu.js @@ -71,7 +71,9 @@ angular.module('ionic.ui.sideMenu', ['ionic.service.gesture']) e.gesture.srcEvent.preventDefault(); }; - var dragGesture = Gesture.on('drag', dragFn, $element); + //var dragGesture = Gesture.on('drag', dragFn, $element); + var dragRightGesture = Gesture.on('dragright', dragFn, $element); + var dragLeftGesture = Gesture.on('dragleft', dragFn, $element); var dragReleaseFn = function(e) { if(!defaultPrevented) { @@ -106,7 +108,8 @@ angular.module('ionic.ui.sideMenu', ['ionic.service.gesture']) // Cleanup $scope.$on('$destroy', function() { - Gesture.off(dragGesture, 'drag', dragFn); + Gesture.off(dragLeftGesture, 'drag', dragFn); + Gesture.off(dragRightGesture, 'drag', dragFn); Gesture.off(releaseGesture, 'release', dragReleaseFn); }); }; diff --git a/js/ext/angular/test/content.html b/js/ext/angular/test/content.html index 89a2eaaf39..79fca9389a 100644 --- a/js/ext/angular/test/content.html +++ b/js/ext/angular/test/content.html @@ -59,20 +59,11 @@ title="'Title'" type="bar-primary"> -
- -
- diff --git a/js/ext/angular/test/overflow.html b/js/ext/angular/test/overflow.html new file mode 100644 index 0000000000..aa40bf339a --- /dev/null +++ b/js/ext/angular/test/overflow.html @@ -0,0 +1,136 @@ + + + + Content + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+ + +

Footer

+
+
+ +
+

Left

+
+ + + +
+ +
+

Right

+
+ + + +
+
+ + + + + diff --git a/js/ext/angular/test/tree_bark.png b/js/ext/angular/test/tree_bark.png new file mode 100644 index 0000000000..5efc869ba1 Binary files /dev/null and b/js/ext/angular/test/tree_bark.png differ diff --git a/js/utils/poly.js b/js/utils/poly.js index a79f37dab4..38929c76c7 100644 --- a/js/utils/poly.js +++ b/js/utils/poly.js @@ -69,7 +69,6 @@ return inputTapPolyfill(ele.control, e); } } else if( ele.tagName === "A" || ele.tagName === "BUTTON" ) { - var href = ele.getAttribute('href'); ionic.trigger('click', { target: ele });