I have a browser program that performs certain actions if a mouse button is held down. To accomplish this, the program listens for pointerdown
and pointerup
events on the document
object. When receiving these events, the program sets (or unsets) some flags that track button-held state. There are a number of other input events that should also unset a button-held flag, like focusout
and pointerout
.
Browser breakpoints seem to be a grey area. In Firefox, holding the mouse down and triggering a breakpoint causes the pointerout
event to get fired, which lets me properly unset button-held flags. However, Chrome (87.0.4280.88, Mac OS) does not appear to fire any of blur
, pointerout
, mouseout
, or focusout
when hitting a breakpoint. The result is that after I've resumed normal execution, my program code still thinks a mouse button is held down until I click again in the browser window.
Is there a workaround for this? There doesn't appear to be any way to directly poll the state of the mouse, so it seems I need to rely completely on events to drive this.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…