mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
Fixed #113 - scroll bouncing regardless of window size, fixes pull to refresh
This commit is contained in:
3
dist/js/ionic-angular.js
vendored
3
dist/js/ionic-angular.js
vendored
@ -641,6 +641,7 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
||||
isEditing: '=',
|
||||
deleteIcon: '@',
|
||||
reorderIcon: '@',
|
||||
hasPullToRefresh: '@',
|
||||
onRefresh: '&',
|
||||
onRefreshOpening: '&'
|
||||
},
|
||||
@ -663,7 +664,7 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
||||
var lv = new ionic.views.ListView({
|
||||
el: $element[0],
|
||||
listEl: $element[0].children[0],
|
||||
hasPullToRefresh: (typeof $scope.onRefresh !== 'undefined'),
|
||||
hasPullToRefresh: (typeof $scope.hasPullToRefresh !== 'false'),
|
||||
onRefresh: function() {
|
||||
$scope.onRefresh();
|
||||
},
|
||||
|
||||
4
dist/js/ionic.js
vendored
4
dist/js/ionic.js
vendored
@ -2411,6 +2411,7 @@ window.ionic = {
|
||||
var parentWidth = this.el.parentNode.offsetWidth;
|
||||
var parentHeight = this.el.parentNode.offsetHeight;
|
||||
|
||||
/*
|
||||
var maxX = Math.min(0, (-totalWidth + parentWidth));
|
||||
var maxY = Math.min(0, (-totalHeight + parentHeight));
|
||||
|
||||
@ -2418,6 +2419,7 @@ window.ionic = {
|
||||
if((this.isHorizontalEnabled && maxX == 0) || (this.isVerticalEnabled && maxY == 0)) {
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
this.x = scrollLeft;
|
||||
this.y = scrollTop;
|
||||
@ -3176,8 +3178,6 @@ window.ionic = {
|
||||
|
||||
this._isDragging = false;
|
||||
|
||||
console.log(e.gesture.direction);
|
||||
|
||||
// Check if this is a reorder drag
|
||||
if(ionic.DomUtil.getParentOrSelfWithClass(e.target, ITEM_DRAG_CLASS) && (e.gesture.direction == 'up' || e.gesture.direction == 'down')) {
|
||||
var item = this._getItem(e.target);
|
||||
|
||||
3
js/ext/angular/src/directive/ionicList.js
vendored
3
js/ext/angular/src/directive/ionicList.js
vendored
@ -84,6 +84,7 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
||||
isEditing: '=',
|
||||
deleteIcon: '@',
|
||||
reorderIcon: '@',
|
||||
hasPullToRefresh: '@',
|
||||
onRefresh: '&',
|
||||
onRefreshOpening: '&'
|
||||
},
|
||||
@ -106,7 +107,7 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
||||
var lv = new ionic.views.ListView({
|
||||
el: $element[0],
|
||||
listEl: $element[0].children[0],
|
||||
hasPullToRefresh: (typeof $scope.onRefresh !== 'undefined'),
|
||||
hasPullToRefresh: (typeof $scope.hasPullToRefresh !== 'false'),
|
||||
onRefresh: function() {
|
||||
$scope.onRefresh();
|
||||
},
|
||||
|
||||
@ -64,9 +64,19 @@
|
||||
<body>
|
||||
|
||||
<div ng-controller="TestCtrl" class="reveal-animation scroll-content">
|
||||
<list is-editing="isEditingItems" on-refresh-holding="almostRefreshing()" on-refresh-opening="almostRefreshProjects(ratio)" on-refresh="refreshProjects()" animation="my-repeat-animation" delete-icon="icon ion-minus-circled" reorder-icon="icon ion-navicon">
|
||||
<list-refresher>
|
||||
</list-refresher>
|
||||
<list is-editing="isEditingItems"
|
||||
on-refresh-holding="almostRefreshing()"
|
||||
on-refresh-opening="almostRefreshProjects(ratio)"
|
||||
on-refresh="refreshProjects()"
|
||||
animation="my-repeat-animation"
|
||||
delete-icon="icon ion-minus-circled"
|
||||
reorder-icon="icon ion-navicon">
|
||||
|
||||
<refresher>
|
||||
<div id="refresh-content">
|
||||
<i class="icon ion-ios7-reloading"></i>
|
||||
</div>
|
||||
</refresher>
|
||||
<item
|
||||
ng-repeat="item in items"
|
||||
buttons="item.buttons"
|
||||
@ -88,32 +98,6 @@
|
||||
<script>
|
||||
angular.module('navTest', ['ionic.ui.list', 'ionic.ui.content', 'ngAnimate'])
|
||||
|
||||
.directive('spinner', function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
scope: {
|
||||
ratio: '='
|
||||
},
|
||||
template: '<div class="spinner"><div class="spin-thing"></div></div>',
|
||||
link: function($scope, $element, $attr) {
|
||||
$scope.$watch('ratio', function(value) {
|
||||
if(value > 0.97) {
|
||||
value = 1;
|
||||
}
|
||||
|
||||
var a = (value * 360) % 360;
|
||||
var r = (a * Math.PI) / 180;
|
||||
var x = (Math.sin(r) * 20) + 14;
|
||||
var y = (Math.cos(r) * -20) + 14;
|
||||
|
||||
$element[0].firstElementChild.style.webkitTransform = 'translate3d(' + x + 'px, ' + y + 'px, 0)';
|
||||
//$element[0].firstElementChild.setAttribute('d', anim);
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.controller('TestCtrl', function($scope) {
|
||||
$scope.refreshRatio = { ratio: 0 };
|
||||
var removeItem = function(item) {
|
||||
|
||||
@ -376,8 +376,6 @@
|
||||
|
||||
this._isDragging = false;
|
||||
|
||||
console.log(e.gesture.direction);
|
||||
|
||||
// Check if this is a reorder drag
|
||||
if(ionic.DomUtil.getParentOrSelfWithClass(e.target, ITEM_DRAG_CLASS) && (e.gesture.direction == 'up' || e.gesture.direction == 'down')) {
|
||||
var item = this._getItem(e.target);
|
||||
|
||||
@ -463,6 +463,7 @@
|
||||
var parentWidth = this.el.parentNode.offsetWidth;
|
||||
var parentHeight = this.el.parentNode.offsetHeight;
|
||||
|
||||
/*
|
||||
var maxX = Math.min(0, (-totalWidth + parentWidth));
|
||||
var maxY = Math.min(0, (-totalHeight + parentHeight));
|
||||
|
||||
@ -470,6 +471,7 @@
|
||||
if((this.isHorizontalEnabled && maxX == 0) || (this.isVerticalEnabled && maxY == 0)) {
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
this.x = scrollLeft;
|
||||
this.y = scrollTop;
|
||||
|
||||
Reference in New Issue
Block a user