mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-26 07:58:52 +01:00
use same logic to decide to zoom and to report whether can zoom next
time. Fixes bug preventing + button from greying out when fully zoomed in.
This commit is contained in:
parent
a2d2b0adbd
commit
9af9df884b
1 changed files with 14 additions and 6 deletions
|
@ -534,6 +534,18 @@ adjustOffset( XP_U16 curOffset, XP_S16 zoomBy )
|
|||
return offset;
|
||||
}
|
||||
|
||||
static XP_Bool
|
||||
canZoomIn( const BoardCtxt* board, XP_S16 newCount )
|
||||
{
|
||||
XP_Bool canZoom = XP_TRUE;
|
||||
XP_U16 nVisCols = model_numCols( board->model ) - newCount;
|
||||
XP_U16 scale = board->boardBounds.width / nVisCols;
|
||||
if ( scale > board->maxCellSz ) {
|
||||
canZoom = XP_FALSE;
|
||||
}
|
||||
return canZoom;
|
||||
}
|
||||
|
||||
XP_Bool
|
||||
board_zoom( BoardCtxt* board, XP_S16 zoomBy, XP_Bool* canIn, XP_Bool* canOut )
|
||||
{
|
||||
|
@ -559,11 +571,7 @@ board_zoom( BoardCtxt* board, XP_S16 zoomBy, XP_Bool* canIn, XP_Bool* canOut )
|
|||
|
||||
/* If we're zooming in, make sure we'll stay inside the limit */
|
||||
if ( changed && zoomBy > 0 ) {
|
||||
XP_U16 nVisCols = model_numCols( board->model ) - zoomCount;
|
||||
XP_U16 scale = board->boardBounds.width / nVisCols;
|
||||
if ( scale > board->maxCellSz ) {
|
||||
changed = XP_FALSE;
|
||||
}
|
||||
changed = canZoomIn( board, zoomCount );
|
||||
}
|
||||
|
||||
if ( changed ) {
|
||||
|
@ -577,7 +585,7 @@ board_zoom( BoardCtxt* board, XP_S16 zoomBy, XP_Bool* canIn, XP_Bool* canOut )
|
|||
}
|
||||
|
||||
if ( !!canIn ) {
|
||||
*canIn = maxCount > zoomCount && hsd->scale < board->maxCellSz;
|
||||
*canIn = canZoomIn( board, zoomCount + zoomBy );
|
||||
}
|
||||
if ( !!canOut ) {
|
||||
*canOut = zoomCount > 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue