draw board img at very top of screen if zoom controls are enabled so

that they appear below tray and don't steal events from tray.  There
should be a better way to do this but it's a big improvement.
This commit is contained in:
eehouse 2010-04-20 02:39:44 +00:00
parent 9f48c4f99b
commit 4eb7f80cca

View file

@ -137,7 +137,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
{ {
int action = event.getAction(); int action = event.getAction();
int xx = (int)event.getX(); int xx = (int)event.getX();
int yy = (int)event.getY() - m_top; int yy = (int)event.getY() - getCurTop();
switch ( action ) { switch ( action ) {
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN:
@ -169,7 +169,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
{ {
synchronized( this ) { synchronized( this ) {
if ( layoutBoardOnce() ) { if ( layoutBoardOnce() ) {
canvas.drawBitmap( m_bitmap, 0, m_top, m_drawPaint ); canvas.drawBitmap( m_bitmap, 0, getCurTop(), m_drawPaint );
} }
} }
} }
@ -235,6 +235,11 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
} }
} }
private int getCurTop()
{
return m_useZoomControl ? 0 : m_top;
}
private boolean layoutBoardOnce() private boolean layoutBoardOnce()
{ {
final int width = getWidth(); final int width = getWidth();