Is there a way to remove the selection border using an external button?
When I click on an activity I see this border:
I have a button outside the BPMN canvas that I want to use to remove the blue selection. I’m using the NavigatedViewer component
barmac
September 26, 2023, 2:39pm
2
This should help:
const selection = modeler.get('selection');
selection.select([]);
That does indeed help.
Which type definition should I use? I’m importing bpmn-js/lib/NavigatedViewer
but I get Property 'select' does not exist on type 'NavigatedViewer
const selection = modeler.get("selection") as BpmnViewer
selection.select([])
barmac
September 27, 2023, 6:23am
4
Selection is a diagram-js module used in bpmn-js: https://github.com/bpmn-io/diagram-js/blob/develop/lib/features/selection/Selection.js
I assume this should work in typescript:
import type Selection from 'diagram-js/lib/features/selection/Selection';
const selection = modeler.get('selection') as Selection;
selection.select([]);
2 Likes
nikku
September 27, 2023, 7:00am
5
There exists a couple of alternatives here along with Programmatically de-select - #4 by barmac .
JavaScript code intelligence
/* @typedef { import('diagram-js/lib/features/selection/Selection').default } Selection */
/* @type { Selection } */
const selection = modeler.get('selection');
TypeScript code intelligence
import type Selection from 'diagram-js/lib/features/selection/Selection';
const selection = modeler.get<Selection>('selection');
selection.select([]);
3 Likes
system
Closed
October 4, 2023, 7:00am
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.