From 53aa55eecaf1863d3d155beeaaac8e06e894b740 Mon Sep 17 00:00:00 2001 From: Sahir Vellani Date: Thu, 11 Jan 2024 13:44:00 -0800 Subject: [PATCH 01/15] Add deviceId to PointerEvent spec This change proposes the introduction of a new attribute to the PointerEvent interface - deviceId. See: https://github.com/WICG/pointer-event-extensions/blob/main/pointer-event-device-id-explainer.md --- index.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.html b/index.html index 116e614..731b14d 100644 --- a/index.html +++ b/index.html @@ -214,6 +214,7 @@

PointerEvent interface

double azimuthAngle; DOMString pointerType = ""; boolean isPrimary = false; + long deviceId = -1; sequence<PointerEvent> coalescedEvents = []; sequence<PointerEvent> predictedEvents = []; }; @@ -233,6 +234,7 @@

PointerEvent interface

readonly attribute double azimuthAngle; readonly attribute DOMString pointerType; readonly attribute boolean isPrimary; + readonly attribute long deviceId; [SecureContext] sequence<PointerEvent> getCoalescedEvents(); sequence<PointerEvent> getPredictedEvents(); }; @@ -325,6 +327,10 @@

PointerEvent interface

Indicates if the pointer represents the primary pointer of this pointer type.

+
deviceId
+
+

A unique identifier for the device that generates the pointer event. Pointer events generated from the same physical device will have the same deviceId for the browsing session. User agents MAY reserve a generic deviceId value of 0 or 1 for events generated by the primary mouse device. The deviceId value of -1 MUST be reserved and used to indicate events whose generating device could not be identified.

+
getCoalescedEvents()

A method that returns the list of coalesced events.

From abe761fe405eeb980f8a512a07596baa644c5e9b Mon Sep 17 00:00:00 2001 From: Sahir Vellani Date: Thu, 18 Jan 2024 20:38:03 -0800 Subject: [PATCH 02/15] Specify value of 1 for mouse events --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 731b14d..bf87190 100644 --- a/index.html +++ b/index.html @@ -329,7 +329,7 @@

PointerEvent interface

deviceId
-

A unique identifier for the device that generates the pointer event. Pointer events generated from the same physical device will have the same deviceId for the browsing session. User agents MAY reserve a generic deviceId value of 0 or 1 for events generated by the primary mouse device. The deviceId value of -1 MUST be reserved and used to indicate events whose generating device could not be identified.

+

A unique identifier for the device that generates the pointer event. Pointer events generated from the same physical device will have the same deviceId for the browsing session. A generic deviceId value of 1 MUST be reserved for events generated by the primary mouse device. The deviceId value of -1 MUST be reserved and used to indicate events whose generating device could not be identified.

getCoalescedEvents()
From 55a1acca256f30e8030c415b6d85861bd2e6d046 Mon Sep 17 00:00:00 2001 From: Sahir Vellani Date: Tue, 5 Mar 2024 14:25:55 -0800 Subject: [PATCH 03/15] Switch to deviceProperties --- index.html | 46 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index bf87190..339a0ba 100644 --- a/index.html +++ b/index.html @@ -192,6 +192,29 @@

Examples

pointerEventInitDict.coalescedEvents = [p1, p2]; const event2 = new PointerEvent("pointermove", pointerEventInitDict); eventTarget.dispatchEvent(event2); + +
+    <div style="position:absolute; top:0px; left:0px; width:100px;height:100px;"></div>
+    <script>
+    window.addEventListener("pointerdown", assignPenColor);
+    const colorMap = new Map();
+
+    function assignPenColor(event) {
+        const uniqueId = event.deviceProperties.uniqueId;
+        // Check if a color has been assigned to the device.
+        if (map.has(uniqueId)) {
+            return;
+        }
+        // Assign a color to the device.
+        let newColor = getNewColor();
+        map.set(uniqueId, newColor);
+        return newColor;
+    }
+
+    function getNewColor() {
+        /* return some color value */
+    }
+    </script>
 
