fix(ui): stable widget ids for Layers rows and XPS workbench tabs - #88
Merged
Merged
Conversation
egui assigns widget ids by position, so two surfaces re-issued ids to the wrong widgets: - In the Layers tree, inserting a row above (a new canvas, dataset, or result) handed every row below a fresh id at an unchanged rect, which dropped keyboard focus and drag state mid-gesture and tripped egui's id-change debug overlay. Panel, content, and object rows now live in child scopes keyed by their typed ids (PanelId is a UUID; ContentId and ObjectId are canvas-local and pair with the canvas resource id), so a row's ids follow the row. A salted non-global scope is not enough: its unique id still embeds the parent's positional counter. - The XPS workbench's four tabs place different controls at the same rects; a tab switch handed the previous tab's ids, and with them any edit or focus state, to the next tab's controls. Each tab body now carries its own id salt. object_list moves from primary_sidebar.rs (at the 800-line limit) into layers_tree.rs unchanged apart from the new scope.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
egui assigns widget ids by position, and two surfaces re-issued ids to the wrong widgets:
PanelIdis a UUID;ContentIdandObjectIdare canvas-local and pair with the canvas resource id), so a row's ids follow the row. A salted non-global scope is not enough: its unique id still embeds the parent's positional counter.object_listmoves fromprimary_sidebar.rs(at the 800-line limit) intolayers_tree.rsunchanged apart from the new scope.Validation
cargo pr-checkpasses (fmt, file size, dependency policy, both frontends, clippy with denied warnings, tests).UiBuilder::idseeds the child's ids independently of the parent's positional counter, that the three scope keys cannot collide with each other or with the app's existing global scopes, and that nothing in the XPS tabs relied on ids shared across tabs.UI display logic
CommandId+describe) and are searchable in the command palette. (No actions added.)budget); transient states disable with a
disabled_reasonthat says howto unblock.
added.)
docs/(English and zh-CN) for user-visible behavior.(No documented behavior changes.)