📜  javascript canvas mousemove - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:46.247000             🧑  作者: Mango

代码示例1
// on brouser
var canv = document.getElementById('my_canvas');
canv.addEventListener('mousemove', e => {
    console.log({x:e.offsetX, y:e.offsetY, z:e})
});

// for mobile on touch
var canv = document.getElementById('my_canvas');
canv.addEventListener('touchmove', e => {
    ee = e.touches[0];
    console.log({x:ee.clientX, y:ee.clientY, z:e})
});