@@ -214,9 +237,9 @@

PointerEvent interface

double azimuthAngle; DOMString pointerType = ""; boolean isPrimary = false; - long deviceId = -1; sequence<PointerEvent> coalescedEvents = []; sequence<PointerEvent> predictedEvents = []; + DeviceProperties deviceProperties; }; [Exposed=Window] @@ -234,7 +257,7 @@

PointerEvent interface

readonly attribute double azimuthAngle; readonly attribute DOMString pointerType; readonly attribute boolean isPrimary; - readonly attribute long deviceId; + readonly attribute DeviceProperties deviceProperties; [SecureContext] sequence<PointerEvent> getCoalescedEvents(); sequence<PointerEvent> getPredictedEvents(); }; @@ -327,9 +350,9 @@

PointerEvent interface

Indicates if the pointer represents the primary pointer of this pointer type.

-
deviceId
+
deviceProperties
-

A unique identifier for the device that generates the pointer event. Pointer events generated from the same physical device will have the same deviceId for the browsing session. A generic deviceId value of 1 MUST be reserved for events generated by the primary mouse device. The deviceId value of -1 MUST be reserved and used to indicate events whose generating device could not be identified.

+

A set of properties that represent event generating device-specific information such as unique id.

getCoalescedEvents()
@@ -829,6 +852,21 @@

Event dispatch

+
+

DeviceProperties interface

+
+                [Exposed=PointerEvent]               
+                interface DeviceProperties {
+                    readonly attribute long uniqueId;
+                };
+            
+
+
uniqueId
+
+

A unique identifier for the device that generates the pointer event. Pointer events generated from the same physical device will have the same uniqueId for the browsing session. A generic uniqueId value of 1 MUST be reserved for events generated by the primary mouse device. The uniqueId value of -1 MUST be reserved and used to indicate events whose generating device could not be identified.

+
+
+
From bcd5db0acab9e3eef15829e851067285f4996697 Mon Sep 17 00:00:00 2001 From: Sahir Vellani Date: Tue, 5 Mar 2024 14:34:45 -0800 Subject: [PATCH 04/15] Fix example numbering --- index.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index 339a0ba..bf8dd68 100644 --- a/index.html +++ b/index.html @@ -609,7 +609,7 @@

Converting between tiltX / tiltY and altitud

Pointer Events include two complementary sets of attributes to express the orientation of a transducer relative to the X-Y plane: tiltX / tiltY (introduced in the original Pointer Events specification), and azimuthAngle / altitudeAngle (adopted from the Touch Events - Level 2 specification).

Depending on the specific hardware and platform, user agents will likely only receive one set of values for the transducer orientation relative to the screen plane — either tiltX / tiltY or altitudeAngle / azimuthAngle. User agents MUST use the following algorithm for converting these values.

When the user agent calculates tiltX / tiltY from azimuthAngle / altitudeAngle it SHOULD round the final integer values using Math.round [[ECMASCRIPT]] rules.

