From cf3c8378557457363853d6795e4ddf9e70a4738e Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Thu, 26 Nov 2020 20:50:30 +0100 Subject: Make polygons deletable Before, the deletion tool was not targeting polygons. I also took the liberty to broaden the functionality of the surface trait, which now can check if a rectangle or polygon is contained. --- src/tool/deletion_tool.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/tool') diff --git a/src/tool/deletion_tool.rs b/src/tool/deletion_tool.rs index 5031f5d..17dd949 100644 --- a/src/tool/deletion_tool.rs +++ b/src/tool/deletion_tool.rs @@ -25,13 +25,16 @@ impl DeletionTool { pub fn delete_rect(map_data: &mut MapData, rect: Rect) { map_data .rooms_mut() - .retain(|&room| !rect.contains_rect(room)); + .retain(|&room| !rect.contains_rect(&room)); map_data .walls_mut() .retain(|&(pos1, pos2)| !rect.contains_point(&pos1) || !rect.contains_point(&pos2)); map_data .icons_mut() .retain(|icon| !rect.contains_point(&icon.position)); + map_data + .polygons_mut() + .retain(|polygon| !rect.contains_polygon(&polygon)); } } -- cgit v1.2.3-70-g09d2