#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;
};
