Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* TouchScrollStrategy stops scrolling before querying info about the …

…scroller.
  • Loading branch information...
commit 8c5fa318c02c72769238886ee9bd1a3ab98ccb6a 1 parent f02875d
Steve Orvell authored
View
5 source/touch/ScrollStrategy.js
@@ -95,7 +95,7 @@ enyo.kind({
getScrollTop: function() {
return this.scrollNode ? this.scrollNode.scrollTop : this.scrollTop;
},
- getScrollBounds: function() {
+ _getScrollBounds: function() {
var n = this.scrollNode, cn = this.container.hasNode();
var b = {
left: this.getScrollLeft(),
@@ -109,6 +109,9 @@ enyo.kind({
b.maxTop = Math.max(0, b.height - b.clientHeight);
return b;
},
+ getScrollBounds: function() {
+ return this._getScrollBounds();
+ },
calcStartInfo: function() {
var sb = this.getScrollBounds();
var y = this.getScrollTop(), x = this.getScrollLeft();
View
30 source/touch/TouchScrollStrategy.js
@@ -86,9 +86,27 @@ enyo.kind({
this.$.client.applyStyle("max-height", this.maxHeight);
this.$.client.addRemoveClass("enyo-fit", !this.maxHeight);
},
+ stop: function() {
+ if (this.$.scrollMath.isScrolling()) {
+ this.$.scrollMath.stop(true);
+ }
+ },
scrollTo: function(inX, inY) {
+ this.stop();
this.$.scrollMath.scrollTo(inY || inY == 0 ? inY : null, inX);
},
+ scrollIntoView: function() {
+ this.stop();
+ this.inherited(arguments);
+ },
+ setScrollLeft: function() {
+ this.stop();
+ this.inherited(arguments);
+ },
+ setScrollTop: function() {
+ this.stop();
+ this.inherited(arguments);
+ },
calcScrollNode: function() {
return this.$.client.hasNode();
},
@@ -187,7 +205,7 @@ enyo.kind({
this.doScrollStop(inSender);
},
calcBoundaries: function() {
- var s = this.$.scrollMath, b = this.getScrollBounds();
+ var s = this.$.scrollMath, b = this._getScrollBounds();
s.bottomBoundary = b.clientHeight - b.height;
s.rightBoundary = b.clientWidth - b.width;
},
@@ -198,8 +216,8 @@ enyo.kind({
},
effectScroll: function(inX, inY) {
if (this.scrollNode) {
- this.scrollNode.scrollLeft = inX;
- this.scrollNode.scrollTop = inY;
+ this.scrollLeft = this.scrollNode.scrollLeft = inX;
+ this.scrollTop = this.scrollNode.scrollTop = inY;
this.effectOverscroll(Math.round(inX), Math.round(inY));
}
},
@@ -223,11 +241,15 @@ enyo.kind({
s.webkitTransform = s.MozTransform = s.msTransform = s.transform = inTransform;
}
},
- getScrollBounds: function() {
+ _getScrollBounds: function() {
var r = this.inherited(arguments);
var m = this.$.scrollMath;
r.overleft = -Math.floor(this.getScrollLeft() + m.x);
r.overtop = -Math.floor(this.getScrollTop() + m.y);
return r;
+ },
+ getScrollBounds: function() {
+ this.stop();
+ return this.inherited(arguments);
}
});
View
4 source/touch/TranslateScrollStrategy.js
@@ -15,7 +15,7 @@ enyo.kind({
},
shouldDrag: function(inSender, inEvent) {
// stop and update drag info before checking drag status
- this.$.scrollMath.stop(true);
+ this.stop();
this.calcStartInfo();
return this.inherited(arguments);
},
@@ -42,9 +42,9 @@ enyo.kind({
},
// when stopped, we use scrollLeft/Top (makes cursor positioning automagic)
effectScrollStop: function() {
+ this.effectTransform(this.$.client.hasNode(), "translate3d(0, 0, 0)");
this.setScrollLeft(this.scrollLeft);
this.setScrollTop(this.scrollTop);
- this.effectTransform(this.$.client.hasNode(), "translate3d(0, 0, 0)");
},
down: enyo.nop
});
Please sign in to comment.
Something went wrong with that request. Please try again.