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

Use mouse events after preventDefault?

Participant ,
Feb 10, 2021 Feb 10, 2021

Copy link to clipboard

Copied

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

Views

131

Translate

Translate

Report

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