mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +01:00
Add upper bound on cell size yielding left and right margins for
super-wide screens.
This commit is contained in:
parent
69cb7bce15
commit
4fe36455c6
2 changed files with 14 additions and 4 deletions
|
@ -24,7 +24,7 @@ package org.eehouse.android.xw4;
|
||||||
// Why does this have to be its own class...
|
// Why does this have to be its own class...
|
||||||
public class BoardDims {
|
public class BoardDims {
|
||||||
public int width, height; // of the bitmap
|
public int width, height; // of the bitmap
|
||||||
public int top;
|
public int left, top;
|
||||||
public int scoreHt;
|
public int scoreHt;
|
||||||
public int boardHt;
|
public int boardHt;
|
||||||
public int trayTop, trayHt;
|
public int trayTop, trayHt;
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
private Drawable m_rightArrow;
|
private Drawable m_rightArrow;
|
||||||
private Drawable m_downArrow;
|
private Drawable m_downArrow;
|
||||||
private Drawable m_origin;
|
private Drawable m_origin;
|
||||||
private int m_top;
|
private int m_left, m_top;
|
||||||
private JNIThread m_jniThread;
|
private JNIThread m_jniThread;
|
||||||
private String[][] m_scores;
|
private String[][] m_scores;
|
||||||
private String[] m_dictChars;
|
private String[] m_dictChars;
|
||||||
|
@ -125,7 +125,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
public boolean onTouchEvent( MotionEvent event )
|
public boolean onTouchEvent( MotionEvent event )
|
||||||
{
|
{
|
||||||
int action = event.getAction();
|
int action = event.getAction();
|
||||||
int xx = (int)event.getX();
|
int xx = (int)event.getX() - m_left;
|
||||||
int yy = (int)event.getY() - getCurTop();
|
int yy = (int)event.getY() - getCurTop();
|
||||||
|
|
||||||
switch ( action ) {
|
switch ( action ) {
|
||||||
|
@ -158,7 +158,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
{
|
{
|
||||||
synchronized( this ) {
|
synchronized( this ) {
|
||||||
if ( layoutBoardOnce() ) {
|
if ( layoutBoardOnce() ) {
|
||||||
canvas.drawBitmap( m_bitmap, 0, getCurTop(), m_drawPaint );
|
canvas.drawBitmap( m_bitmap, m_left, getCurTop(), m_drawPaint );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,9 +235,18 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
{
|
{
|
||||||
BoardDims result = new BoardDims();
|
BoardDims result = new BoardDims();
|
||||||
result.width = width;
|
result.width = width;
|
||||||
|
result.left = 0;
|
||||||
|
|
||||||
int nCells = gi.boardSize;
|
int nCells = gi.boardSize;
|
||||||
int cellSize = width / nCells;
|
int cellSize = width / nCells;
|
||||||
|
int maxHt = 3 * m_defaultFontHt;
|
||||||
|
if ( cellSize > maxHt ) {
|
||||||
|
cellSize = maxHt;
|
||||||
|
|
||||||
|
int boardWidth = nCells * cellSize;
|
||||||
|
result.left = (width - boardWidth) / 2;
|
||||||
|
result.width = boardWidth;
|
||||||
|
}
|
||||||
result.trayHt = cellSize * 3;
|
result.trayHt = cellSize * 3;
|
||||||
result.scoreHt = 2 * m_defaultFontHt;
|
result.scoreHt = 2 * m_defaultFontHt;
|
||||||
int wantHt = result.trayHt + result.scoreHt + (cellSize * nCells);
|
int wantHt = result.trayHt + result.scoreHt + (cellSize * nCells);
|
||||||
|
@ -274,6 +283,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
m_valRect = null;
|
m_valRect = null;
|
||||||
|
|
||||||
BoardDims dims = figureBoardDims( width, height, m_gi );
|
BoardDims dims = figureBoardDims( width, height, m_gi );
|
||||||
|
m_left = dims.left;
|
||||||
m_top = dims.top;
|
m_top = dims.top;
|
||||||
|
|
||||||
m_bitmap = Bitmap.createBitmap( 1 + dims.width,
|
m_bitmap = Bitmap.createBitmap( 1 + dims.width,
|
||||||
|
|
Loading…
Add table
Reference in a new issue