[Refactor] Move table row mapping from TableZone into TableZoneLogic

This commit is contained in:
Lukas Brübach 2026-10-06 12:39:15 +02:00 • committed by GitHub
parent c02576b827
commit c7605a51e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 43 additions and 38 deletions

View file

@ -423,7 +423,7 @@ QPoint TableZone::mapToGrid(const QPointF &mapPoint) const
const int gridPointHeight = CardDimensions::HEIGHT + PADDING_Y;
int gridPointY = (y + PADDING_Y / 2) / gridPointHeight;
gridPointY = clampValidTableRow(gridPointY);
gridPointY = TableZoneLogic::clampValidTableRow(gridPointY);
if (isInverted()) {
gridPointY = TABLEROWS - 1 - gridPointY;
@ -471,22 +471,3 @@ QPointF TableZone::closestGridPoint(const QPointF &point)
}
return mapFromGrid(gridPoint);
}
int TableZone::clampValidTableRow(const int row)
{
if (row < 0) {
return 0;
}
if (row >= TABLEROWS) {
return TABLEROWS - 1;
}
return row;
}
int TableZone::tableRowToGridY(int tableRow)
{
if (tableRow > 2) {
tableRow = 1;
}
return clampValidTableRow(2 - tableRow);
}