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

@@ -103,14 +103,16 @@ private:
SelectionContent* m_content = nullptr;
// Where the current selection was on the screen when it started, in the game world
// view's coordinates, and which side of it the panel took. Both are frozen for as
// long as the selection lasts: the anchor because the panel does not chase a
// scrolling view or a moving ship, the side because a card that grows must not flip
// the panel across the object (REQ-UI-SELECTION-PANEL). The side is resolved on the
// first placement after a new anchor, being the first point at which the panel's
// width is known. Dragging the panel supersedes the pair for the rest of the
// view's coordinates, the gap the panel keeps from it, and which side of it the panel
// took. All three are frozen for as long as the selection lasts: the anchor because
// the panel does not chase a scrolling view or a moving ship, the gap because it is
// measured against that frozen rectangle, the side because a card that grows must not
// flip the panel across the object (REQ-UI-SELECTION-PANEL). The side is resolved on
// the first placement after a new anchor, being the first point at which the panel's
// width is known. Dragging the panel supersedes all three for the rest of the
// selection (REQ-UI-SELECTION-PANEL-DRAG).
QRect m_anchorRect;
int m_selectionGapPx = 0;
std::optional<PanelSide> m_side;
// Where the player dragged the panel, in the game world view's coordinates, and the