mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
On refresh opening
This commit is contained in:
@ -29,40 +29,6 @@
|
||||
toiletSeat: 'cubic-bezier(0.05, 0.60, 0.05, 0.60)'
|
||||
};
|
||||
|
||||
/**
|
||||
* The Pull To Refresh drag operation handles the well-known
|
||||
* "pull to refresh" concept seen on various apps. This lets
|
||||
* the user indicate they want to refresh a given list by dragging
|
||||
* down.
|
||||
*
|
||||
* @param {object} opts the options for the pull to refresh drag.
|
||||
*/
|
||||
/*
|
||||
var PullToRefreshDrag = function(opts) {
|
||||
this.dragThresholdY = opts.dragThresholdY || 10;
|
||||
this.onRefreshOpening = opts.onRefreshOpening || function() {};
|
||||
this.onRefresh = opts.onRefresh || function() {};
|
||||
this.onRefreshHolding = opts.onRefreshHolding || function() {};
|
||||
this.el = opts.el;
|
||||
};
|
||||
|
||||
PullToRefreshDrag.prototype.end = function(e, doneCallback) {
|
||||
|
||||
if(currentHeight > firstChildHeight) {
|
||||
//this.refreshing();
|
||||
} else {
|
||||
// Enable animations
|
||||
refresher.classList.add('list-refreshing');
|
||||
refresher.style.height = '0px';
|
||||
this.onRefresh && _this.onRefresh();
|
||||
}
|
||||
|
||||
this._currentDrag = null;
|
||||
doneCallback && doneCallback();
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
ionic.views.Scroll = ionic.views.View.inherit({
|
||||
|
||||
initialize: function(opts) {
|
||||
@ -89,6 +55,7 @@
|
||||
refreshEasing: EASING_FUNCTIONS.bounce,
|
||||
// ms transition time
|
||||
refreshEasingTime: 400,
|
||||
refreshOpeningInterval: 100,
|
||||
|
||||
// How frequently to fire scroll events in the case of
|
||||
// a flick or momentum scroll where the finger is no longer
|
||||
@ -125,6 +92,13 @@
|
||||
this.y = 0;
|
||||
this.x = 0;
|
||||
|
||||
// Create a throttled pull to refresh "opening" function
|
||||
// which will get called as the refresh "opens" from drag
|
||||
var refreshOpening = _this.onRefreshOpening;
|
||||
_this.onRefreshOpening = ionic.throttle(function(ratio) {
|
||||
refreshOpening && refreshOpening(ratio);
|
||||
}, 100);
|
||||
|
||||
// Listen for drag and release events
|
||||
ionic.onGesture('drag', function(e) {
|
||||
_this._handleDrag(e);
|
||||
@ -624,7 +598,7 @@
|
||||
} else {
|
||||
// Trigger refresh open amount
|
||||
var ratio = Math.min(1, newY / _this._refresherHeight);
|
||||
_this.onRefreshOpening && _this.onRefreshOpening(ratio);
|
||||
_this.onRefreshOpening(ratio);
|
||||
}
|
||||
|
||||
// Update the new translated Y point of the container
|
||||
|
||||
Reference in New Issue
Block a user