bpmn-io / diagram-js

A toolbox for displaying and modifying diagrams on the web.
MIT License
1.71k stars 418 forks source link

fix(context-pad): only update visibility once per frame #915

Closed marstamm closed 5 months ago

marstamm commented 5 months ago

Significantly improves deselection performance

related to https://github.com/camunda/camunda-modeler/issues/4335 Recording 2024-06-05 at 15 06 13

nikku commented 5 months ago

I've added my cents via https://github.com/bpmn-io/diagram-js/pull/915/commits/e3d1ebc3bec72d157d5521d31792daba7dcfa359, specifically the following:


On a related note you could argue that the actual bug is a broken ("not performant") Canvas#hasMarker method. As a user you're not supposed to fiddle with the CSS of the element anyway, so markers (tested via hasMarker) could be cached, too.

marstamm commented 5 months ago

I think it is both. Canvas#hasMarker should not query the DOM and the context pad should not calculate visibility multiple times in one frame.

I added the changes to hasMarker to decouple it from the DOM in 6cefa79

nikku commented 5 months ago

Great! Spun off marker check to https://github.com/camunda/camunda-modeler/issues/4335.

nikku commented 5 months ago

Cleaned up history, split both feature (new scheduler) + fix (update once per frame).