While tap on draggable tile should not return it to tray, return-key on same tile should.

That's the only way to return a single tile on smartphone.
This commit is contained in:
ehouse 2008-05-11 16:20:37 +00:00
parent f5b5da9dc5
commit 290f505a98

View file

@ -2432,7 +2432,6 @@ holdsPendingTile( BoardCtxt* board, XP_U16 pencol, XP_U16 penrow )
&& isPending; && isPending;
} /* holdsPendingTile */ } /* holdsPendingTile */
#ifndef POINTER_SUPPORT
/* Did I tap on a tile on the board that I have not yet committed? If so, /* Did I tap on a tile on the board that I have not yet committed? If so,
* return it to the tray. But don't do this in drag-and-drop case since it's * return it to the tray. But don't do this in drag-and-drop case since it's
* too easy to accidentally tap and there are better ways. * too easy to accidentally tap and there are better ways.
@ -2454,16 +2453,13 @@ tryReplaceTile( BoardCtxt* board, XP_U16 pencol, XP_U16 penrow )
} }
return result; return result;
} /* tryReplaceTile */ } /* tryReplaceTile */
#endif
static XP_Bool static XP_Bool
handleActionInCell( BoardCtxt* board, XP_U16 col, XP_U16 row ) handleActionInCell( BoardCtxt* board, XP_U16 col, XP_U16 row, XP_Bool isPen )
{ {
return moveSelTileToBoardXY( board, col, row ) return moveSelTileToBoardXY( board, col, row )
|| tryMoveArrow( board, col, row ) || tryMoveArrow( board, col, row )
#ifndef POINTER_SUPPORT || (!isPen && tryReplaceTile( board, col, row ))
|| tryReplaceTile( board, col, row )
#endif
; ;
} /* handleActionInCell */ } /* handleActionInCell */
#endif /* POINTER_SUPPORT || KEYBOARD_NAV */ #endif /* POINTER_SUPPORT || KEYBOARD_NAV */
@ -2480,8 +2476,8 @@ exitTradeMode( BoardCtxt* board )
} /* exitTradeMode */ } /* exitTradeMode */
#if defined POINTER_SUPPORT || defined KEYBOARD_NAV #if defined POINTER_SUPPORT || defined KEYBOARD_NAV
XP_Bool static XP_Bool
board_handlePenUp( BoardCtxt* board, XP_U16 x, XP_U16 y ) handlePenUpInternal( BoardCtxt* board, XP_U16 x, XP_U16 y, XP_Bool isPen )
{ {
XP_Bool draw = XP_FALSE; XP_Bool draw = XP_FALSE;
XP_Bool dragged = XP_FALSE; XP_Bool dragged = XP_FALSE;
@ -2526,7 +2522,7 @@ board_handlePenUp( BoardCtxt* board, XP_U16 x, XP_U16 y )
XP_U16 col, row; XP_U16 col, row;
coordToCell( board, board->penDownX, board->penDownY, coordToCell( board, board->penDownX, board->penDownY,
&col, &row ); &col, &row );
draw = handleActionInCell( board, col, row ) || draw; draw = handleActionInCell( board, col, row, isPen ) || draw;
} }
} }
break; break;
@ -2544,7 +2540,13 @@ board_handlePenUp( BoardCtxt* board, XP_U16 x, XP_U16 y )
} }
return draw; return draw;
} /* board_handlePenUp */ } /* handlePenUpInternal */
XP_Bool
board_handlePenUp( BoardCtxt* board, XP_U16 x, XP_U16 y )
{
return handlePenUpInternal( board, x, y, XP_TRUE );
}
#endif /* #ifdef POINTER_SUPPORT */ #endif /* #ifdef POINTER_SUPPORT */
#ifdef KEYBOARD_NAV #ifdef KEYBOARD_NAV
@ -2728,7 +2730,7 @@ board_handleKeyUp( BoardCtxt* board, XP_Key key, XP_Bool* pHandled )
if ( board->focusHasDived ) { if ( board->focusHasDived ) {
XP_U16 x, y; XP_U16 x, y;
if ( focusToCoords( board, &x, &y ) ) { if ( focusToCoords( board, &x, &y ) ) {
redraw = board_handlePenUp( board, x, y ); redraw = handlePenUpInternal( board, x, y, XP_FALSE );
handled = XP_TRUE; handled = XP_TRUE;
} }
} else if ( board->focussed != OBJ_NONE ) { } else if ( board->focussed != OBJ_NONE ) {