bpmn-io / diagram-js

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

chore(context-pad): update position once per frame #920

Closed nikku closed 4 months ago

nikku commented 5 months ago

Proposed Changes

As shown in this flame graph, in a huge diagram, we spend substantial amount of time to re-compute canvas viewport (after select) and determine context pad position (to update it):

capture GJzwNS_optimized

All this happens within the user transaction, and blocks UI interactivity.

With this PR we batch position updates as we batch visibility updates; we'll otherwise force the browser into expensive in-frame repaints:

image

Related to https://github.com/bpmn-io/diagram-js/pull/915, https://github.com/camunda/camunda-modeler/issues/4335.

Checklist

To ensure you provided everything we need to look at your PR:

marstamm commented 4 months ago

Unrelated to this PR, but it seems like the scheduler tests consistently fail on CI Linux

nikku commented 4 months ago

Follow-up to the Firefox test failures: https://github.com/bpmn-io/diagram-js/issues/921.