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

Fold touchEvents from extensions.html into index.html #198

Open
wants to merge 8 commits into
base: gh-pages
Choose a base branch
from

Conversation

bradleyneedham
Copy link
Contributor

@bradleyneedham bradleyneedham commented Apr 9, 2024

@bradleyneedham
Copy link
Contributor Author

bradleyneedham commented Apr 9, 2024

I believe the failure of the tidy action is an indentation error on line 19 of .github/workflows/tidy.yml. The with needs to be even with the start of uses.
Current is:

line 18:             - uses:
line 19:             with:

Should be:

line 18:             - uses:
line 19:               with:

@bradleyneedham bradleyneedham force-pushed the issue-165-fold-touchEvents-into-main-spec branch from b756fd4 to 8ec7959 Compare April 12, 2024 00:18
@bradleyneedham bradleyneedham force-pushed the issue-165-fold-touchEvents-into-main-spec branch from 8ec7959 to a4649ca Compare April 12, 2024 00:42
@bradleyneedham
Copy link
Contributor Author

I am moving this from "Draft". Any help with spotting the reason for the validate failure is appreciated.

Also I think that newline: LF should be added to the tidyconfig.txt to prevent local runs of tidy on windows from adding all CRLF.

@bradleyneedham bradleyneedham marked this pull request as ready for review April 12, 2024 00:58
@marcoscaceres
Copy link
Member

@bradleyneedham, sorry, I just need to double check if this is in scope of the Working Group. I seem to recall there was some concerns from some members around anything "touch" related, so just need to make sure it's all fine.

Shouldn't be too long!

index.html Outdated
@@ -2238,6 +2451,24 @@ <h2>
</p>
</div>
</section>
<section>
<h3>
Glossary
Copy link
Member

Choose a reason for hiding this comment

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

This should really be part of a Model section... or wherever the general idea of gamepad is defined.

index.html Outdated
Glossary
</h3>
<p>
<dfn>touch surface</dfn> is a surface that can detect contact from a
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<dfn>touch surface</dfn> is a surface that can detect contact from a
<dfn data-dfn-for="gamepad">touch surface</dfn> is a surface that can detect contact from a

index.html Outdated
users fingers and report where on the surface the contact is made.
</p>
<p>
<dfn>touch surface enumeration order</dfn> is an ordered listing of all
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<dfn>touch surface enumeration order</dfn> is an ordered listing of all
<dfn data-dfn-for="gamepad">touch surface enumeration order</dfn> is an ordered listing of all

index.html Outdated
the surfaces in a |gamepad|.
</p>
<p>
<dfn>active touch point</dfn> is defined in the <a href=
Copy link
Member

Choose a reason for hiding this comment

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

Is there a concept we can maybe use from Pointer Events instead?

`null`
</td>
<td>
List of generated touch events.
Copy link
Member

Choose a reason for hiding this comment

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

Ok, so... are these really touch "events"? If we look at GamepadTouch, it's not an "Event" at all, so this is a misnomer.

They are more like snapshots of touch points.

index.html Outdated
@@ -460,6 +472,26 @@ <h2>
</li>
</ol>
</dd>
<dt>
<dfn>touchEvents</dfn>
Copy link
Member

@marcoscaceres marcoscaceres May 10, 2024

Choose a reason for hiding this comment

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

As above... I think it's incorrect to call these "touch events". They are activation points on the track pad at some specific moment in time.

<ol class="algorithm">
<li>Let |surfaceId:unsigned long| be 0.
</li>
<li>Remove any existing events from
Copy link
Member

Choose a reason for hiding this comment

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

This seems to assume the gamepad is a live object? I don't think this correct. Each gamepad object is just a snapshot in time.

