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

@ -1,5 +1,5 @@
use nalgebra::DVector;
use rustc_hash::FxHashMap;
use slab::Slab;
use sycamore::reactive::Signal;
#[derive(Clone, PartialEq)]
@ -7,12 +7,12 @@ pub struct Element {
pub id: String,
pub label: String,
pub color: [f32; 3],
pub rep: DVector<f64>
pub rep: DVector<f64>,
pub key: usize
}
// 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<FxHashMap<String, Element>>
pub elements: Signal<Slab<Element>>
}