App: store assembly elements in slab

This commit is contained in:
Aaron Fenyes 2024-09-22 02:21:45 -07:00
parent 78f8ef8215
commit d121385c18
5 changed files with 45 additions and 40 deletions

View file

@ -288,17 +288,17 @@ pub fn Display() -> View {
// get the assembly
let elements = state.assembly.elements.get_clone();
let element_iter = (&elements).values();
let element_iter = (&elements).into_iter().map(|(_, elt)| elt);
let reps_world: Vec<_> = element_iter.clone().map(|elt| &assembly_to_world * &elt.rep).collect();
let colors: Vec<_> = element_iter.clone().map(|elt|
if state.selection.with(|sel| sel.contains(&elt.id)) {
if state.selection.with(|sel| sel.contains(&elt.key)) {
elt.color.map(|ch| 0.2 + 0.8*ch)
} else {
elt.color
}
).collect();
let highlights: Vec<_> = element_iter.map(|elt|
if state.selection.with(|sel| sel.contains(&elt.id)) {
if state.selection.with(|sel| sel.contains(&elt.key)) {
1.0_f32
} else {
HIGHLIGHT