LKilst view work

This commit is contained in:
Max Lynch
2013-10-15 17:25:21 -05:00
parent 53af99c054
commit 1bfbd701ab
2 changed files with 44 additions and 14 deletions

29
dist/js/ionic.js vendored
View File

@ -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)';
} }

View File

@ -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)';
} }