-
/* Converting between tiltX/tiltY and altitudeAngle/azimuthAngle */
+
/* Converting between tiltX/tiltY and altitudeAngle/azimuthAngle */
 
 function spherical2tilt(altitudeAngle, azimuthAngle) {
   const radToDeg = 180/Math.PI;
@@ -1058,17 +1058,17 @@ 

Details of touch-action valu
Disabling some default direct manipulation behaviors for panning and zooming may allow user agents to respond to other behaviors more quickly. For example, with auto user agents typically add 300ms of delay before click to allow for double-tap gestures to be handled. In these cases, explicitly setting touch-action: none or touch-action: manipulation will remove this delay. Note that the methods for determining a tap or double-tap gesture are out of scope for this specification.

-
+
 <div style="touch-action: none;">
     This element receives pointer events for all direct manipulation interactions that otherwise lead to panning or zooming.
 </div>
 
-
+
 <div style="touch-action: pan-x;">
     This element receives pointer events when not panning in the horizontal direction.
 </div>
 
-
+
 <div style="overflow: auto;">
     <div style="touch-action: none;">
         This element receives pointer events for all direct manipulation interactions that otherwise lead to panning or zooming.
@@ -1078,7 +1078,7 @@ 

Details of touch-action valu </div> </div>

-
+
 <div style="overflow: auto;">
     <div style="touch-action: pan-y;">
         <div style="touch-action: pan-x;">
@@ -1091,7 +1091,7 @@ 

Details of touch-action valu </div> </div>

-
+
 <div style="overflow: auto;">
     <div style="touch-action: pan-y pan-left;">
         <div style="touch-action: pan-x;">
@@ -1222,7 +1222,7 @@ 

Coalesced events

  • Empty coalesced events list and predicted events list of their own.
  • -
    +
     <style>
         /* Disable intrinsic user agent direct manipulation behaviors (such as panning or zooming)
         so that all events on the canvas element are given to the application instead. */
    @@ -1338,7 +1338,7 @@ 

    Predicted events

    pointer events are dispatched earlier than the timestamp of one or more of the predicted events.

    -
    +
     
     let predicted_points = [];
     window.addEventListener("pointermove", function(event) {
    
    From 06be8e07142d92e280bb64af42320ddffbd3bdd7 Mon Sep 17 00:00:00 2001
    From: Sahir Vellani 
    Date: Tue, 5 Mar 2024 14:48:35 -0800
    Subject: [PATCH 05/15] Add some more details to uniqueId decription
    
    ---
     index.html | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/index.html b/index.html
    index bf8dd68..c37ad25 100644
    --- a/index.html
    +++ b/index.html
    @@ -863,7 +863,7 @@ 

    DeviceProperties interface

    uniqueId
    -

    A unique identifier for the device that generates the pointer event. Pointer events generated from the same physical device will have the same uniqueId for the browsing session. A generic uniqueId value of 1 MUST be reserved for events generated by the primary mouse device. The uniqueId value of -1 MUST be reserved and used to indicate events whose generating device could not be identified.

    +

    A unique identifier for the pointing device. Pointer events generated from the same physical device will have the same uniqueId for the browsing session. A generic uniqueId value of 1 MUST be reserved for events generated by the primary mouse device. The uniqueId value of -1 MUST be reserved and used to indicate events whose generating device could not be identified. uniqueId may be omitted/unset if hardware constraints prevent the UA from obtaining the device identifier. Like pointerId, to minimize the chance of fingerprinting and tracking across different pages or domains, the uniqueId MUST only be associated explicitly with that particular pointing device for the lifetime of the page / session, and a new randomized uniqueId MUST be chosen the next time that particular pointing device is used again in a new session.

    From fe6a97d4752d592e14e84c5a77b02a4a60e1c0b3 Mon Sep 17 00:00:00 2001 From: Sahir Vellani Date: Wed, 6 Mar 2024 12:26:10 -0800 Subject: [PATCH 06/15] Add constructor --- index.html | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/index.html b/index.html index c37ad25..304b7a1 100644 --- a/index.html +++ b/index.html @@ -714,6 +714,22 @@

    Converting between tiltX / tiltY and altitud

    +
    +

    DeviceProperties interface

    +
    +                [Exposed=PointerEvent]
    +                interface DeviceProperties {
    +                    constructor(long uniqueId);
    +                    readonly attribute long uniqueId;
    +                };
    +            
    +
    +
    uniqueId
    +
    +

    A unique identifier for the pointing device. Pointer events generated from the same physical device will have the same uniqueId for the browsing session. A generic uniqueId value of 1 MUST be reserved for events generated by the primary mouse device. The uniqueId value of -1 MUST be reserved and used to indicate events whose generating device could not be identified. uniqueId may be omitted/unset if hardware constraints prevent the UA from obtaining the device identifier. Like pointerId, to minimize the chance of fingerprinting and tracking across different pages or domains, the uniqueId MUST only be associated explicitly with that particular pointing device for the lifetime of the page / session, and a new randomized uniqueId MUST be chosen the next time that particular pointing device is used again in a new session.

    +
    +
    +

    Pointer Event types

    @@ -852,21 +868,6 @@

    Event dispatch

    -
    -

    DeviceProperties interface

    -
    -                [Exposed=PointerEvent]               
    -                interface DeviceProperties {
    -                    readonly attribute long uniqueId;
    -                };
    -            
    -
    -
    uniqueId
    -
    -

    A unique identifier for the pointing device. Pointer events generated from the same physical device will have the same uniqueId for the browsing session. A generic uniqueId value of 1 MUST be reserved for events generated by the primary mouse device. The uniqueId value of -1 MUST be reserved and used to indicate events whose generating device could not be identified. uniqueId may be omitted/unset if hardware constraints prevent the UA from obtaining the device identifier. Like pointerId, to minimize the chance of fingerprinting and tracking across different pages or domains, the uniqueId MUST only be associated explicitly with that particular pointing device for the lifetime of the page / session, and a new randomized uniqueId MUST be chosen the next time that particular pointing device is used again in a new session.

    -
    -
    -
    From dd4ea5ae379eea2f54a98828ce384a77cd7833f5 Mon Sep 17 00:00:00 2001 From: Sahir Vellani Date: Mon, 11 Mar 2024 10:26:24 -0700 Subject: [PATCH 07/15] Address feedback --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 304b7a1..d2440f3 100644 --- a/index.html +++ b/index.html @@ -717,7 +717,7 @@

    Converting between tiltX / tiltY and altitud

    DeviceProperties interface

    -                [Exposed=PointerEvent]
    +                [Exposed=Window]
                     interface DeviceProperties {
                         constructor(long uniqueId);
                         readonly attribute long uniqueId;
    @@ -726,7 +726,7 @@ 

    DeviceProperties interface

    uniqueId
    -

    A unique identifier for the pointing device. Pointer events generated from the same physical device will have the same uniqueId for the browsing session. A generic uniqueId value of 1 MUST be reserved for events generated by the primary mouse device. The uniqueId value of -1 MUST be reserved and used to indicate events whose generating device could not be identified. uniqueId may be omitted/unset if hardware constraints prevent the UA from obtaining the device identifier. Like pointerId, to minimize the chance of fingerprinting and tracking across different pages or domains, the uniqueId MUST only be associated explicitly with that particular pointing device for the lifetime of the page / session, and a new randomized uniqueId MUST be chosen the next time that particular pointing device is used again in a new session.

    +

    A unique identifier for the pointing device. Pointer events generated from the same physical device will have the same uniqueId for the browsing session. A generic uniqueId value of 1 MUST be reserved for events generated by the primary mouse device. The uniqueId value of -1 MUST be reserved and used to indicate events whose generating device could not be identified. Like pointerId, to minimize the chance of fingerprinting and tracking across different pages or domains, the uniqueId MUST only be associated explicitly with that particular pointing device for the lifetime of the page / session, and a new randomized uniqueId MUST be chosen the next time that particular pointing device is used again in a new session.

    From 453da9f62033fd030e6c2515b8544d157ef7f219 Mon Sep 17 00:00:00 2001 From: Sahir Vellani Date: Thu, 21 Mar 2024 14:41:35 -0700 Subject: [PATCH 08/15] Address feedback, add init dict --- index.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index d2440f3..f4894e2 100644 --- a/index.html +++ b/index.html @@ -197,10 +197,15 @@

    Examples

    <div style="position:absolute; top:0px; left:0px; width:100px;height:100px;"></div> <script> window.addEventListener("pointerdown", assignPenColor); + window.addEventListener("pointerMove", assignPenColor); const colorMap = new Map(); function assignPenColor(event) { const uniqueId = event.deviceProperties.uniqueId; + // Check if a unique Id exists. + if (!uniqueId) { + return; + } // Check if a color has been assigned to the device. if (map.has(uniqueId)) { return; @@ -717,16 +722,20 @@

    Converting between tiltX / tiltY and altitud

    DeviceProperties interface

    +                dictionary DevicePropertiesInit {
    +                    long uniqueId = 0;
    +                };
    +
                     [Exposed=Window]
                     interface DeviceProperties {
    -                    constructor(long uniqueId);
    +                    constructor(optional DevicePropertiesInit devicePropertiesInitDict = {});
                         readonly attribute long uniqueId;
                     };
                 
    uniqueId
    -

    A unique identifier for the pointing device. Pointer events generated from the same physical device will have the same uniqueId for the browsing session. A generic uniqueId value of 1 MUST be reserved for events generated by the primary mouse device. The uniqueId value of -1 MUST be reserved and used to indicate events whose generating device could not be identified. Like pointerId, to minimize the chance of fingerprinting and tracking across different pages or domains, the uniqueId MUST only be associated explicitly with that particular pointing device for the lifetime of the page / session, and a new randomized uniqueId MUST be chosen the next time that particular pointing device is used again in a new session.

    +

    A unique identifier for the pointing device. If the hardware supports multiple pointers, pointer events generated from pointing devices must only get a uniqueId if those pointers are uniquely identifiable over the session. If the pointer is uniquely identifiable, the assigned uniqueId to that pointing device will remain constant for the remainder of the session. uniqueId value of 1 MUST be reserved for events generated by the primary mouse device. The uniqueId value of -1 MUST be reserved and used to indicate events whose generating device could not be identified. Like pointerId, to minimize the chance of fingerprinting and tracking across different pages or domains, the uniqueId MUST only be associated explicitly with that particular pointing device for the lifetime of the page / session, and a new randomized uniqueId MUST be chosen the next time that particular pointing device is used again in a new session.

    From b2d7e8371f15d55aab0dbe6f5d47616df15d9d19 Mon Sep 17 00:00:00 2001 From: Sahir Vellani Date: Tue, 26 Mar 2024 13:44:25 -0700 Subject: [PATCH 09/15] Fix example --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index f4894e2..422bb1d 100644 --- a/index.html +++ b/index.html @@ -197,13 +197,13 @@

    Examples

    <div style="position:absolute; top:0px; left:0px; width:100px;height:100px;"></div> <script> window.addEventListener("pointerdown", assignPenColor); - window.addEventListener("pointerMove", assignPenColor); + window.addEventListener("pointermove", assignPenColor); const colorMap = new Map(); function assignPenColor(event) { const uniqueId = event.deviceProperties.uniqueId; // Check if a unique Id exists. - if (!uniqueId) { + if (uniqueId == -1) { return; } // Check if a color has been assigned to the device. From eefea6e485c00317de130992cceb67f0e6814092 Mon Sep 17 00:00:00 2001 From: Sahir Vellani Date: Tue, 26 Mar 2024 13:46:56 -0700 Subject: [PATCH 10/15] Fix default value in dict --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 422bb1d..17a39dc 100644 --- a/index.html +++ b/index.html @@ -723,7 +723,7 @@

    Converting between tiltX / tiltY and altitud

    DeviceProperties interface

                     dictionary DevicePropertiesInit {
    -                    long uniqueId = 0;
    +                    long uniqueId = -1;
                     };
     
                     [Exposed=Window]
    
    From 4d14be1096c92eab41a7d323906e11928d00c867 Mon Sep 17 00:00:00 2001
    From: Sahir Vellani 
    Date: Tue, 16 Apr 2024 15:57:37 -0700
    Subject: [PATCH 11/15] Remove mouse clause, add missing uniqueId note
    
    ---
     index.html | 3 ++-
     1 file changed, 2 insertions(+), 1 deletion(-)
    
    diff --git a/index.html b/index.html
    index f4894e2..c791284 100644
    --- a/index.html
    +++ b/index.html
    @@ -735,7 +735,8 @@ 

    DeviceProperties interface

    uniqueId
    -

    A unique identifier for the pointing device. If the hardware supports multiple pointers, pointer events generated from pointing devices must only get a uniqueId if those pointers are uniquely identifiable over the session. If the pointer is uniquely identifiable, the assigned uniqueId to that pointing device will remain constant for the remainder of the session. uniqueId value of 1 MUST be reserved for events generated by the primary mouse device. The uniqueId value of -1 MUST be reserved and used to indicate events whose generating device could not be identified. Like pointerId, to minimize the chance of fingerprinting and tracking across different pages or domains, the uniqueId MUST only be associated explicitly with that particular pointing device for the lifetime of the page / session, and a new randomized uniqueId MUST be chosen the next time that particular pointing device is used again in a new session.

    +

    A unique identifier for the pointing device. If the hardware supports multiple pointers, pointer events generated from pointing devices must only get a uniqueId if those pointers are uniquely identifiable over the session. If the pointer is uniquely identifiable, the assigned uniqueId to that pointing device will remain constant for the remainder of the session. The uniqueId value of -1 MUST be reserved and used to indicate events whose generating device could not be identified. Like pointerId, to minimize the chance of fingerprinting and tracking across different pages or domains, the uniqueId MUST only be associated explicitly with that particular pointing device for the lifetime of the page / session, and a new randomized uniqueId MUST be chosen the next time that particular pointing device is used again in a new session.

    +
    Due to digitizer and pointing device hardware constraints, a uniqueId is not guaranteed to be available for all pointer events from a pointing device. For example, the device may not report its hardware id to the digitizer in time for pointerdown to have a uniqueId. In such a case, the uniqueId may initially be -1 and change to a valid value.

    From 60bf3dc1e5f249437a7427b55f1af1a07248fb90 Mon Sep 17 00:00:00 2001 From: Sahir Vellani Date: Thu, 18 Apr 2024 10:24:27 -0700 Subject: [PATCH 12/15] Change caps on must --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index fdf1ab0..fdaa88c 100644 --- a/index.html +++ b/index.html @@ -735,7 +735,7 @@

    DeviceProperties interface

    uniqueId
    -

    A unique identifier for the pointing device. If the hardware supports multiple pointers, pointer events generated from pointing devices must only get a uniqueId if those pointers are uniquely identifiable over the session. If the pointer is uniquely identifiable, the assigned uniqueId to that pointing device will remain constant for the remainder of the session. The uniqueId value of -1 MUST be reserved and used to indicate events whose generating device could not be identified. Like pointerId, to minimize the chance of fingerprinting and tracking across different pages or domains, the uniqueId MUST only be associated explicitly with that particular pointing device for the lifetime of the page / session, and a new randomized uniqueId MUST be chosen the next time that particular pointing device is used again in a new session.

    +

    A unique identifier for the pointing device. If the hardware supports multiple pointers, pointer events generated from pointing devices MUST only get a uniqueId if those pointers are uniquely identifiable over the session. If the pointer is uniquely identifiable, the assigned uniqueId to that pointing device will remain constant for the remainder of the session. The uniqueId value of -1 MUST be reserved and used to indicate events whose generating device could not be identified. Like pointerId, to minimize the chance of fingerprinting and tracking across different pages or domains, the uniqueId MUST only be associated explicitly with that particular pointing device for the lifetime of the page / session, and a new randomized uniqueId MUST be chosen the next time that particular pointing device is used again in a new session.

    Due to digitizer and pointing device hardware constraints, a uniqueId is not guaranteed to be available for all pointer events from a pointing device. For example, the device may not report its hardware id to the digitizer in time for pointerdown to have a uniqueId. In such a case, the uniqueId may initially be -1 and change to a valid value.
    From 0282bae257357e6e9a003c8ebc27029a536f51ec Mon Sep 17 00:00:00 2001 From: Sahir Vellani Date: Thu, 18 Apr 2024 10:27:20 -0700 Subject: [PATCH 13/15] Change invalid id from -1 to 0 --- index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index fdaa88c..1db9bf0 100644 --- a/index.html +++ b/index.html @@ -203,7 +203,7 @@

    Examples

    function assignPenColor(event) { const uniqueId = event.deviceProperties.uniqueId; // Check if a unique Id exists. - if (uniqueId == -1) { + if (uniqueId == 0) { return; } // Check if a color has been assigned to the device. @@ -723,7 +723,7 @@

    Converting between tiltX / tiltY and altitud

    DeviceProperties interface

                     dictionary DevicePropertiesInit {
    -                    long uniqueId = -1;
    +                    long uniqueId = 0;
                     };
     
                     [Exposed=Window]
    @@ -735,8 +735,8 @@ 

    DeviceProperties interface

    uniqueId
    -

    A unique identifier for the pointing device. If the hardware supports multiple pointers, pointer events generated from pointing devices MUST only get a uniqueId if those pointers are uniquely identifiable over the session. If the pointer is uniquely identifiable, the assigned uniqueId to that pointing device will remain constant for the remainder of the session. The uniqueId value of -1 MUST be reserved and used to indicate events whose generating device could not be identified. Like pointerId, to minimize the chance of fingerprinting and tracking across different pages or domains, the uniqueId MUST only be associated explicitly with that particular pointing device for the lifetime of the page / session, and a new randomized uniqueId MUST be chosen the next time that particular pointing device is used again in a new session.

    -
    Due to digitizer and pointing device hardware constraints, a uniqueId is not guaranteed to be available for all pointer events from a pointing device. For example, the device may not report its hardware id to the digitizer in time for pointerdown to have a uniqueId. In such a case, the uniqueId may initially be -1 and change to a valid value.
    +

    A unique identifier for the pointing device. If the hardware supports multiple pointers, pointer events generated from pointing devices MUST only get a uniqueId if those pointers are uniquely identifiable over the session. If the pointer is uniquely identifiable, the assigned uniqueId to that pointing device will remain constant for the remainder of the session. The uniqueId value of 0 MUST be reserved and used to indicate events whose generating device could not be identified. Like pointerId, to minimize the chance of fingerprinting and tracking across different pages or domains, the uniqueId MUST only be associated explicitly with that particular pointing device for the lifetime of the page / session, and a new randomized uniqueId MUST be chosen the next time that particular pointing device is used again in a new session.

    +
    Due to digitizer and pointing device hardware constraints, a uniqueId is not guaranteed to be available for all pointer events from a pointing device. For example, the device may not report its hardware id to the digitizer in time for pointerdown to have a uniqueId. In such a case, the uniqueId may initially be 0 and change to a valid value.
    From b485c11c433600c73a20c57cc2080d1059c1dcce Mon Sep 17 00:00:00 2001 From: Sahir Vellani Date: Wed, 8 May 2024 11:44:52 -0700 Subject: [PATCH 14/15] deviceProperties null in init --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 1db9bf0..9195e98 100644 --- a/index.html +++ b/index.html @@ -244,7 +244,7 @@

    PointerEvent interface

    boolean isPrimary = false; sequence<PointerEvent> coalescedEvents = []; sequence<PointerEvent> predictedEvents = []; - DeviceProperties deviceProperties; + DeviceProperties? deviceProperties = null; }; [Exposed=Window] @@ -262,7 +262,7 @@

    PointerEvent interface

    readonly attribute double azimuthAngle; readonly attribute DOMString pointerType; readonly attribute boolean isPrimary; - readonly attribute DeviceProperties deviceProperties; + readonly attribute DeviceProperties? deviceProperties; [SecureContext] sequence<PointerEvent> getCoalescedEvents(); sequence<PointerEvent> getPredictedEvents(); }; From 8853ccfcb0ffa10120f2e66a6d0c05873285a841 Mon Sep 17 00:00:00 2001 From: Sahir Vellani Date: Mon, 10 Jun 2024 09:58:15 -0700 Subject: [PATCH 15/15] Switch to persistentDeviceId --- index.html | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/index.html b/index.html index 491dce7..4b084a2 100644 --- a/index.html +++ b/index.html @@ -201,7 +201,7 @@

    Examples

    const colorMap = new Map(); function assignPenColor(event) { - const uniqueId = event.deviceProperties.uniqueId; + const uniqueId = event.persistentDeviceId; // Check if a unique Id exists. if (uniqueId == 0) { return; @@ -242,7 +242,7 @@

    PointerEvent interface

    double azimuthAngle; DOMString pointerType = ""; boolean isPrimary = false; - DeviceProperties? deviceProperties = null; + long persistentDeviceId = 0; sequence<PointerEvent> coalescedEvents = []; sequence<PointerEvent> predictedEvents = []; }; @@ -262,7 +262,7 @@

    PointerEvent interface

    readonly attribute double azimuthAngle; readonly attribute DOMString pointerType; readonly attribute boolean isPrimary; - readonly attribute DeviceProperties? deviceProperties; + readonly attribute long persistentDeviceId; [SecureContext] sequence<PointerEvent> getCoalescedEvents(); sequence<PointerEvent> getPredictedEvents(); }; @@ -355,9 +355,10 @@

    PointerEvent interface

    Indicates if the pointer represents the primary pointer of this pointer type.

    -
    deviceProperties
    +
    persistentDeviceId
    -

    A set of properties that represent event generating device-specific information such as unique id.

    +

    A unique identifier for the pointing device. If the hardware supports multiple pointers, pointer events generated from pointing devices MUST only get a persistentDeviceId if those pointers are uniquely identifiable over the session. If the pointer is uniquely identifiable, the assigned persistentDeviceId to that pointing device will remain constant for the remainder of the session. The persistentDeviceId value of 0 MUST be reserved and used to indicate events whose generating device could not be identified. Like pointerId, to minimize the chance of fingerprinting and tracking across different pages or domains, the persistentDeviceId MUST only be associated explicitly with that particular pointing device for the lifetime of the page / session, and a new randomized persistentDeviceId MUST be chosen the next time that particular pointing device is used again in a new session.

    +
    Due to digitizer and pointing device hardware constraints, a persistentDeviceId is not guaranteed to be available for all pointer events from a pointing device. For example, the device may not report its hardware id to the digitizer in time for pointerdown to have a persistentDeviceId. In such a case, the persistentDeviceId may initially be 0 and change to a valid value.
    getCoalescedEvents()
    @@ -717,28 +718,6 @@

    Converting between tiltX / tiltY and altitud

    -
    -

    DeviceProperties interface

    -
    -                dictionary DevicePropertiesInit {
    -                    long uniqueId = 0;
    -                };
    -
    -                [Exposed=Window]
    -                interface DeviceProperties {
    -                    constructor(optional DevicePropertiesInit devicePropertiesInitDict = {});
    -                    readonly attribute long uniqueId;
    -                };
    -            
    -
    -
    uniqueId
    -
    -

    A unique identifier for the pointing device. If the hardware supports multiple pointers, pointer events generated from pointing devices MUST only get a uniqueId if those pointers are uniquely identifiable over the session. If the pointer is uniquely identifiable, the assigned uniqueId to that pointing device will remain constant for the remainder of the session. The uniqueId value of 0 MUST be reserved and used to indicate events whose generating device could not be identified. Like pointerId, to minimize the chance of fingerprinting and tracking across different pages or domains, the uniqueId MUST only be associated explicitly with that particular pointing device for the lifetime of the page / session, and a new randomized uniqueId MUST be chosen the next time that particular pointing device is used again in a new session.

    -
    Due to digitizer and pointing device hardware constraints, a uniqueId is not guaranteed to be available for all pointer events from a pointing device. For example, the device may not report its hardware id to the digitizer in time for pointerdown to have a uniqueId. In such a case, the uniqueId may initially be 0 and change to a valid value.
    -
    -
    -
    -

    Pointer Event types

    Below are the event types defined in this specification.