fredsa / gwt-dnd

Library providing easy to use mouse or touch based drag-and-drop capabilities to GWT
42 stars 41 forks source link

mousemove performance #109

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add a bunch of draggable widgets to a canvas
2. Move your mouse all around the canvas while watching Chrome's Developer 
Tools Timeline tab

Each time a draggable widget is added to the canvas a DOM mouse move event 
is registered. Problem is, every time the mouse moves in the browser (1 
pixel or a couple, depending on the browser) each of those events is fired. 
So, the more widgets, the more bogged the javascript engine becomes... 
sometimes cause that pause/hiccup kinda scenario dragging a widget. I think 
you could get better performance by adding the dom mousemove handler when 
selected and removing it when the widget is unselected. This would make 
sure that only the widgets being dragged are informing the dom mousemove. 2 
calls to avoid 10s - 100s

Original issue reported on code.google.com by bbla...@gmail.com on 23 Mar 2010 at 9:22

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for pointing this out! This was a result of some legacy code that didn't 
get 
properly stripped out. I've made a few changes to clean things up. Can you try 
the 
attached r1025 version to confirm that it works as expected?

Thanks

Original comment by fredsa@google.com on 31 Mar 2010 at 11:12

Attachments:

GoogleCodeExporter commented 9 years ago
Appears to be included in the latest version.

Original comment by Christop...@gmail.com on 11 May 2010 at 3:45

GoogleCodeExporter commented 9 years ago
Apparently I was wrong. The widgets are no longer moved when dragged. It 
appears that 
the MouseUpHandler and the MouseMoveHandler should be added when MouseDown is 
fired and 
removed when MouseUp is fired

Original comment by Christop...@gmail.com on 12 May 2010 at 3:49