mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
LKilst view work
This commit is contained in:
29
dist/js/ionic.js
vendored
29
dist/js/ionic.js
vendored
@ -2364,23 +2364,38 @@ window.ionic = {
|
|||||||
_handleDrag: function(e) {
|
_handleDrag: function(e) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
window.requestAnimationFrame(function() {
|
window.requestAnimationFrame(function() {
|
||||||
|
var content;
|
||||||
|
|
||||||
// We really aren't dragging
|
// We really aren't dragging
|
||||||
if(!_this._currentDrag) {
|
if(!_this._currentDrag) {
|
||||||
_this._startDrag(e);
|
_this._startDrag(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we should start dragging. Check if we've dragged past the threshold,
|
// Sanity
|
||||||
// or we are starting from the open state.
|
if(!_this._currentDrag) { return; }
|
||||||
if(!_this._isDragging &&
|
|
||||||
((Math.abs(e.gesture.deltaX) > _this.dragThresholdX) || (Math.abs(_this._currentDrag.startOffsetX) > 0)))
|
// Check if we should start dragging. Check if we've dragged past the threshold.
|
||||||
{
|
if(!_this._isDragging && (Math.abs(e.gesture.deltaX) > _this.dragThresholdX)) {
|
||||||
_this._isDragging = true;
|
_this._isDragging = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_this._isDragging) {
|
if(_this._isDragging) {
|
||||||
// Grab the new X point, capping it at zero
|
content = _this._currentDrag.content;
|
||||||
var newX = Math.min(_this._currentDrag.content.offsetWidth, _this._currentDrag.startOffsetX + e.gesture.deltaX);
|
|
||||||
|
|
||||||
|
// Grab the new X point, capping it at zero
|
||||||
|
var newX = Math.min(content.offsetWidth, _this._currentDrag.startOffsetX + e.gesture.deltaX);
|
||||||
|
|
||||||
|
/*
|
||||||
|
var rightMostX = -(content.offsetWidth * Math.max(0, content.children.length - 1));
|
||||||
|
|
||||||
|
if(newX > 0) {
|
||||||
|
// We are dragging past the leftmost pane, rubber band
|
||||||
|
newX *= 0.4;
|
||||||
|
} else if(newX < rightMostX) {
|
||||||
|
// Dragging past the rightmost pane, rubber band
|
||||||
|
newX = Math.min(rightMostX, + (((e.gesture.deltaX + buttonsWidth) * 0.4)));
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
_this._currentDrag.content.style.webkitTransform = 'translate3d(' + newX + 'px, 0, 0)';
|
_this._currentDrag.content.style.webkitTransform = 'translate3d(' + newX + 'px, 0, 0)';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -98,23 +98,38 @@
|
|||||||
_handleDrag: function(e) {
|
_handleDrag: function(e) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
window.requestAnimationFrame(function() {
|
window.requestAnimationFrame(function() {
|
||||||
|
var content;
|
||||||
|
|
||||||
// We really aren't dragging
|
// We really aren't dragging
|
||||||
if(!_this._currentDrag) {
|
if(!_this._currentDrag) {
|
||||||
_this._startDrag(e);
|
_this._startDrag(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we should start dragging. Check if we've dragged past the threshold,
|
// Sanity
|
||||||
// or we are starting from the open state.
|
if(!_this._currentDrag) { return; }
|
||||||
if(!_this._isDragging &&
|
|
||||||
((Math.abs(e.gesture.deltaX) > _this.dragThresholdX) || (Math.abs(_this._currentDrag.startOffsetX) > 0)))
|
// Check if we should start dragging. Check if we've dragged past the threshold.
|
||||||
{
|
if(!_this._isDragging && (Math.abs(e.gesture.deltaX) > _this.dragThresholdX)) {
|
||||||
_this._isDragging = true;
|
_this._isDragging = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_this._isDragging) {
|
if(_this._isDragging) {
|
||||||
// Grab the new X point, capping it at zero
|
content = _this._currentDrag.content;
|
||||||
var newX = Math.min(_this._currentDrag.content.offsetWidth, _this._currentDrag.startOffsetX + e.gesture.deltaX);
|
|
||||||
|
|
||||||
|
// Grab the new X point, capping it at zero
|
||||||
|
var newX = Math.min(content.offsetWidth, _this._currentDrag.startOffsetX + e.gesture.deltaX);
|
||||||
|
|
||||||
|
/*
|
||||||
|
var rightMostX = -(content.offsetWidth * Math.max(0, content.children.length - 1));
|
||||||
|
|
||||||
|
if(newX > 0) {
|
||||||
|
// We are dragging past the leftmost pane, rubber band
|
||||||
|
newX *= 0.4;
|
||||||
|
} else if(newX < rightMostX) {
|
||||||
|
// Dragging past the rightmost pane, rubber band
|
||||||
|
newX = Math.min(rightMostX, + (((e.gesture.deltaX + buttonsWidth) * 0.4)));
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
_this._currentDrag.content.style.webkitTransform = 'translate3d(' + newX + 'px, 0, 0)';
|
_this._currentDrag.content.style.webkitTransform = 'translate3d(' + newX + 'px, 0, 0)';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user