Selection storage holding instanceKeys on hovering a decorated objects and "Clip Volume from Range" feature not working when decorations are on.
I am facing following 2 issues where I need some help in resolution.
- On a custom property grid implementation, the selection storage is storing the instanceKeys on hover of the decorated objects.
In the image, I am hovering an object created with decoration to view it's property on click of the object, however the selectionStorage is holding the instance key value when object is hovered and not clicked.
- When decorator is added to the viewManager, the Clip volume from range feature is not working, the section handlers are not working.
Showing the case when decorators are active, the section handlers are not coming up and not dragable.
- On a custom property grid implementation, the selection storage is storing the instanceKeys on hover of the decorated objects.
In the image, I am hovering an object created with decoration to view it's property on click of the object, however the selectionStorage is holding the instance key value when object is hovered and not clicked.
The selection storage doesn't do any synchronization by itself, it's merely a storage. The viewer has code that syncs viewport selection with it, but elements are added to viewport selection only on click, not on hover. So I'm not sure what component is responsible for adding the element.
You can try debugging it with this piece of code:
unifiedSelectionStorage.selectionChangeEvent.addListener((args) => {
console.log(`Selection changed: ${JSON.stringify(args)}`);
});
It'll print a console message whenever selection storage content changes. Pay attention to these attributes:
-
selectables- what got added/removed, -
source- what component made the change.
@grigasp do you have any sample code for a custom property grid display that I can refer to for implementation.
@grigasp do you have any sample code for a custom property grid display that I can refer to for implementation.
<div>This is my custom property panel</div>
You'll have to be more specific about the requirements if you want something better.
Sure, by custom property grid I mean, when there's no iModel is present in a project and we have to use blankIModelConnection. To draw geometries, I am using decorator with onDecorationButtonEvent to identify any click on the geometry. There are several decorators implemented to show different class of geometries.
I want to be able to identify the selectionSet keys stored in either iModelConnection.selectionSet or the selectionStorage and show relevant property information based on the selected geometry.
I am looking for an end to end property grid example where a decorated geometry is clicked and onChange event can identify which decorator geometry is clicked. This workflow should be independent of the iModelConnection being blank or with valid iModelConnection.
I am looking for an end to end property grid example where a decorated geometry is clicked and onChange event can identify which decorator geometry is clicked. This workflow should be independent of the iModelConnection being blank or with valid iModelConnection.
We don't provide an out-of-the-box property grid that works for blank as well as proper IModelConnections. I'd probably go this route:
- use usePropertyDataProviderWithUnifiedSelection to "glue" a property data provider with selection
- the
usePropertyDataProviderWithUnifiedSelectionfunction takes a data provider:- for the case when there's a proper
IModelConnection, use PresentationPropertyDataProvider - for the
BlankIModelConnectioncase, create an implementation ofIPresentationPropertyDataProvider. The interface requires quite a few functions to be implemented, but in your case they could be just empty stubs - it's enough to implement thegetDatafunction. It should look at thekeysproperty to see what elements to load the content for.
- for the case when there's a proper
Thanks, I will surely try this as a long term solution. To quickly resolve a problem at hand, can you tell me the reason of this error when I am trying to use IModelConnection.selectionSet value to show a list of property not directly via a property grid component. The decorator's onDecorationButtonEvent function is pushing transient id into the selection set after clearing all.
😞 Oops, something went wrong - please reload the page. In case you're interested in the details: Error: [Immer] This object has been frozen and should not be mutated at n (http://localhost:3000/node_modules/.vite/deps/chunk-EHRE2UMG.js?v=c871b9b6:6:11) at Set.h (http://localhost:3000/node_modules/.vite/deps/chunk-EHRE2UMG.js?v=c871b9b6:77:3) at removeIds (http://localhost:3000/node_modules/.vite/deps/chunk-A5NMACDL.js?v=c871b9b6:12669:18) at elements (http://localhost:3000/node_modules/.vite/deps/chunk-A5NMACDL.js?v=c871b9b6:12568:9) at forEachSelectableType (http://localhost:3000/node_modules/.vite/deps/chunk-A5NMACDL.js?v=c871b9b6:12614:3) at SelectionSet.replace (http://localhost:3000/node_modules/.vite/deps/chunk-A5NMACDL.js?v=c871b9b6:12565:5) at _SelectionTool.updateSelection (http://localhost:3000/node_modules/.vite/deps/chunk-A5NMACDL.js?v=c871b9b6:103941:34) at _SelectionTool.processSelection (http://localhost:3000/node_modules/.vite/deps/chunk-A5NMACDL.js?v=c871b9b6:103952:17) at _SelectionTool.processHit (http://localhost:3000/node_modules/.vite/deps/chunk-A5NMACDL.js?v=c871b9b6:104069:20) at _SelectionTool.onDataButtonUp (http://localhost:3000/node_modules/.vite/deps/chunk-A5NMACDL.js?v=c871b9b6:104107:43)
It looks like the error comes from Immer:
Maps and Sets that are produced by Immer will be made artificially immutable. This means that they will throw an exception when trying mutative methods like
set,clearetc. outside a producer.
source: https://immerjs.github.io/immer/map-set/
The strange thing is that SelectionSet doesn't use Immer, so I'm not sure how an Immered Set gets into play here. I don't think I'll be able to help unless you set up a minimal repro example that I can debug locally.
I updated some code to manage this issue.
I updated some code to manage this issue.
Mind sharing the details?