Skip to main content
PATurmel12
Inspiring
February 10, 2021
Question

Use mouse events after preventDefault?

  • February 10, 2021
  • 0 replies
  • 181 views

A couple of problems with this code:

1: "stagemousemove" doesn't work after preventDefault is called

2: I have to tap an Android device fairly hard to trigger the "stagemousedown"

function preventDefault(e) {
    e.preventDefault();
}

function disableScroll() {
    window.addEventListener('touchmove', preventDefault, false);
}


stage.addEventListener("stagemousedown", down.bind(this));
function down(e){

    disableScroll();

}


stage.addEventListener("stagemousemove", move.bind(this));
function move(e){

    console.log(e.stageX / stage.scaleX);  //  not working after disableScroll function called
    
}

Anyone have any idea how to fix this?

This topic has been closed for replies.