mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
feat(refresher): add elastic drag to native scrolling refresher
This commit is contained in:
2
js/angular/controller/refresherController.js
vendored
2
js/angular/controller/refresherController.js
vendored
@@ -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) {
|
||||
|
||||
@@ -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'];
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user