Skip to content

Commit

Permalink
feat(refresher): add elastic drag to native scrolling refresher
Browse files Browse the repository at this point in the history
  • Loading branch information
perrygovier committed Feb 5, 2015
1 parent 7134114 commit 658451c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion js/angular/controller/refresherController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion test/html/pull-to-refresh.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h1 class="title" id="test">Pull To Refresh</h1>
<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'];
Expand Down
6 changes: 3 additions & 3 deletions test/unit/angular/controller/refreshController.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 658451c

Please sign in to comment.