Vixen
02b45cc4
csharp
public readonly record struct Marquee

A rubber-band rectangle being dragged across a pane, in render pixels.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Two corners rather than an origin and a size, because a drag goes in any direction. Storing a width and a height means every consumer has to cope with a negative one, and the one that forgets is the hit test rather than the drawing — so a band dragged up and to the left selects nothing while looking exactly like one that works.

⚠ A band smaller than MinimumSize is a click. Nobody presses a mouse button without moving the pointer a pixel or two, so a marquee that resolved at any size at all would take every click in empty space away from the picker — which is the gesture that deselects. The threshold is in render pixels and is deliberately generous.

Fields and properties (11)

  • public Vector2 Anchor

    Where the drag started, in render pixels from the pane's top-left.

  • public Vector2 Corner

    Where the pointer is now.

  • public bool Additive

    Whether the result extends the selection rather than replacing it.

  • public const float MinimumSize

    How far the pointer has to travel before a press becomes a band, in render pixels.

  • public float Left

    The left edge.

  • public float Top

    The top edge.

  • public float Right

    The right edge.

  • public float Bottom

    The bottom edge.

  • public float Width

    How wide, never negative.

  • public float Height

    How tall, never negative.

  • public bool IsBand

    Whether the drag has gone far enough to be a band rather than a click.

Methods (4)

  • public Marquee(Vector2 Anchor, Vector2 Corner, bool Additive)

    A rubber-band rectangle being dragged across a pane, in render pixels.

  • public bool Contains(Vector2 point)

    Whether a point in render pixels is inside the band.

  • public bool Touches(float left, float top, float right, float bottom)

    Whether an axis-aligned rectangle in render pixels touches the band.

  • public Marquee To(Vector2 corner)

    The same band with the pointer somewhere else.

Used by (9)

  • IScenePickerVixen.Editor.SceneView
  • ISubObjectPickerVixen.Editor.SceneView
  • MarqueeOverlayVixen.Editor.SceneView
  • MarqueeTestsVixen.Editor.SceneView.Tests
  • NothingPickerVixen.Editor.SceneView.Tests
  • ScenePickerVixen.Editor.SceneView
  • SceneViewportVixen.Editor.SceneView
  • SubObjectPickerVixen.Editor.SceneView
  • SubObjectTestsVixen.Editor.SceneView.Tests