mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-06 22:29:44 +08:00
39
dist/ionic.js
vendored
39
dist/ionic.js
vendored
@ -2444,6 +2444,7 @@ ionic.controllers.NavController.prototype = {
|
||||
this.left = options.left;
|
||||
this.right = options.right;
|
||||
this.content = options.content;
|
||||
this.dragThresholdX = options.dragThresholdX || 10;
|
||||
|
||||
this._rightShowing = false;
|
||||
this._leftShowing = false;
|
||||
@ -2661,33 +2662,37 @@ ionic.controllers.NavController.prototype = {
|
||||
// End a drag with the given event
|
||||
_endDrag: function(e) {
|
||||
this.snapToRest(e);
|
||||
this._startX = null;
|
||||
this._lastX = null;
|
||||
this._offsetX = null;
|
||||
},
|
||||
|
||||
// Initialize a drag with the given event
|
||||
_initDrag: function(e) {
|
||||
this.content.disableAnimation();
|
||||
this._isDragging = true;
|
||||
this._startX = 0;
|
||||
this._offsetX = 0;
|
||||
this._lastX = 0;
|
||||
},
|
||||
|
||||
// Handle a drag event
|
||||
_handleDrag: function(e) {
|
||||
if(!this._isDragging) {
|
||||
this._initDrag(e);
|
||||
|
||||
// If we don't have start coords, grab and store them
|
||||
if(!this._startX) {
|
||||
this._startX = e.gesture.touches[0].pageX;
|
||||
this._lastX = this._startX;
|
||||
} else {
|
||||
// Grab the current tap coords
|
||||
this._lastX = e.gesture.touches[0].pageX;
|
||||
}
|
||||
|
||||
// Calculate difference from the tap points
|
||||
if(Math.abs(this._lastX - this._startX) > this.dragThresholdX) {
|
||||
// if the difference is greater than threshold, start dragging using the current
|
||||
// point as the starting point
|
||||
this._startX = this._lastX
|
||||
|
||||
this._isDragging = true;
|
||||
// Initialize dragging
|
||||
this.content.disableAnimation();
|
||||
this._offsetX = this.getOpenAmount();
|
||||
}
|
||||
|
||||
var newX = this._offsetX + (this._lastX - this._startX);
|
||||
|
||||
this.openAmount(newX);
|
||||
|
||||
this._lastX = e.gesture.touches[0].pageX;
|
||||
if(this._isDragging) {
|
||||
this.openAmount(this._offsetX + (this._lastX - this._startX));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
this.left = options.left;
|
||||
this.right = options.right;
|
||||
this.content = options.content;
|
||||
this.dragThresholdX = options.dragThresholdX || 10;
|
||||
|
||||
this._rightShowing = false;
|
||||
this._leftShowing = false;
|
||||
@ -229,33 +230,37 @@
|
||||
// End a drag with the given event
|
||||
_endDrag: function(e) {
|
||||
this.snapToRest(e);
|
||||
this._startX = null;
|
||||
this._lastX = null;
|
||||
this._offsetX = null;
|
||||
},
|
||||
|
||||
// Initialize a drag with the given event
|
||||
_initDrag: function(e) {
|
||||
this.content.disableAnimation();
|
||||
this._isDragging = true;
|
||||
this._startX = 0;
|
||||
this._offsetX = 0;
|
||||
this._lastX = 0;
|
||||
},
|
||||
|
||||
// Handle a drag event
|
||||
_handleDrag: function(e) {
|
||||
if(!this._isDragging) {
|
||||
this._initDrag(e);
|
||||
|
||||
// If we don't have start coords, grab and store them
|
||||
if(!this._startX) {
|
||||
this._startX = e.gesture.touches[0].pageX;
|
||||
this._lastX = this._startX;
|
||||
} else {
|
||||
// Grab the current tap coords
|
||||
this._lastX = e.gesture.touches[0].pageX;
|
||||
}
|
||||
|
||||
// Calculate difference from the tap points
|
||||
if(Math.abs(this._lastX - this._startX) > this.dragThresholdX) {
|
||||
// if the difference is greater than threshold, start dragging using the current
|
||||
// point as the starting point
|
||||
this._startX = this._lastX
|
||||
|
||||
this._isDragging = true;
|
||||
// Initialize dragging
|
||||
this.content.disableAnimation();
|
||||
this._offsetX = this.getOpenAmount();
|
||||
}
|
||||
|
||||
var newX = this._offsetX + (this._lastX - this._startX);
|
||||
|
||||
this.openAmount(newX);
|
||||
|
||||
this._lastX = e.gesture.touches[0].pageX;
|
||||
if(this._isDragging) {
|
||||
this.openAmount(this._offsetX + (this._lastX - this._startX));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user