refactor: replace hint feedback with debug crosshair
This commit is contained in:
@@ -139,51 +139,9 @@ public:
|
||||
|
||||
HoldState updateHold(unsigned long ms) { return _drv ? _drv->updateHold(ms) : HoldState {}; }
|
||||
|
||||
void updateHint(int x, int y, bool active) {
|
||||
void drawDebugTouch(int x, int y) {
|
||||
if(_drv)
|
||||
_drv->updateHint(x, y, active);
|
||||
}
|
||||
|
||||
/// Show touch feedback - highlights the tile at given coordinates
|
||||
/// Returns true if a valid tile is being touched
|
||||
bool showTouchFeedback(int x, int y) {
|
||||
if(!_drv || _gridCols <= 0)
|
||||
return false;
|
||||
|
||||
// Transform touch coordinates
|
||||
_drv->transformTouch(&x, &y);
|
||||
|
||||
int headerH = 30;
|
||||
if(y < headerH)
|
||||
return false;
|
||||
|
||||
// Calculate which cell
|
||||
int cellW = _drv->width() / _gridCols;
|
||||
int cellH = (_drv->height() - headerH) / _gridRows;
|
||||
|
||||
int col = x / cellW;
|
||||
int row = (y - headerH) / cellH;
|
||||
|
||||
if(col < 0 || col >= _gridCols || row < 0 || row >= _gridRows)
|
||||
return false;
|
||||
|
||||
// Find which tile is at this position
|
||||
for(int i = 0; i < _tileCount; i++) {
|
||||
const TileLayout& lay = _layouts[i];
|
||||
if(lay.col <= col && col < lay.col + lay.cols && lay.row <= row
|
||||
&& lay.row + lay.rows > row) {
|
||||
// Found the tile - draw highlight via driver
|
||||
_drv->updateHint(lay.x, lay.y, true); // active=true means show feedback
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Clear touch feedback
|
||||
void clearTouchFeedback() {
|
||||
if(_drv)
|
||||
_drv->updateHint(0, 0, false); // active=false means clear
|
||||
_drv->drawDebugTouch(x, y);
|
||||
}
|
||||
|
||||
/// Check if current position is still in same tile as touch-down
|
||||
|
||||
Reference in New Issue
Block a user