Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Use mouse events after preventDefault?

Participant ,
Feb 10, 2021 Feb 10, 2021

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?

TOPICS
Code , How to
155
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation