W3C home > Mailing lists > Public > public-pointer-events@w3.org > January to March 2013

RE: pointerType extensibility

From: François REMY <francois.remy.dev@outlook.com>
Date: Fri, 15 Feb 2013 20:51:35 +0000
Message-ID: <DUB404-EAS410753C4CCE0C591C3A2026A50E0@phx.gbl>
To: Rick Byers <rbyers@google.com>
CC: Pointer Events WG <public-pointer-events@w3.org>
This is probably a good idea. 

 

 


De : Rick Byers
Envoyé : ‎15‎ ‎février‎ ‎2013 ‎19‎:‎55
À : François REMY
Cc : Pointer Events WG
Objet : Re: pointerType extensibility


We agreed on the PE call that this was probably something we could address in V2 (although it might mean pointerType becomes deprecated and inaccurate), and so it shouldn't block going to LCWD.



Since we've already started the discussion (even if we may leave it unfinished until V2), let me try one other proposal that should feel more natural from an OO design perspective.  Instead of have a pointerType field at all, why not just use the type of the event object itself to signal pointer type, and encourage use of 'instanceof' checks.  For the most part people would program to the PointerEvent interface, but they could do, eg. 'instanceof TouchPointerEvent', and in the future browsers (and libraries?) could add, eg. DepthCamPointerEvent and have it derive from TouchPointerEvent.




I know this pure OO approach isn't normally how we design web APIs, but this is a traditional OO extensibility problem we're trying to solve.




Rick


On Tuesday, February 12, 2013, François REMY wrote:

> if (e.isPointerType('depth-cam')) {
> ... light up additional 3-d features
> } else if (e.isPointerType('touch') {
> ... definitely a non-depth-cam touch device
> }
>
> Since we probably only care about JavaScript, it's simpler and I think
> just as powerful to define a set of boolean read-only properties on the
> event, eg. PointerEvent.isMouse, PointerEvent.isTouch, etc.

I agree, a set of boolean properties would be nice. It allows for pointer types that inherit from older ones.
Received on Friday, 15 February 2013 20:52:06 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:17:04 GMT