I wrote the code as follows to disabled short keys but I can’t recover the function when I click other elements:
function onKeyDown(event) {
switch (event.keyCode) {
/* case 37: //left arrow btn
case 39: //right arrow btn
*/
case 38: //up arrow btn
case 40: //down arrow btn
case 87: // w
case 83: // s
case 65: // a
case 68: // d
case 33: //page up
case 34: //page down
case 69: //q
case 81: //e
event.stopPropagation();
break;
}
}
document.getElementById('east-5floor4').addEventListener('click',function () {
viewer.switchToView('BL东5F');
viewer.requestFrame();
setTimeout(function() {
viewer.openPopup(BalconyEast_5F,
{centerHorizontally: true, centerVertically: true});
}, 2750);
document.addEventListener('keydown', onKeyDown, true);
});
Does there have some ways to recover key events after event.stopPropagation() (W : Walk Straight S: Walk Back etc.)?