First of all, how do you write the judgment conditions of your mousedrag event? Is it triggered as soon as you enter the canvas or is it something else? If according to your description, you don't want the mouse to enter the canvas again to trigger the event, then you can just set mousedrag = null;
Have you tried event.stopPropagation()
First of all, how do you write the judgment conditions of your mousedrag event? Is it triggered as soon as you enter the canvas or is it something else? If according to your description, you don't want the mouse to enter the canvas again to trigger the event, then you can just set mousedrag = null;