namespace OpenNest.Desktop.Interaction; /// /// The drawing list's pick-up, as WinForms arms it: a single left press on a drawing picks it /// up, and the next time the plate view takes the keyboard (the pointer entering it focuses /// it) the drawing then selected in the list starts the place tool. A drop of the dragged /// drawing on the plate, a double-click and an Undo or Redo put it down. /// public sealed class DrawingPickup { /// Whether a drawing is picked up. public bool IsArmed { get; private set; } /// A single left press on a drawing in the list. public void PickUp() => IsArmed = true; /// A drop on the plate, a double-click or an Undo: nothing left to place. public void PutDown() => IsArmed = false; /// /// The plate view took the keyboard: the drawing to place, the one selected in the list, /// or null. As in WinForms, a pick-up with nothing selected stays armed. /// public Drawing TakeOnPlateEnter(Drawing selected) { if (!IsArmed || selected == null) return null; IsArmed = false; return selected; } }