forked from StudioInfinity/dyna3
App: don't bother copying key into element
When we access an element, we always have its key, either because the slab iterator yielded it along side the element or because we used it to get the element from the slab.
This commit is contained in:
parent
d121385c18
commit
147e275823
4 changed files with 32 additions and 43 deletions
|
@ -288,17 +288,17 @@ pub fn Display() -> View {
|
|||
|
||||
// get the assembly
|
||||
let elements = state.assembly.elements.get_clone();
|
||||
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.key)) {
|
||||
let element_iter = (&elements).into_iter();
|
||||
let reps_world: Vec<_> = element_iter.clone().map(|(_, elt)| &assembly_to_world * &elt.rep).collect();
|
||||
let colors: Vec<_> = element_iter.clone().map(|(key, elt)|
|
||||
if state.selection.with(|sel| sel.contains(&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.key)) {
|
||||
let highlights: Vec<_> = element_iter.map(|(key, _)|
|
||||
if state.selection.with(|sel| sel.contains(&key)) {
|
||||
1.0_f32
|
||||
} else {
|
||||
HIGHLIGHT
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue