[pointerevents] Imperative API to prevent panning and zooming

RByers has just created a new issue for https://github.com/w3c/pointerevents:

== Imperative API to prevent panning and zooming ==
The only way to suppress panning and zooming with Pointer Events (or passive Touch Events) is via the declarative `touch-action` API.  This works great in most cases, but occasionally there are special cases (like #178) which can't be solved with touch-action.  We certainly don't want to re-introduce all the performance problems of `TouchEvent.preventDefault`, but chatting with @mdittmer this morning we realized that there are scenarios (#178 in particular) where you can get the best of both worlds by having an asychronous API.  Eg:

```webidl
interface PointerEvent {
  Promise<bool> tryDisableTouchActions();
}
```

`tryDisableTouchActions` would resolve to `true` if panning and zooming have been suppressed for the duration of the associated pointer, and `false` otherwise (pointer not active or panning/zooming already started).  Alternately we could consider failure [an error](https://www.w3.org/2001/tag/doc/promises-guide#rejections-should-be-exceptional) and reject instead of resolve to `false`.

This wouldn't be a replacement for `touch-action`.  For example, there would be no non-racy way to use it for a carousel scenarios - those still must use `touch-action: pan-y`.  But for anything involving a timer, this solution should be no more racy than the alternative.

Please view or discuss this issue at https://github.com/w3c/pointerevents/issues/216 using your GitHub account

Received on Friday, 8 September 2017 13:59:29 UTC