♻️ Refactor how rebuild_tiles works

This commit is contained in:
Aitor Moreno 2025-04-22 11:18:19 +02:00 committed by Alejandro Alonso
parent fef342b489
commit caf13eb774
8 changed files with 63 additions and 15 deletions

View file

@ -73,7 +73,7 @@ impl<'a> State<'a> {
pub fn delete_shape(&mut self, id: Uuid) {
// We don't really do a self.shapes.remove so that redo/undo keep working
if let Some(shape) = self.shapes.get(&id) {
let (rsx, rsy, rex, rey) = self.render_state.get_tiles_for_rect(&shape);
let (rsx, rsy, rex, rey) = self.render_state.get_tiles_for_shape(&shape);
for x in rsx..=rex {
for y in rsy..=rey {
let tile = (x, y);
@ -118,6 +118,11 @@ impl<'a> State<'a> {
}
}
pub fn rebuild_tiles_shallow(&mut self) {
self.render_state
.rebuild_tiles_shallow(&mut self.shapes, &self.modifiers, &self.structure);
}
pub fn rebuild_tiles(&mut self) {
self.render_state
.rebuild_tiles(&mut self.shapes, &self.modifiers, &self.structure);