Use mouse events after preventDefault?

Participant ,
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

47

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Have something to add?

Join the conversation