keep the selection panel half a tile off what it describes

The panel had one distance for the view edges, the widgets it steps around,
and the selection alike, so it stood eight pixels from a building and touched
it outright along the top. The gap from the selection is now its own value,
half a tile, and it is horizontal only -- the top edges stay level.

It is sampled where the tile size is known, in the same moment as the anchor
rectangle, and travels with it: a rectangle frozen in one moment has no
meaningful distance to a tile size measured in another. chooseSide now takes
the gap in place of the margin, the band having already taken the margin off.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ne3mejABZoLWKLh8fgpM3x
This commit is contained in:
2026-08-17 16:24:14 +02:00
parent abaccc45b5
commit 392a2b8d00
7 changed files with 115 additions and 61 deletions

View File

@@ -1468,8 +1468,13 @@ void GameWorldView::publishSelectionAnchor(SelectionMode mode,
{
return;
}
// The gap the panel keeps from that rectangle is half a tile (REQ-UI-SELECTION-PANEL),
// and this is where the tile size is known. It is sampled in the same moment as the
// rectangle and travels with it, so both describe the view as it stood when the
// selection started.
const int selectionGapPx = qRound(getCoordinates().getTilePx() / 2.0f);
EventManager::getInstance()->sendEventImmediately(
std::make_shared<SelectionAnchorChangedEvent>(anchorRect));
std::make_shared<SelectionAnchorChangedEvent>(anchorRect, selectionGapPx));
}
void GameWorldView::mouseMoveEvent(QMouseEvent* event)