/// <summary> /// Handles when a key is raised on a map. /// </summary> /// <param name="sender">The <see cref="IToolTargetMapContainer"/> the event came from. Cannot be null.</param> /// <param name="map">The <see cref="EditorMap"/>. Cannot be null.</param> /// <param name="camera">The <see cref="ICamera2D"/>. Cannot be null.</param> /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data. Cannot be null.</param> protected override void MapContainer_KeyUp(IToolTargetMapContainer sender, EditorMap map, ICamera2D camera, KeyEventArgs e) { // Handle deletes if (e.KeyCode == Keys.Delete) { // Only delete when it is an Entity that is on this map var removed = new List <object>(); foreach (var x in SOM.SelectedObjects.OfType <MapGrh>().ToImmutable()) { if (map.Spatial.CollectionContains(x)) { map.RemoveMapGrh(x); removed.Add(x); } } SOM.SetManySelected(SOM.SelectedObjects.Except(removed).ToImmutable()); } base.MapContainer_KeyUp(sender, map, camera, e); }