🔧 Avoid using global static mut variables when possible

This commit is contained in:
elenatorro 2025-03-05 16:26:34 +01:00
parent 0279e75c4b
commit 3a8ba4cbee
6 changed files with 270 additions and 218 deletions

View file

@ -59,12 +59,11 @@ impl<'a> State<'a> {
let new_shape = Shape::new(id);
self.shapes.insert(id, new_shape);
}
self.current_id = Some(id);
self.current_shape = self.shapes.get_mut(&id);
}
pub fn current_shape(&'a mut self) -> Option<&'a mut Shape> {
pub fn current_shape(&mut self) -> Option<&mut Shape> {
self.current_shape.as_deref_mut()
}