Re: Mouse Capture for Canvas

> On Wed, Feb 9, 2011 at 11:37 PM, Brandon Andrews 
><> wrote:
>> So what you'd prefer would be to allow the mouse to call element.lockMouse(), 
>>element.unlockMouse() whenever it wanted. Then assume the user-agent will 
>>perform restrictions?
>> These restrictions would be asking the user to allow the action and preventing 
>> Sounds good. This gets rid of the events completely.

> The events should still exist, so you can tell if your request was accepted, 
>and you can tell if the browser has locked or unlocked the mouse for other 
>reasons, such as pressing a hotkey to release the mouse.  There should probably 
>also be a "lockrefused" event, to notify that a lock request was rejected.

Whoops. Forgot to remove that when I was typing my post. I kind of felt like I 
missed something.
The events would be mouselock(event) and mouseunlock(event) now. So both of 
those would have events.
event.successful to see if the mouselock was successful?
The event could be called MouseLockEvent.
Fits with MouseEvent, KeyboardEvent, WheelEvent
(On another note the WheelEvent deltaX and deltaY can be moved to MouseEvent 
since both are the same data type. The wheel and mousemove event would just use 
them differently. Might be a poor design decision that will need to be checked 

Does the mouseunlock require an event? (Could you cancel the event?)

>> Assuming that a person can call the lock function whenever in any mouse or 
>>keyboard event then there is no initial interaction required. Sounds like what 
>>you want, and it would be very flexible.
> This would still require initial interaction; for example, in the "lobby timer" 
>case, you'd still have to do something--click the screen or press a key--to 
>initiate it.
A query could be implemented ( element.canLockMouse() ) to see if the 
domain/page is allowed to capture the mouse. If not it could call the 
element.lockMouse() to initiate the browser's security feature. A browser that 
doesn't implement any would just return true for allowed. That seems very 
different from what I've seen in any DOM stuff though.

Received on Thursday, 10 February 2011 06:12:36 UTC