mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-20 22:26:54 +01:00
set tile border (highlighted and not) proportional to tile size for
greater visibility on high-res devices
This commit is contained in:
parent
ad464b8861
commit
37aa4a9adf
1 changed files with 16 additions and 11 deletions
|
@ -141,14 +141,6 @@ public class BoardCanvas extends Canvas implements DrawCtx {
|
|||
m_fillPaint = new Paint( Paint.ANTI_ALIAS_FLAG );
|
||||
m_strokePaint = new Paint();
|
||||
m_strokePaint.setStyle( Paint.Style.STROKE );
|
||||
m_tileStrokePaint = new Paint();
|
||||
m_tileStrokePaint.setStyle( Paint.Style.STROKE );
|
||||
float curWidth = m_tileStrokePaint.getStrokeWidth();
|
||||
curWidth *= 2;
|
||||
if ( curWidth < 2 ) {
|
||||
curWidth = 2;
|
||||
}
|
||||
m_tileStrokePaint.setStrokeWidth( curWidth );
|
||||
|
||||
Resources res = activity.getResources();
|
||||
m_origin = res.getDrawable( R.drawable.origin );
|
||||
|
@ -574,10 +566,12 @@ public class BoardCanvas extends Canvas implements DrawCtx {
|
|||
if ( notEmpty ) {
|
||||
drew = positionDrawTile( rect, text, val );
|
||||
|
||||
drawRect( rect, m_tileStrokePaint); // frame
|
||||
Paint paint = getTileStrokePaint( rect );
|
||||
drawRect( rect, paint ); // frame
|
||||
if ( 0 != (flags & CELL_HIGHLIGHT) ) {
|
||||
rect.inset( 2, 2 );
|
||||
drawRect( rect, m_tileStrokePaint ); // frame
|
||||
int width = (int)paint.getStrokeWidth();
|
||||
rect.inset( width, width );
|
||||
drawRect( rect, paint ); // frame
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -847,4 +841,15 @@ public class BoardCanvas extends Canvas implements DrawCtx {
|
|||
return result;
|
||||
}
|
||||
|
||||
private Paint getTileStrokePaint( final Rect rect )
|
||||
{
|
||||
if ( null == m_tileStrokePaint ) {
|
||||
Paint paint = new Paint();
|
||||
paint.setStyle( Paint.Style.STROKE );
|
||||
paint.setStrokeWidth( Math.max( 2, rect.width() / 20 ) );
|
||||
m_tileStrokePaint = paint;
|
||||
}
|
||||
return m_tileStrokePaint;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue