drawio icon indicating copy to clipboard operation
drawio copied to clipboard

Excess event listeners affecting the performance

Open FarSeeing opened this issue 1 year ago • 0 comments

Preflight Checklist

  • [x] I agree to follow the Code of Conduct that this project adheres to.
  • [x] I have searched the issue tracker for a feature request that matches the one I want to file, without success.

You must agree to search and the code of conduct. You must fill in this entire template. If you delete part/all or miss parts out your issue will be closed.

If you are technical, you should reporting bugs along the lines of https://marker.io/blog/how-to-write-bug-report. If you are not technical, we will make allowances, please try to make an effort to understand the process.

Describe the bug Briefly: the sidebar elements add excess event listeners that result in the perfomance drop on every graph action like zoom/scroll

Detailed: the sidebar elements call this code from the Sidebar.js:

graph.addListener(mxEvent.ESCAPE, function(sender, evt)
{
	if (dragSource.isActive())
	{
		dragSource.reset();
	}
});

This is the amount of event listeners on the empty diagram: image

And that's the amount if you disable he mentioned code block on the same empty diagram: image

Since that Escape listener is used only for active drag source (sources?) - it makes sense to add the listener dynamically only on actual drag start.

draw.io version (In the Help->About menu of the draw.io editor):

  • draw.io version 24.3.1

I tested the problem in incognito/private mode with all browser extensions switched off, write "yes" below:

  • yes

Additional context Add any other context about the problem here.

FarSeeing avatar May 04 '24 08:05 FarSeeing