Skip to content

Commit

Permalink
fix: correct click-highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
haakonflatval-cognite committed Aug 1, 2023
1 parent 3d6e050 commit 8e15211
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions react-components/stories/HighlightNode.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@ const StoryContent = ({
}): ReactElement => {
const [nodeData, setNodeData] = useState<any>();

const [highlightedId, setHighlightedId] = useState<string>('');

const callback = (nodeData: NodeDataResult<any>): void => {
setNodeData(nodeData.data);

setHighlightedId(nodeData.data.externalId);
nodeData.model.assignStyledNodeCollection(
new TreeIndexNodeCollection([nodeData.cadNode.treeIndex]),
DefaultNodeAppearance.Highlighted
Expand All @@ -81,6 +84,17 @@ const StoryContent = ({
<>
<Reveal3DResources
resources={resources}
styling={{
groups:
highlightedId.length === 0
? undefined
: [
{
fdmAssetExternalIds: [highlightedId],
style: { cad: DefaultNodeAppearance.Highlighted }
}
]
}}
fdmAssetMappingConfig={fdmAssetMappingConfig}
onNodeClick={callback}
/>
Expand Down

0 comments on commit 8e15211

Please sign in to comment.