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

Re: pointerType extensibility

From: Rick Byers <rbyers@google.com>
Date: Fri, 15 Feb 2013 13:55:22 -0500
Message-ID: <CAFUtAY93SqWVpv8B+KH3VKsMUqQDjkFwCAqGpMbnK000YQtKcw@mail.gmail.com>
To: François REMY <francois.remy.dev@outlook.com>
Cc: Pointer Events WG <public-pointer-events@w3.org>
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 18:55:49 GMT

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