Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding multitouch extension #142

Merged
merged 9 commits into from
Jan 11, 2021
Merged
70 changes: 69 additions & 1 deletion extensions.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,17 @@ <h2>Introduction</h2>

</section>

<section id='conformance'></section>
<section id='conformance'>

<h2>Security and privacy considerations</h2>

<p>User agents MUST implement the <a>GamepadTouch</a> to only be
available in <a data-cite= "secure-contexts#secure-context">secure
contexts</a>. This provides better protection for the user against
man-in-the-middle attacks intended to obtain gamepad data. Browsers may
ignore this rule for development purposes only.</p>

</section>
fernando-80 marked this conversation as resolved.
Show resolved Hide resolved

<section>
<h2><dfn>GamepadHand</dfn> Enum</h2>
Expand Down Expand Up @@ -335,6 +345,57 @@ <h2><dfn>GamepadPose</dfn> Interface</h2>
</dl>
</section>

<section>
fernando-80 marked this conversation as resolved.
Show resolved Hide resolved
<h2><dfn>GamepadTouch</dfn> Interface</h2>
<p>
This interface defines a single touch event on a gamepad device that
supports input. The event consists of a touch id that uniquely
identifies the touch point from the time the input medium (e.g. finger,
stylus, etc) makes contact with the touch device, up to the time the
input medium is no longer making contact with the touch device.
</p>

<pre class="idl">
[Exposed=Window, SecureContext]
interface GamepadTouch {
readonly attribute unsigned long touchId;
readonly attribute octet surfaceId;
readonly attribute Float32Array position;
readonly attribute Uint32Array? surfaceDimensions;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just an empty array?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @marcoscaceres we thought about representing the absent surfaceDimensions with "null". Would there be any advantages to use the empty array instead? thanks~

};
</pre>

<dl data-dfn-for="GamepadTouch">
fernando-80 marked this conversation as resolved.
Show resolved Hide resolved
<dt><dfn>touchId</dfn></dt>
fernando-80 marked this conversation as resolved.
Show resolved Hide resolved
<dd>
Unique id of the touch event. Range is [0, 4294967295]. The user agent
is responsible for incrementing the touchId for each subsequent touch
event based on information provided by the device API. touchId SHOULD
fernando-80 marked this conversation as resolved.
Show resolved Hide resolved
be set to a default value of 0 when a new Gamepad object is created.
fernando-80 marked this conversation as resolved.
Show resolved Hide resolved
</dd>

<dt><dfn>surfaceId</dfn></dt>
<dd>
Unique id of the surface that generated the touch event. Range is
[0, 255].
fernando-80 marked this conversation as resolved.
Show resolved Hide resolved
</dd>

<dt><dfn>position</dfn></dt>
<dd>
x, y coordinates of the touch event. Range of each coordinate is
normalized to [-1.0, 1.0]. Along the x-axis, -1.0 references the
leftmost coordinate and 1.0 references the rightmost coordinate. Along
the y-axis, -1.0 references the topmost coordinate and 1.0 references
the bottommost coordinate. MUST be a two-element array.
</dd>

<dt><dfn>surfaceDimensions</dfn></dt>
<dd>
Width and height of the touch surface in integer units. When not
<code>null</code>, MUST be a two-element array.
</dl>
</section>

<section>
<h2>Partial <dfn>Gamepad</dfn> Interface</h2>
<p>
Expand All @@ -347,6 +408,7 @@ <h2>Partial <dfn>Gamepad</dfn> Interface</h2>
readonly attribute GamepadHand hand;
readonly attribute FrozenArray&lt;GamepadHapticActuator> hapticActuators;
readonly attribute GamepadPose? pose;
readonly attribute FrozenArray&lt;GamepadTouch>? touchEvents;
};
</pre>

Expand All @@ -371,6 +433,12 @@ <h2>Partial <dfn>Gamepad</dfn> Interface</h2>
hardware cannot supply any pose values, MUST be set to
<code>null</code>.
</dd>

<dt><dfn>touchEvents</dfn></dt>
<dd>
A list of touch events generated from all touch surfaces. <code>null</code>
if the device does not support touch events.
</dd>
</dl>
</section>
</body>
Expand Down