mirror of
https://github.com/flynx/PortableMag.git
synced 2025-10-29 11:10:08 +00:00
more disecting and reversing of iscroll, a bit of a spagetti style...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
87d45eeea0
commit
0b84208373
@ -263,6 +263,7 @@ iScroll.prototype = {
|
||||
that.dirX = 0;
|
||||
that.dirY = 0;
|
||||
|
||||
/* XXX used only for zoom...
|
||||
// Gesture start
|
||||
if (that.options.zoom && hasTouch && e.touches.length > 1) {
|
||||
c1 = m.abs(e.touches[0].pageX-e.touches[1].pageX);
|
||||
@ -274,6 +275,7 @@ iScroll.prototype = {
|
||||
|
||||
if (that.options.onZoomStart) that.options.onZoomStart.call(that, e);
|
||||
}
|
||||
*/
|
||||
|
||||
if (that.options.momentum) {
|
||||
if (that.options.useTransform) {
|
||||
@ -325,41 +327,19 @@ iScroll.prototype = {
|
||||
// onBeforeScrollMove event...
|
||||
if (that.options.onBeforeScrollMove) that.options.onBeforeScrollMove.call(that, e);
|
||||
|
||||
// Zoom
|
||||
/* XXX disable zooming for now...
|
||||
if (that.options.zoom && hasTouch && e.touches.length > 1) {
|
||||
c1 = m.abs(e.touches[0].pageX - e.touches[1].pageX);
|
||||
c2 = m.abs(e.touches[0].pageY - e.touches[1].pageY);
|
||||
that.touchesDist = m.sqrt(c1*c1+c2*c2);
|
||||
|
||||
that.zoomed = true;
|
||||
|
||||
scale = 1 / that.touchesDistStart * that.touchesDist * this.scale;
|
||||
|
||||
if (scale < that.options.zoomMin) scale = 0.5 * that.options.zoomMin * Math.pow(2.0, scale / that.options.zoomMin);
|
||||
else if (scale > that.options.zoomMax) scale = 2.0 * that.options.zoomMax * Math.pow(0.5, that.options.zoomMax / scale);
|
||||
|
||||
that.lastScale = scale / this.scale;
|
||||
|
||||
newX = this.originX - this.originX * that.lastScale + this.x,
|
||||
newY = this.originY - this.originY * that.lastScale + this.y;
|
||||
|
||||
this.scroller.style[transform] = 'translate(' + newX + 'px,' + newY + 'px) scale(' + scale + ')' + translateZ;
|
||||
|
||||
if (that.options.onZoom) that.options.onZoom.call(that, e);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
that.pointX = point.pageX;
|
||||
that.pointY = point.pageY;
|
||||
|
||||
// Slow down if outside of the boundaries
|
||||
if (newX > 0 || newX < that.maxScrollX) {
|
||||
newX = that.options.bounce ? that.x + (deltaX / 2) : newX >= 0 || that.maxScrollX >= 0 ? 0 : that.maxScrollX;
|
||||
newX = (that.options.bounce ? that.x + (deltaX / 2)
|
||||
: newX >= 0 || that.maxScrollX >= 0 ? 0
|
||||
: that.maxScrollX);
|
||||
}
|
||||
if (newY > that.minScrollY || newY < that.maxScrollY) {
|
||||
newY = that.options.bounce ? that.y + (deltaY / 2) : newY >= that.minScrollY || that.maxScrollY >= 0 ? that.minScrollY : that.maxScrollY;
|
||||
newY = (that.options.bounce ? that.y + (deltaY / 2)
|
||||
: newY >= that.minScrollY || that.maxScrollY >= 0 ? that.minScrollY
|
||||
: that.maxScrollY);
|
||||
}
|
||||
|
||||
that.distX += deltaX;
|
||||
@ -367,6 +347,7 @@ iScroll.prototype = {
|
||||
that.absDistX = m.abs(that.distX);
|
||||
that.absDistY = m.abs(that.distY);
|
||||
|
||||
// XXX why is this here??
|
||||
if (that.absDistX < 6 && that.absDistY < 6) {
|
||||
return;
|
||||
}
|
||||
@ -383,6 +364,7 @@ iScroll.prototype = {
|
||||
}
|
||||
|
||||
that.moved = true;
|
||||
// XXX do the actual move...
|
||||
that._pos(newX, newY);
|
||||
that.dirX = deltaX > 0 ? -1 : deltaX < 0 ? 1 : 0;
|
||||
that.dirY = deltaY > 0 ? -1 : deltaY < 0 ? 1 : 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user