W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2011

Re: Mouse Capture for Canvas

From: Brandon Andrews <warcraftthreeft@sbcglobal.net>
Date: Wed, 9 Feb 2011 22:12:03 -0800 (PST)
Message-ID: <563031.70121.qm@web83813.mail.sp1.yahoo.com>
To: Glenn Maynard <glenn@zewt.org>
Cc: Charles Pritchard <chuck@jumis.com>, Kenneth Russell <kbr@google.com>, robert@ocallahan.org, public-webapps@w3.org
> On Wed, Feb 9, 2011 at 11:37 PM, Brandon Andrews 
><warcraftthreeft@sbcglobal.net> 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 
>>abuse?
>> 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 
out).

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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:43 GMT