Hide shape when I drag and release it to a position
Hi everyone,
My goal is to make the button symbol dissapear when I drag and release it over a certain Y value.
It kinda works but when I drag the button symbol over the Y value (shown with the red line) I first have to click the shape for it to dissapear.
Is there a way for it to dissapear when I drag and release the button symbol over the red line?
Video example:
https://www.dropbox.com/s/gn4efqrlzkq1vf7/example.mp4?dl=0
Project files: https://www.dropbox.com/scl/fo/mpy2bsyjtcidizx5afuf8/hdl=0&rlkey=n51y70ro754ekzk135lm6yfsd
this.button.addEventListener("mousedown", onMouseDown.bind(this));
this.button.addEventListener("pressmove", onPressMove.bind(this));
function onPressMove(e){
e.currentTarget.y = e.stageY / stage.scaleY - e.currentTarget.offset.y;
}
function onMouseDown(e)
{
e.currentTarget.offset = { x: e.stageX / stage.scaleX - e.currentTarget.x, y: e.stageY / stage.scaleY - e.currentTarget.y };
if (e.currentTarget.y > 650) {
this.button.visible=false;
}
}