mirror of
https://github.com/penpot/penpot.git
synced 2025-06-11 04:01:50 +02:00
🎉 Improve performance reducing unnecessary calls to set-objects
This commit is contained in:
parent
e012046f62
commit
7728d5b317
20 changed files with 360 additions and 180 deletions
|
@ -1,9 +1,8 @@
|
|||
use skia_safe as skia;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::uuid::Uuid;
|
||||
use crate::view::Viewbox;
|
||||
use indexmap::IndexSet;
|
||||
use skia_safe as skia;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
pub type Tile = (i32, i32);
|
||||
|
||||
|
@ -64,6 +63,12 @@ impl TileHashMap {
|
|||
return self.grid.get(&tile);
|
||||
}
|
||||
|
||||
pub fn remove_shape_at(&mut self, tile: Tile, id: Uuid) {
|
||||
if let Some(shapes) = self.grid.get_mut(&tile) {
|
||||
shapes.shift_remove(&id);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_tiles_of(&mut self, shape_id: Uuid) -> Option<&HashSet<Tile>> {
|
||||
self.index.get(&shape_id)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue