I think it's elegant actually. Appropriate and a nice link with "device driver" stuff from the past. :) haha
At least they didn't overcomplicate it. I shudder to think of: MouseEvent.MIDDLE_BUTTON_PRESSED etcs.
At least they didn't overcomplicate it. I shudder to think of: MouseEvent.MIDDLE_BUTTON_PRESSED etcs.
if ( mousedown.buttons & 4 ) alert('aux pressed')
Tho thinking of it now as you mentioned array I'd feel mousedown.buttons.includes(4) would be slightly inefficient due to the loop. We like our efficiency! Haha :)For me tho the API feels right for JS. As it's kind of a rare a 'low level' thing, it's appropriate it's API is more akin to that than something heavier like
MouseEvent.buttons.<button> = Boolean
I like the efficiency of the bit mask to immediately check multiple buttons too :) hahaTo me, it's obscene and ugly. Over the top. 4 isn't so magic when you realize that the middle button is normally considered the 3rd after the first and second buttons. And when you stretch those values into a bit field, with zero representing nothing, it's natural that the middle (or aux button) will occupy 4.
Hahaha! :) At least to my thinking. Hahaha :)
What do you think? :)