W3C home > Mailing lists > Public > public-geolocation@w3.org > September 2014

Re: Proposal to add unit quaternion representation to the Device Orientation event.

From: Mounir Lamouri <mounir@lamouri.fr>
Date: Tue, 02 Sep 2014 20:39:15 +1000
Message-Id: <1409654355.877550.162613381.79D5E9BB@webmail.messagingengine.com>
To: public-geolocation@w3.org
On Mon, 1 Sep 2014, at 21:27, Rich Tibbett wrote:
> On Mon, Sep 1, 2014 at 12:29 PM, Mounir Lamouri <mounir@lamouri.fr>
> wrote:
> > On Sun, 31 Aug 2014, at 16:13, Rich Tibbett wrote:
> >> It is just that nobody really does this right now. This is simply too
> >> complex for common use cases such as applying simple CSS-based
> >> transforms to on-screen objects.
> >
> > Screen Orientation API isn't really widely available. Only Webkit
> > browsers exposed a buggy window.orientation (angle), IE and Firefox
> > expose a type (but no angle). The current Chrome Beta exposes a usable
> > screen.orientation.angle.
> >
> >> It's just not feasible to expect *every web developer* to do that *all
> >> the time*. Whenever they don't do that the device orientation
> >> interaction will be broken.
> >
> > What bothers me with this proposal is that it is assuming that
> > developers who wouldn't do a stack overflow search to know how to get
> > the correct matrix/quaternion would definitely think about using
> > .screenAlpha instead of .alpha from the DeviceOrientationEvent object.
> 
> I'm not sure if there is anything inherently wrong with this. If a web
> developer wants to use CSS 2D transforms then this would make it work
> well out-of-the-box without having to do anything complicated in
> JavaScript.

I think that's where we are in disagreement. I do not think that the
role of the Web platform is to do that. The Web platform should be
feature complete so you can do what you want to do. IOW, give the tools
to the developers.

> The fixed device frame quaternion approach would be:
> 1. Obtain the device quaternion via the Device Orientation event.
> 2. Obtain the screen orientation angle via the Screen Orientation event.
> 3. Apply screen orientation to device orientation.
> 4. Convert the screen-adjusted quaternion back to (now
> screen-adjusted) Euler angles.
> 5. Apply the derived screen-adjusted Euler angles directly to your CSS
> transform(s).

There are many many things that a developer will do and will take time
and effort and that we could simplify. Libraries are here for that IMO.

-- Mounir
Received on Tuesday, 2 September 2014 10:39:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:51:09 UTC