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
57 changes: 57 additions & 0 deletions extensions.html
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,56 @@ <h2><dfn>GamepadPose</dfn> Interface</h2>
</dl>
</section>

<section data-dfn-for="GamepadTouch">
<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>
<dt><dfn>touchId</dfn> attribute</dt>
<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. {{GamepadTouch/touchId}} SHOULD
be set to a default value of 0 when a new {{Gamepad}} object is created.
</dd>

<dt><dfn>surfaceId</dfn></dt>
<dd>
Unique id of the surface that generated the touch event.
</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 +397,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 +422,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