</p>
<pre class="idl">
[Exposed=Window, SecureContext]
interface GamepadTouch {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
interface GamepadTouch {
dictionary GamepadTouch {

<pre class="idl">
[Exposed=Window, SecureContext]
interface GamepadTouch {
readonly attribute unsigned long touchId;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
readonly attribute unsigned long touchId;
unsigned long touchId;

[Exposed=Window, SecureContext]
interface GamepadTouch {
readonly attribute unsigned long touchId;
readonly attribute octet surfaceId;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
readonly attribute octet surfaceId;
octet surfaceId;

index.html Outdated
Comment on lines 1188 to 1189
readonly attribute Float32Array position;
readonly attribute Uint32Array? surfaceDimensions;
Copy link
Member

@marcoscaceres marcoscaceres Jun 13, 2024

Choose a reason for hiding this comment

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

Suggested change
readonly attribute Float32Array position;
readonly attribute Uint32Array? surfaceDimensions;
Float32Array position;
Uint32Array surfaceDimensions;

index.html Outdated
@@ -153,6 +153,7 @@ <h2>
readonly attribute GamepadMappingType mapping;
readonly attribute FrozenArray&lt;double&gt; axes;
readonly attribute FrozenArray&lt;GamepadButton&gt; buttons;
readonly attribute FrozenArray&lt;GamepadTouch&gt;? touchEvents;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
readonly attribute FrozenArray&lt;GamepadTouch&gt;? touchEvents;
readonly attribute FrozenArray&lt;GamepadTouch&gt;? touches;

@bradleyneedham
Copy link
Contributor Author

Just getting to back to this and wanted to verify our discussion at the last meeting.
In general is the following the suggested approach?

        dictionary GamepadTouch {
          unsigned long touchId;
          Float32Array position;
        };

        dictionary GamepadSurface {
          octet surfaceId;
          FrozenArray&lt;GamepadTouch&gt;? touches;
          Uint32Array surfaceDimensions;
        };

        interface Gamepad {
...
          readonly attribute FrozenArray&lt;GamepadSurface&gt;? surfaces;
...
        };

@nondebug
Copy link
Collaborator

If I remember correctly, we decided on maplike interfaces for the surfaceId -> GamepadSurface and touchId -> sequence<GamepadTouch> maps. I think it should look something like this:

        dictionary GamepadTouch {
          Float32Array position;
        };

        interface GamepadTouchMap {
          readonly maplike<unsigned long, sequence<GamepadTouch>>;
        };

        dictionary GamepadSurface {
          GamepadTouchMap touches;
          Uint32Array surfaceDimensions;
        };

        interface GamepadSurfaceMap {
          readonly maplike<octet, GamepadSurface>;
        };

        interface Gamepad {
...
          readonly attribute GamepadSurfaceMap surfaces;
...
        };

`null`
</td>
<td>
List of generated touch events.
Copy link
Member

@marcoscaceres marcoscaceres Jul 11, 2024

Choose a reason for hiding this comment

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

Suggested change
List of generated touch events.
A [=list=] of touch that are represented as {{GamepadTouch}}s. The ordering is hardware or platform specific.

@bradleyneedham bradleyneedham force-pushed the issue-165-fold-touchEvents-into-main-spec branch from 926ef0f to 0d65b74 Compare September 23, 2024 17:05
@bradleyneedham bradleyneedham force-pushed the issue-165-fold-touchEvents-into-main-spec branch from c3160a0 to 436b0c1 Compare November 14, 2024 19:48
A list of all the {{GamepadHapticActuator}}s in the gamepad. The same object
MUST be returned until the user agent needs to return different
values (or values in a different order).
A list of all the {{GamepadHapticActuator}}s in the gamepad. The same
Copy link
Member

Choose a reason for hiding this comment

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

Note: this is an optimization... as you say, this can't be assured.

The {{Gamepad/touches}} getter steps are:
</p>
<ol>
<li>If [=this=].{{Gamepad/[[touches]]}} not `null` and not empty,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<li>If [=this=].{{Gamepad/[[touches]]}} not `null` and not empty,
<li>If [=this=].{{Gamepad/[[touches]]}} is not `null` and not empty,

</dt>
<dd>
<p>
A list of {{GamepadTouch}} events generated from all touch
Copy link
Member

@marcoscaceres marcoscaceres Nov 15, 2024

Choose a reason for hiding this comment

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

Suggested change
A list of {{GamepadTouch}} events generated from all touch
A [=list=] of {{GamepadTouch}} generated from all touch

Comment on lines +481 to +482
surfaces. If the device does not support touch events, MUST be set
to `null`.
Copy link
Member

Choose a reason for hiding this comment

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

Let's make it empty.

Comment on lines +488 to +489
<li>If [=this=].{{Gamepad/[[touches]]}} not `null` and not empty,
return [=this=].{{Gamepad/[[touches]]}}.
Copy link
Member

Choose a reason for hiding this comment

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

Change this to return whatever is in the internal slot.

@@ -644,6 +678,102 @@ <h3>
</ol>
</li>
</ol>
<p>
To <dfn>update touches</dfn> for |gamepad:Gamepad|, run the following
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
To <dfn>update touches</dfn> for |gamepad:Gamepad|, run the following
To <dfn>refresh touches</dfn> for |gamepad:Gamepad|, run the following

Comment on lines +688 to +689
<li>Remove any existing events from
{{Gamepad}}.{{Gamepad/[[touches]]}}.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<li>Remove any existing events from
{{Gamepad}}.{{Gamepad/[[touches]]}}.
<li>[=List/empty=] {{Gamepad}}.{{Gamepad/[[touches]]}}.

Comment on lines +699 to +704
<li>Set |touchEvent|.{{GamepadTouch/surfaceDimensions}}[0] to
the maximum X dimension on the touch surface in device units.
</li>
<li>Set |touchEvent|.{{GamepadTouch/surfaceDimensions}}[1] to
the maximum Y dimension on the touch surface in device units.
</li>
Copy link
Member

Choose a reason for hiding this comment

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

Use DOMRect/point terminology.

<li>Repeat the following steps for each active touch point
reported by the |gamepad| for the current touch surface.
<ol>
<li>Let |nextTouchId:unsigned long| be the next available
Copy link
Member

Choose a reason for hiding this comment

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

You might want to increment the id on each loop.

<li>If the touch surface exposes maximum surface dimensions in
device units:
<ol>
<li>Set |touchEvent|.{{GamepadTouch/surfaceDimensions}}[0] to
Copy link
Member

@marcoscaceres marcoscaceres Nov 15, 2024

Choose a reason for hiding this comment

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

Note, move away from calling it "*Event". Call it |gameTouch|, and

Suggested change
<li>Set |touchEvent|.{{GamepadTouch/surfaceDimensions}}[0] to
<li>Let |gamepadTouch| be a newly created {{GamepadTouch}.</li>
<li>Set |gamepadTouch|.{{GamepadTouch/surfaceDimensions}}[0] to

</li>
</ol>
</li>
<li>Increment |surfaceId|
Copy link
Member

Choose a reason for hiding this comment

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

oops, increment twice

@@ -676,6 +806,9 @@ <h3>
<li>Initialize |gamepad|.{{Gamepad/[[buttons]]}} to the result of
[=initializing buttons=] for |gamepad|.
</li>
<li>Initialize |gamepad|.{{Gamepad/[[touches]]}} to the result of
[=initializing touches=] for |gamepad|.
Copy link
Member

Choose a reason for hiding this comment

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

Instead, of putting the result at the end, let's just increment as we go but we need to make sure the this is locked thread safe.

<li>Maintaining the uniqueness of the id per origin to prevent
fingerprinting.
</li>
</ul>{{GamepadTouch/touchId}} SHOULD be set to a default value of 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of using 0 here, should we store a touchId counter in an internal slot somewhere? Maybe in the target Gamepad object?

@@ -884,6 +1017,18 @@ <h3>
<li>Return |buttons|.
</li>
</ol>
<p>
To <dfn data-lt="initializing touches">initialize touches</dfn> for a
Copy link
Member

Choose a reason for hiding this comment

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

We problem don't need this initializer anymore, as the initial sequence is empty.

Comment on lines +1184 to +1185
readonly attribute DOMPoint position;
readonly attribute DOMRect? surfaceDimensions;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
readonly attribute DOMPoint position;
readonly attribute DOMRect? surfaceDimensions;
DOMPoint position;
DOMRect? surfaceDimensions;

input medium is no longer making contact with the touch device.
</p>
<pre class="idl" data-cite="geometry-1">
[Exposed=Window, SecureContext]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
[Exposed=Window, SecureContext]

@@ -153,6 +153,7 @@ <h2>
readonly attribute GamepadMappingType mapping;
readonly attribute FrozenArray&lt;double&gt; axes;
readonly attribute FrozenArray&lt;GamepadButton&gt; buttons;
readonly attribute FrozenArray&lt;GamepadTouch&gt;? touches;
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Remove since it won't be nullable?

Suggested change
readonly attribute FrozenArray&lt;GamepadTouch&gt;? touches;
readonly attribute FrozenArray&lt;GamepadTouch&gt; touches;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fold extensions.html into main spec
4 participants