Mouseclick / mousedown / mouseup事件无效

时间:2018-02-05 16:05:53

标签: mouseclick-event mousedown mouseup

我试图通过这样做来拍摄,但是当我点击并释放时它会一直拍摄。

document.onclick = function(event) {
    socket.emit('movementKey', {
        inputId: 'attack',
        state: true
    });
}
document.onmousedown = function(event) {
    socket.emit('movementKey', {
        inputId: 'attack',
        state: false
    });
}

0 个答案:

没有答案
相关问题