function getMousePos(canvas, evt) {
var rect = canvas.getBoundingClientRect();
return {
x: evt.clientX - rect.left * (canvas.width / rect.width),
y: evt.clientY - rect.top * (canvas.height / rect.height)
}
}

相关文章:

  • 2021-09-27
  • 2021-10-03
  • 2022-12-23
  • 2022-12-23
  • 2021-08-09
  • 2021-11-01
  • 2021-09-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-03
相关资源
相似解决方案