I found out that in sencha-touch-all.js there's an event
Code:
onAnimationEnd: function() {
this.snapToBoundary();
this.onScrollEnd();
}
that works after every animation. And snapToBoundary() function is something like this
Code:
snapToBoundary: function() {
var position = this.position,
minPosition = this.getMinPosition(),
maxPosition = this.getMaxPosition(),
minX = minPosition.x,
minY = minPosition.y,
maxX = maxPosition.x,
maxY = maxPosition.y,
x = Math.round(position.x),
y = Math.round(position.y);
if (x < minX) {
x = minX;
}
else if (x > maxX) {
x = maxX;
}
if (y < minY) {
y = minY;
}
else if (y > maxY) {
y = maxY;
}
this.scrollTo(x, y);
}
My (x, y) is always (0, 0) just before
Code:
this.scrollTo(x, y);
, so it gets back to the origin every scroll.
I think this function's for preventing the content from going out of the container.
Isn't it weird?
Isn't scrolling for something that can't be contained in the container?