App: store selection in hash map

Switch `Assembly.elements` to a hash map too, since that's probably
closer to what we'll want in the future.
This commit is contained in:
Aaron Fenyes 2024-09-19 16:08:55 -07:00
parent 96afad0c97
commit 96f8b6b5f3
5 changed files with 89 additions and 53 deletions

View file

@ -1,4 +1,5 @@
use nalgebra::DVector;
use rustc_hash::FxHashMap;
use sycamore::reactive::Signal;
#[derive(Clone, PartialEq)]
@ -6,16 +7,12 @@ pub struct Element {
pub id: String,
pub label: String,
pub color: [f32; 3],
pub rep: DVector<f64>,
/* TO DO */
// does this belong in the element data?
pub selected: Signal<bool>
pub rep: DVector<f64>
}
// a complete, view-independent description of an assembly
#[derive(Clone)]
pub struct Assembly {
// the order of the elements is arbitrary, and it could change at any time
pub elements: Signal<Vec<Element>>
pub elements: Signal<FxHashMap<String, Element>>
}