Closed DmitryMyadzelets closed 9 years ago
I've just found that running the Runner by on-screen arrows doesn't result in rendering of the automaton. Keyboard works, though.
Looks good, looking forward to merging this. Please address the comments above and let's continue :)
Thanks for your work :)
This PR fixes issue #25. The discussion of this issue points out that rendering has to occur in the three cases. It seems true, but just calling
renderer.render()
during dragging states by mouse reveals a worse performance than it was initially. It happens when a rendering rate, which depends on number ofmousemove
events, is higher then a possible animation frame rate. The solution is to userequestAnimationFrame
and invoke it only when there is a need and the previous request is processed ('rendering_requested' attribute of the renderer). And that has been done.During resize of the window we can call
renderer.render()
directly for the immediate redraw. It looks better then callingrenderer.requestRender()
.Below is the CPU load on my PC before this patch:![before](https://cloud.githubusercontent.com/assets/2686981/5509468/b4156488-87b8-11e4-95dd-52f1b5658df1.png)
and after:![after](https://cloud.githubusercontent.com/assets/2686981/5509478/caf19a5a-87b8-11e4-80d8-63c2e6e2df09.png)
On the last picture the high CPU load in the end occurs while dragging a state.