Menu

#2426 Canvas EventListener mouse failure

2020.3
New
nobody
Low
2024-10-22
2020-11-22
legoboyvdlp
No

In an Canvas EventListener, the "mouseup" event does not fire if you move the mouse outside the region. This is problematic as if you have a timer which fires after a mousedown event, if the mouseup event never fires you may get an infinite timer.

Is there any way that the mousedown event can fire as soon as you release the mouse no matter where the mouse pointer is in relation to the object?

This probably isn't the most clear description of the issue, so I hope this test case will show it well:

Test case: copy this into the nasal console and execute:
https://pastebin.com/iKcwRTuq

This will launch a screen:

This will show the problem nicely. It will get stuck on like so, as the mouseup never fires.

Discussion

  • legoboyvdlp

    legoboyvdlp - 2020-11-22
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,4 @@
    -In an eventlistener, the "mouseup" event does not fire if you move the mouse outside the region. This is problematic as if you have a timer which fires after a mousedown event, if the mouseup event never fires you may get an infinite timer.
    +In an Canvas EventListener, the "mouseup" event does not fire if you move the mouse outside the region. This is problematic as if you have a timer which fires after a mousedown event, if the mouseup event never fires you may get an infinite timer.
    
     Is there any way that the mousedown event can fire as soon as you release the mouse no matter where the mouse pointer is in relation to the object?
    
     
  • James Turner

    James Turner - 2020-11-24

    Yep, should be fixable. I don't think anyone has touched this code in a while, however. Will see how easy./hard it is!

     
  • Frederic Türpe

    Frederic Türpe - 2024-10-22

    Just reminding you to fix this ! ;)

     

Log in to post a comment.

MongoDB Logo MongoDB