cornerstone icon indicating copy to clipboard operation
cornerstone copied to clipboard

Enhance RAF

Open kofifus opened this issue 5 years ago • 2 comments

This PR modifies the existing RAF draw mechanism in the following ways:

  • use RAF and keep bouncing turning it off so that its not running if nothing needs to be repainted. This allows at both have the advantages of RAF without the cost of having it running when not needed.

  • Have only one RAF servicing all elements CS is handling

  • add a mechanism to register for callbacks from the RAF (addDrawCallback and removeDrawCallback). Tools such as PlayClip can now simply register for RAF callback, switch the image on the element and return without needing to maintain their own setTimeout mechanisms

  • drawImage now registers for the visibilitychange HTML event so that ie when a tab that lost focus regains it RAF wil start again

kofifus avatar Mar 25 '19 03:03 kofifus

I didn't test it, but I don't have any objections based on the implementation. IMHO, It's far better than the last proposal. 👍

jpambrun avatar Mar 27 '19 12:03 jpambrun

Any news on this ?

kofifus avatar May 24 '19 22:05 kofifus