Properties update on select

Hi, is there another way how to update element properties than by

    this.modeling.updateProperties(element, {
        opacity: 0.18
    });

? I am trying to change opacity to all not currently selected elements and it is very very slow if the diagram contains a lot of elements.

Iā€™d avoid using commands for that kind of thing. CSS should do the trick.

.djs-element:not(.selected) {
  opacity: 0.5;
}

Ok, and what if I need to change opacity also to the directly connected tasks and links to the selected one?

You can use canvas.addMarker and canvas.removeMarker for this:

2 Likes

That is exactly what I was looking for! Thank you sooo much!

1 Like

However this also cause that I drag all of the tasks at once :frowning:

Sorry 'bout that. My code accidentally mutated the selected elements.

This should work: https://codesandbox.io/s/bpmn-js-sandbox-k0zz8