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
32 lines
1.3 KiB
C++
32 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <QRect>
|
|
|
|
#include "Event.h"
|
|
|
|
// Where on the screen the selection that is about to be made sits: the bounds of the one
|
|
// object selected, or of all of them when the selection starts as a multi-selection
|
|
// (REQ-UI-SELECTION-PANEL). The rectangle is in the game world view's own widget
|
|
// coordinates.
|
|
//
|
|
// Published only when a selection *starts* -- a plain click or drag, or an additive one
|
|
// onto an empty selection -- and always immediately before the selection itself. Adding
|
|
// to a selection publishes nothing, which is what leaves the selection panel where it
|
|
// is while the selection grows; and because the rectangle is screen space frozen at that
|
|
// moment, scrolling the view or a selected ship flying off does not move the panel
|
|
// either.
|
|
//
|
|
// The gap the panel keeps from that rectangle travels with it, for the same reason: it is
|
|
// half a tile as the tile stood in this moment (REQ-UI-SELECTION-PANEL, REQ-GW-TILE-SIZE)
|
|
// and stays that for as long as the selection lasts, a rectangle frozen in one moment
|
|
// having no meaningful distance to a tile size measured in another.
|
|
class SelectionAnchorChangedEvent : public Event
|
|
{
|
|
public:
|
|
SelectionAnchorChangedEvent(QRect rectPx, int selectionGapPx)
|
|
: rectPx(rectPx), selectionGapPx(selectionGapPx) {}
|
|
|
|
const QRect rectPx;
|
|
const int selectionGapPx;
|
|
};
|