This commit is contained in:
Adam Bradley
2013-11-26 22:25:59 -06:00
10 changed files with 182 additions and 27 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "ionic",
"version": "0.9.12",
"version": "0.9.13",
"homepage": "https://github.com/driftyco/ionic",
"authors": [
"Max Lynch <max@drifty.com>",

View File

@@ -1,7 +1,7 @@
{
"repo": "driftyco/ionic",
"development": {},
"version": "0.9.12",
"version": "0.9.13",
"styles": [
"dist/css/ionic.css"
],

View File

@@ -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);
});
};

1
dist/js/ionic.js vendored
View File

@@ -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
});

View File

@@ -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;

View File

@@ -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);
});
};

View File

@@ -59,20 +59,11 @@
title="'Title'"
type="bar-primary"></header-bar>
<div class="bar bar-subheader">
<div class="button-bar">
<a class="button">Success</a>
<a class="button">Warning</a>
<a class="button">Danger</a>
</div>
</div>
<content
on-refresh="onRefresh()"
on-refresh-opening="onRefreshOpening(amount)"
refresh-complete="refreshComplete"
has-header="false"
has-subheader="true"
has-header="true"
has-footer="true"
>
<refresher></refresher>

View File

@@ -0,0 +1,136 @@
<html ng-app="navTest">
<head>
<meta charset="utf-8">
<title>Content</title>
<!-- Sets initial viewport load and disables zooming -->
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet" href="../../../../dist/css/ionic.css">
<script src="../../../../dist/js/ionic.js"></script>
<script src="../../../../dist/js/angular/angular.js"></script>
<script src="../../../../dist/js/angular/angular-animate.js"></script>
<script src="../../../../dist/js/angular/angular-route.js"></script>
<script src="../../../../dist/js/angular/angular-touch.js"></script>
<script src="../../../../dist/js/angular/angular-sanitize.js"></script>
<script src="../../../../dist/js/ionic-angular.js"></script>
<style>
.reveal-animation {
/*
-webkit-transform: translate3d(0%, 0, 0);
transform: translate3d(0%, 0, 0);
-webkit-transition: -webkit-transform 1s ease-in-out;
transition: transform 1s ease-in-out;
*/
}
.reveal-animation.ng-enter {
-webkit-transition: .2s ease-in-out all;
-webkit-transform:translate3d(100%,0,0) ;
}
.reveal-animation.ng-enter-active {
-webkit-transform:translate3d(0,0,0) ;
}
.reveal-animation.ng-leave {
-webkit-transition: .2s ease-in-out all;
-webkit-transform:translate3d(0%,0,0);
}
.reveal-animation.ng-leave-active {
-webkit-transition: .2s ease-in-out all;
-webkit-transform:translate3d(-100%,0,0);
}
.scroll-refresher {
border-bottom: 1px solid #eee;
}
#refresh-content {
color: #999;
text-align: center;
font-size: 48px;
position: absolute;
bottom: 10px;
width: 100%;
}
</style>
</head>
<body ng-controller="AppCtrl">
<side-menus>
<pane side-menu-content>
<header-bar
title="'Title'"
type="bar-primary"></header-bar>
<div class="bar bar-subheader">
<div class="button-bar">
<a class="button">Success</a>
<a class="button">Warning</a>
<a class="button">Danger</a>
</div>
</div>
<content
has-header="false"
has-subheader="true"
has-footer="true"
overflow-scroll="true"
>
<div style="height: 3000px; width: 100%; background: url('tree_bark.png') repeat"></div>
</content>
<footer-bar type="bar-assertive">
<h1 class="title">Footer</h1>
</footer-bar>
</pane>
<side-menu side="left">
<header class="bar bar-header bar-assertive">
<h1 class="title">Left</h1>
</header>
<content has-header="true" overflow-scroll="true">
<ul class="list">
<a href="#" class="item" ng-repeat="item in list">
{{item.text}}
</a>
</ul>
</content>
</side-menu>
<side-menu side="right">
<header class="bar bar-header bar-assertive">
<h1 class="title">Right</h1>
</header>
<content has-header="true">
<ul class="list">
<a href="#" class="item" ng-repeat="item in list">
{{item.text}}
</a>
</ul>
</content>
</side-menu>
</side-menus>
<script>
angular.module('navTest', ['ionic'])
.controller('AppCtrl', function($scope, $compile, $timeout, $element) {
$scope.items = [];
for(var i = 0; i < 200; i++) {
$scope.items.push({
});
}
$scope.what = {};
$scope.onRefresh = function() {
console.log('On refresh');
$timeout(function() {
$scope.refreshComplete();
}, 2000);
}
$scope.onRefreshOpening = function(amt) {
console.log('On refresh opening', amt);
}
})
</script>
</body>
</html>

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@@ -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
});