react state is old value , on mouse:move , how to deal with it ? #10058
Unanswered
vaynevayne
asked this question in
Q&A
Replies: 1 comment 2 replies
-
{
'mouse:down': e => {
isClick = true;
},
'mouse:move': e => {
if (isClick) {
// do something
}
},
'mouse:up': e => {
isClick = false;
}
}
canvas.on("mouse:down", function down(ev) {
function move(e) {
// do something
}
canvas.on("mouse:move", move);
canvas.on("mouse:up", function up(e) {
canvas.off("mouse:move", move);
canvas.off("mouse:up", up);
});
}); |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
same as title
Beta Was this translation helpful? Give feedback.
All reactions