iTwin / itwinjs-core

Monorepo for iTwin.js Library
https://www.itwinjs.org
MIT License
623 stars 211 forks source link

Allow selecting models and sub-categories in `SelectionSet` #7441

Open grigasp opened 1 day ago

grigasp commented 1 day ago

Is your feature request related to a problem? Please describe.

Some components allow selecting Geometric Model and Category instances. When that happens, we add relevant Model / SubCategory ids to HiliteSet to hilite elements in selected model or category. However, SelectionSet only allows adding geometric element ids, so we end up with the situation where users think that something is selected (because something is hilited), but the tools don't see that (because SelectionSet is empty). For example, the "Clear selection" tool doesn't even show up, because it doesn't get notified that something is selected. Even if it did, the "Clear" action on SelectionSet would be a no-op, because it's empty.

Describe the solution you'd like

Make SelectionSet store selection in a similar structure as HiliteSet. This way, when a Model / Category is selected, we can add Model / SubCategories to SelectionSet, like we do in HiliteSet.

Things to consider with this solution:

Describe alternatives you've considered

Additional context

Based on https://github.com/iTwin/viewer-components-react/issues/1099.

pmconne commented 1 day ago

Sounds reasonable to me.