feat(refresher): add elastic drag to native scrolling refresher

This commit is contained in:
perry
2015-02-05 14:30:39 -06:00
parent 7134114bd5
commit 658451cbc6
3 changed files with 5 additions and 5 deletions

View File

@@ -115,7 +115,7 @@ IonicModule
isDragging = true;
// overscroll according to the user's drag so far
overscroll(parseInt(deltaY - dragOffset, 10));
overscroll(parseInt((deltaY - dragOffset)/3, 10));
// update the icon accordingly
if (!activated && lastOverscroll > ptrThreshold) {

View File

@@ -23,7 +23,7 @@
<script>
angular.module('ionicApp', ['ionic'])
.config(function($ionicConfigProvider) {
//$ionicConfigProvider.scrolling.jsScrolling(false);
if(!ionic.Platform.isIOS())$ionicConfigProvider.scrolling.jsScrolling(false);
})
.controller('MyCtrl', function($scope, $timeout) {
$scope.items = ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6','Item 7','Item 8','Item 9','Item 10'];

View File

@@ -47,7 +47,7 @@ describe('$ionicRefresh Controller', function() {
ctrl.__handleTouchmove(evt(0));
ctrl.__handleTouchmove(evt(10));
ctrl.__handleTouchmove(evt(20));
expect(ctrl.__getScrollChild().style[ionic.CSS.TRANSFORM]).toBe('translateY(10px)');
expect(ctrl.__getScrollChild().style[ionic.CSS.TRANSFORM]).toBe('translateY(3px)');
expect(ctrl.__getScrollChild().classList.contains('overscroll')).toBe(true);
expect(refresher.classList.contains('invisible')).toBe(false);
});
@@ -75,8 +75,8 @@ describe('$ionicRefresh Controller', function() {
ctrl.__handleTouchmove(evt(0));
ctrl.__handleTouchmove(evt(10));
ctrl.__handleTouchmove(evt(100));
expect(ctrl.__getScrollChild().style[ionic.CSS.TRANSFORM]).toBe('translateY(90px)');
ctrl.__handleTouchmove(evt(300));
expect(ctrl.__getScrollChild().style[ionic.CSS.TRANSFORM]).toBe('translateY(96px)');
expect(ctrl.__getScrollChild().classList.contains('overscroll')).toBe(true);
expect(refresher.classList.contains('invisible')).toBe(false);
expect(refresher.classList.contains('active')).toBe(true);