Skip to content

Commit 658451c

Browse files
committed
feat(refresher): add elastic drag to native scrolling refresher
1 parent 7134114 commit 658451c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Diff for: js/angular/controller/refresherController.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ IonicModule
115115

116116
isDragging = true;
117117
// overscroll according to the user's drag so far
118-
overscroll(parseInt(deltaY - dragOffset, 10));
118+
overscroll(parseInt((deltaY - dragOffset)/3, 10));
119119

120120
// update the icon accordingly
121121
if (!activated && lastOverscroll > ptrThreshold) {

Diff for: test/html/pull-to-refresh.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ <h1 class="title" id="test">Pull To Refresh</h1>
2323
<script>
2424
angular.module('ionicApp', ['ionic'])
2525
.config(function($ionicConfigProvider) {
26-
//$ionicConfigProvider.scrolling.jsScrolling(false);
26+
if(!ionic.Platform.isIOS())$ionicConfigProvider.scrolling.jsScrolling(false);
2727
})
2828
.controller('MyCtrl', function($scope, $timeout) {
2929
$scope.items = ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6','Item 7','Item 8','Item 9','Item 10'];

Diff for: test/unit/angular/controller/refreshController.unit.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('$ionicRefresh Controller', function() {
4747
ctrl.__handleTouchmove(evt(0));
4848
ctrl.__handleTouchmove(evt(10));
4949
ctrl.__handleTouchmove(evt(20));
50-
expect(ctrl.__getScrollChild().style[ionic.CSS.TRANSFORM]).toBe('translateY(10px)');
50+
expect(ctrl.__getScrollChild().style[ionic.CSS.TRANSFORM]).toBe('translateY(3px)');
5151
expect(ctrl.__getScrollChild().classList.contains('overscroll')).toBe(true);
5252
expect(refresher.classList.contains('invisible')).toBe(false);
5353
});
@@ -75,8 +75,8 @@ describe('$ionicRefresh Controller', function() {
7575

7676
ctrl.__handleTouchmove(evt(0));
7777
ctrl.__handleTouchmove(evt(10));
78-
ctrl.__handleTouchmove(evt(100));
79-
expect(ctrl.__getScrollChild().style[ionic.CSS.TRANSFORM]).toBe('translateY(90px)');
78+
ctrl.__handleTouchmove(evt(300));
79+
expect(ctrl.__getScrollChild().style[ionic.CSS.TRANSFORM]).toBe('translateY(96px)');
8080
expect(ctrl.__getScrollChild().classList.contains('overscroll')).toBe(true);
8181
expect(refresher.classList.contains('invisible')).toBe(false);
8282
expect(refresher.classList.contains('active')).toBe(true);

0 commit comments

Comments
 (0)