Skip to content

Commit

Permalink
updating slideTo... methods
Browse files Browse the repository at this point in the history
some devices require invalidate to be called immediately following a
scroller.startScroll *and* in computeScroll.
  • Loading branch information
moagrius committed Sep 1, 2013
1 parent 7dd9072 commit d1e0859
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
5 changes: 3 additions & 2 deletions src/com/qozix/layouts/ZoomPanLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ public void slideToPoint( Point point ) { // TODO:
int dx = point.x - startX;
int dy = point.y - startY;
scroller.startScroll( startX, startY, dx, dy, SLIDE_DURATION );
invalidate(); // we're posting invalidate in computeScroll, yet both are required
}

/**
Expand Down Expand Up @@ -490,8 +491,8 @@ public void computeScroll() {
if ( scroller.computeScrollOffset() ) {
Point destination = new Point( scroller.getCurrX(), scroller.getCurrY() );
scrollToPoint( destination );
postInvalidate(); // should not be necessary but is...
dispatchScrollActionNotification();
postInvalidate(); // should not be necessary but is...
}
}

Expand Down Expand Up @@ -852,4 +853,4 @@ public static interface GestureListener {
public void onFlingComplete( Point point );
}

}
}
16 changes: 4 additions & 12 deletions src/com/qozix/tileview/TileView.java
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,7 @@ public double unscale( double value ) {
* @param y (double) the relative y position to move to
*/
public void moveTo( double x, double y ) {
Point point = positionManager.translate( x, y );
point.x *= getScale();
point.y *= getScale();
Point point = positionManager.translate( x, y, getScale() );
scrollToPoint( point );
}

Expand All @@ -393,9 +391,7 @@ public void moveTo( double x, double y ) {
* @param y (double) the relative y position to move to
*/
public void moveToAndCenter( double x, double y ) {
Point point = positionManager.translate( x, y );
point.x *= getScale();
point.y *= getScale();
Point point = positionManager.translate( x, y, getScale() );
scrollToAndCenter( point );
}

Expand All @@ -405,9 +401,7 @@ public void moveToAndCenter( double x, double y ) {
* @param y (double) the relative y position to move to
*/
public void slideTo( double x, double y ) {
Point point = positionManager.translate( x, y );
point.x *= getScale();
point.y *= getScale();
Point point = positionManager.translate( x, y, getScale() );
slideToPoint( point );
}

Expand All @@ -417,9 +411,7 @@ public void slideTo( double x, double y ) {
* @param y (double) the relative y position to move to
*/
public void slideToAndCenter( double x, double y ) {
Point point = positionManager.translate( x, y );
point.x *= getScale();
point.y *= getScale();
Point point = positionManager.translate( x, y, getScale() );
slideToAndCenter( point );
}

Expand Down

0 comments on commit d1e0859

Please sign in to comment.