aboutsummaryrefslogtreecommitdiff
path: root/src/tool
diff options
context:
space:
mode:
authorArne Dußin2020-11-26 20:50:30 +0100
committerArne Dußin2020-11-26 20:50:30 +0100
commitcf3c8378557457363853d6795e4ddf9e70a4738e (patch)
treecba843ac32c6e15d565528592c857ee05d0805c6 /src/tool
parent9d469c353eb179a35fad6d42fa3f6fc985b49188 (diff)
downloadgraf_karto-cf3c8378557457363853d6795e4ddf9e70a4738e.tar.gz
graf_karto-cf3c8378557457363853d6795e4ddf9e70a4738e.zip
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.
Diffstat (limited to 'src/tool')
-rw-r--r--src/tool/deletion_tool.rs5
1 files changed, 4 insertions, 1 deletions
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<f32>) {
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));
}
}