forked from 1b-agent/opencadstudio-upstream
fix(viewcube): cache UCS picker names behind an epoch
The two per-frame ViewCube blocks rebuilt the named-UCS name list (N String clones plus a Vec) every frame; now Scene::cached_ucs_names memoises it behind ucs_epoch and the picker takes the Arc, so frames cost a refcount bump. Bumped on UCS SAVE, UCS DELETE, RENAME UCS, record-API ucss patch, file-open, and undo Full-swap. Tests: cached_ucs_names_returns_same_arc_until_bump pins the hit path; cached_ucs_names_invalidated_by_bump pins rebuild with new content. Full suite: 1976 passed / 0 failed / 25 ignored.
This commit is contained in:
1 parent
bd37a2f969
commit
8c2cfa2c8f
9 files changed
+85
-20
No files matched your search
@@ -150,10 +150,15 @@ pub(super) fn viewcube_nav_controls<'a>(
|
||||
/// Fixed width of the UCS picker, so it can be centred under the cube.
|
||||
pub(super) const UCS_PICKER_W: f32 = 84.0;
|
||||
|
||||
/// The WCS / named-UCS selector shown under the cube.
|
||||
pub(super) fn viewcube_ucs_picker<'a>(current: String, names: Vec<String>) -> Element<'a, Message> {
|
||||
/// The WCS / named-UCS selector shown under the cube. `names` is the
|
||||
/// epoch-memoised `Scene::cached_ucs_names` Arc (#34) — a refcount bump per
|
||||
/// frame instead of N String clones.
|
||||
pub(super) fn viewcube_ucs_picker<'a>(
|
||||
current: String,
|
||||
names: std::sync::Arc<[String]>,
|
||||
) -> Element<'a, Message> {
|
||||
let mut options = vec!["WCS".to_string()];
|
||||
options.extend(names);
|
||||
options.extend(names.iter().cloned());
|
||||
let selected = if current.is_empty() {
|
||||
"WCS".to_string()
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user