I have a huge graph with hundreds of nodes and links, which trigger a LOT of repainting. since I only need one repainting no matter which node triggers it, I need a throttle on the repaint method.
There already is debouncing, but if I call repaint 1000 times in a second, the debouncing will still call it 1000 times but in gaps of x ms, while the throttle will throw away many repaints.
Let's say that I drag a node for 1 second and want a repaint once every 10ms, but call repaint 1000 times in that second. I only want 100 repaints.
So I changed the code of CanvasEngine to this and it worked!
Any chance the contributors would add throttle in addition to debounce?
The following is the complied code I changed (changes occured in CanvasEngine.js only in constructor and repaintCanvas):
I have a huge graph with hundreds of nodes and links, which trigger a LOT of repainting. since I only need one repainting no matter which node triggers it, I need a throttle on the repaint method.
There already is debouncing, but if I call repaint 1000 times in a second, the debouncing will still call it 1000 times but in gaps of x ms, while the throttle will throw away many repaints. Let's say that I drag a node for 1 second and want a repaint once every 10ms, but call repaint 1000 times in that second. I only want 100 repaints.
So I changed the code of CanvasEngine to this and it worked! Any chance the contributors would add throttle in addition to debounce?
The following is the complied code I changed (changes occured in CanvasEngine.js only in constructor and repaintCanvas):