W3C home > Mailing lists > Public > public-pointer-events@w3.org > January to March 2013

Re: Last Call comments

From: Matt Brubeck <mbrubeck@mozilla.com>
Date: Fri, 22 Mar 2013 15:04:53 -0700
Message-ID: <514CD585.9060403@mozilla.com>
To: Jacob Rossi <Jacob.Rossi@microsoft.com>, Konstantinov Sergey <twirl@yandex-team.ru>, "public-pointer-events@w3.org" <public-pointer-events@w3.org>
On 3/22/2013 2:33 PM, Jacob Rossi wrote:
> var pointerList = []; //Array off all active pointers, indexed by pointer ID, that has all the latest info about each
> window.addEventListener("pointerdown", addPointer, true);
> window.addEventListener("pointermove", addPointer, true);
> window.addEventListener("pointerup", remPointer, true);
> window.addEventListener("pointercancel", remPointer, true);
> function updatePointer(e) { pointerList[e.pointerId] = e; }
> function remPointer(e) { delete pointerList[e.pointerId]; }
I wouldn't recommend this exact code: Since pointerId can be an 
arbitrary integer, looping through this array could take a very long 
time (for example if the UA decided to use pointerIds starting at 
1,000,000).  And getting the number of pointers is *not* as simple as 

However, if you replace the Array with an ES6 Map object, then the basic 
approach should work fine.
Received on Friday, 22 March 2013 22:05:19 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:20:24 UTC