W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2011

Mouse Lock

From: Vincent Scheib <scheib@google.com>
Date: Thu, 16 Jun 2011 15:21:56 -0700
Message-ID: <BANLkTinV0oMZ1yE4ctVx5ZYsZgjZfZLEzgb8eFWETHBQ4VKmow@mail.gmail.com>
To: Brandon Andrews <warcraftthreeft@sbcglobal.net>
Cc: "Gregg Tavares (wrk)" <gman@google.com>, Glenn Maynard <glenn@zewt.org>, Charles Pritchard <chuck@jumis.com>, Kenneth Russell <kbr@google.com>, robert@ocallahan.org, public-webapps@w3.org
[Building on the "Mouse Capture for Canvas" thread:

I'm working on an implementation of mouse lock in Chrome, and would
appreciate collaboration on refinement of the spec proposal. Hopefully
webapps is willing to pick up this spec work? I'm up for helping write the

Some updates from Sirisian's Comment 12 on the w3 bug (
- We shouldn't need events for success/failure to obtain lock, those can be
callbacks similar to geolocation API: (

My short summary is then:
- 2 new methods on an element to enter and exit mouse lock. Two callbacks on
the entering call provide notification of success or failure.
- Mousemove event gains .deltaX .deltaY members, always valid, not just
during mouse lock.
- Elements have an event to detect when mouseLock is lost.

x = document.getElementById("x");
x.addEventListener("mousemove", mouseMove);
x.addEventListener("mouseLockLost", mouseLockLost);
  function() { console.log("Locked."); },
  function() { console.log("Lock rejected."); } );
function mouseMove(e) { console.log(e.deltaX + ", " + e.deltaY); }
function mouseLockLost(e) { console.log("Lost lock."); }
Received on Sunday, 19 June 2011 00:11:24 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:32 UTC