forked from glen/dyna3
Always show representation coordinates in order
The `Indexed` used in the previous commit would occasionally put the coordinates out of order. I don't know why it did that, but this view always keeps the coordinates in order, and it might be more efficient anyway.
This commit is contained in:
parent
25017176fd
commit
ff39ba4716
1 changed files with 11 additions and 13 deletions
|
@ -64,11 +64,16 @@ fn ElementOutlineItem(key: ElementKey, element: assembly::Element) -> View {
|
|||
move |sel| if sel.contains(&key) { "selected" } else { "" }
|
||||
);
|
||||
let label = element.label.clone();
|
||||
let rep_components = element.representation.map(
|
||||
let rep_components = move || {
|
||||
element.representation.with(
|
||||
|rep| rep.iter().map(
|
||||
|u| format!("{:.3}", u).replace("-", "\u{2212}")
|
||||
).collect()
|
||||
);
|
||||
|u| {
|
||||
let u_str = format!("{:.3}", u).replace("-", "\u{2212}");
|
||||
view! { div { (u_str) } }
|
||||
}
|
||||
).collect::<Vec<_>>()
|
||||
)
|
||||
};
|
||||
let constrained = element.constraints.map(|csts| csts.len() > 0);
|
||||
let constraint_list = element.constraints.map(
|
||||
|csts| csts.clone().into_iter().collect()
|
||||
|
@ -129,14 +134,7 @@ fn ElementOutlineItem(key: ElementKey, element: assembly::Element) -> View {
|
|||
}
|
||||
) {
|
||||
div(class="element-label") { (label) }
|
||||
div(class="element-representation") {
|
||||
Indexed(
|
||||
list=rep_components,
|
||||
view=|coord_str| view! {
|
||||
div { (coord_str) }
|
||||
}
|
||||
)
|
||||
}
|
||||
div(class="element-representation") { (rep_components) }
|
||||
div(class="status")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue