How to set mousemove update speed?

前端 未结 5 1691
隐瞒了意图╮
隐瞒了意图╮ 2020-11-29 10:00

im generating a function where it needs to set easy and fast a signature. I\'m writing the signature in an canvas field. I use jQuery for it, but the refresh rate of mousemo

5条回答
  •  有刺的猬
    2020-11-29 10:54

    You need to make your handler faster.

    Browsers can drop events if a handler for that event is still running, so you need to get out of the mousemove handler asap. You could try to optimise the code there or defer work till after the mouse movement is complete. Drawing is probably the slowest thing you are doing, so you could store the mouse movements in memory and draw later. This would not update the display until drawing had finished but it would otherwise work better.

提交回复
热议问题