Open main menu

CDOT Wiki β

Changes

Implementing the Mouse Lock API in Firefox

63 bytes added, 11:01, 3 December 2011
Tests
# <strike>"The concept of the mouse cursor will have been removed, and it will not move off the window or be clamped by a screen edge"</strike> - '''hchun'''
# "no mouse cursor is displayed" -- mouse cursor should be hidden while locked - '''dvillase'''
# <s>navigator.pointer (readonly) is a MouseLockable </s> - <strong>abhatnagar</strong># <s>MouseLockable has lock(), unlock(), islocked() </s> - <strong>abhatnagar</strong># <s>islocked() returns true if mouse is locked, false if not locked </s> - <strong>JSilver999</strong># <s>lock(target) expects a DOM element, and takes two optional callbacks: successcallback, failurecallback. </s> - <strong>JSilver999</strong># <s>lock() should return immediately and call callbacks when lock succeeds or fails </s> - <strong>JSilver999</strong>
# "Mouse lock must succeed only if the window is in focus" - '''johnno'''
# "Mouse lock must succeed only if...the user-agent is the active application of the operating system" - '''johnno'''
# <strike>"Mouse lock must succeed only if the target is in the DOM tree"</strike> - '''Anachid'''
# <strike>"If the target is removed from the DOM tree after mouse lock is entered then mouse lock will be lost."</strike> - '''Anachid'''
# <s>"If the mouse is already locked to the same element, a repeated call to lock will succeed and the successCallback called" </s> - '''jboelen'''# <s>"If another element is locked [and lock() is called] a user agent must transfer the mouse lock to the new target and call the mouselocklost callback for the previous target" </s> - '''jboelen'''
# "The Mouse Lock API must provide a default system action to unlock the mouse" namely ESC. - '''CloudScorpian'''
# "Once in the locked state the user agent must fire all relevant user generated MouseEvent events (for example: mousemove, mousedown, mouseup, click, wheel)[DOM-LEVEL-3-CORE] to the target of mouse lock, and not fire mouse events to other elements" - '''rhung'''
# "The unlock method cancels the mouse lock state" - '''abhatnagar1'''
# "[Upon unlock() t]he system mouse cursor must be displayed again and positioned at the same location that it was when mouse lock was entered (the same location that is reported in screenX/Y when the mouse is locked)" - '''dvillase'''
# <s>"When mouse lock is lost or disabled for any reason user agents must fire an event named mouselocklost with its bubble attribute set to true to the mouse lock target element" </s> - '''stsang'''
# MouseEvent must contain (readonly) movementX and movementY - '''KeyR'''
# "The members movementX and movementY must provide the change in position of the mouse, as if the values of screenX/Y were stored between two subsequent mousemove events eNow and ePrevious and the difference taken movementX = eNow.screenX-ePrevious.screenX" - '''KeyR'''
# "movementX/Y must be valid regardless of mouse lock state" - '''KeyR'''
# "When unlocked, the system cursor can exit and re-enter the user agent window. If it does so and the user agent was not the target of operating system mouse move events then the most recent mouse position will be unknown to the user agent and movementX/Y can not be computed and must be set to zero" - '''moussa1'''
# <s>"When mouse lock is enabled clientX, clientY, screenX, and screenY must hold constant values as if the mouse did not move at all once mouse lock was entered" </s> - '''jbraffoul'''
# "The Mouse Lock API must exit the mouse lock state if the user agent, window, or tab loses focus" - '''drigato'''
# Test to make sure that mouse lock only occurs when an element is in full screen mode (not F11 or done via the menus). This includes:
1
edit