mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 23:16:52 +08:00
Weather improvements and scroll fixes
This commit is contained in:
36
dist/js/ionic.js
vendored
36
dist/js/ionic.js
vendored
@ -2501,17 +2501,21 @@ window.ionic = {
|
||||
this.resistance = opts.resistance;
|
||||
|
||||
// Listen for drag and release events
|
||||
window.ionic.onGesture('drag', function(e) {
|
||||
ionic.onGesture('drag', function(e) {
|
||||
_this._handleDrag(e);
|
||||
}, this.el);
|
||||
window.ionic.onGesture('release', function(e) {
|
||||
ionic.onGesture('release', function(e) {
|
||||
_this._handleEndDrag(e);
|
||||
}, this.el);
|
||||
ionic.on('webkitTransitionEnd', function(e) {
|
||||
_this._endTransition();
|
||||
});
|
||||
};
|
||||
|
||||
ionic.views.Scroll.prototype = {
|
||||
DECEL_RATE_NORMAL: 0.998,
|
||||
DECEL_RATE_FAST: 0.99,
|
||||
DECEL_RATE_SLOW: 0.996,
|
||||
|
||||
/**
|
||||
* Scroll to the given X and Y point, taking
|
||||
@ -2531,15 +2535,22 @@ window.ionic = {
|
||||
el.style.webkitTransitionTimingFunction = easing;
|
||||
el.style.webkitTransitionDuration = time;
|
||||
el.style.webkitTransform = 'translate3d(0,' + y + 'px, 0)';
|
||||
console.log('TRANSITION ADDED!');
|
||||
},
|
||||
|
||||
|
||||
_initDrag: function() {
|
||||
this._endTransition();
|
||||
this._isStopped = false;
|
||||
},
|
||||
|
||||
_endTransition: function() {
|
||||
this._isDragging = false;
|
||||
this._drag = null;
|
||||
this.el.classList.remove('scroll-scrolling');
|
||||
this.el.style.webkitTransitionDuration = '0';
|
||||
|
||||
console.log('REMOVING TRANSITION');
|
||||
this.el.style.webkitTransitionDuration = '0';
|
||||
},
|
||||
|
||||
/**
|
||||
@ -2569,6 +2580,11 @@ window.ionic = {
|
||||
window.requestAnimationFrame(function() {
|
||||
var content;
|
||||
|
||||
if(_this._isStopped) {
|
||||
_this._initDrag();
|
||||
return;
|
||||
}
|
||||
|
||||
// We really aren't dragging
|
||||
if(!_this._drag) {
|
||||
_this._startDrag(e);
|
||||
@ -2600,18 +2616,18 @@ window.ionic = {
|
||||
},
|
||||
|
||||
_handleEndDrag: function(e) {
|
||||
var _this = this;
|
||||
|
||||
// We didn't have a drag, so just init and leave
|
||||
if(!_this._drag) {
|
||||
_this._initDrag();
|
||||
if(!this._drag) {
|
||||
this._initDrag();
|
||||
return;
|
||||
}
|
||||
|
||||
// Set a flag in case we don't cleanup completely after the
|
||||
// drag animation so we can cleanup the next time a drag starts
|
||||
this._isStopped = true;
|
||||
|
||||
// Animate to the finishing point
|
||||
_this._animateToStop(e);
|
||||
// Cleanup
|
||||
_this._initDrag();
|
||||
this._animateToStop(e);
|
||||
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user