w3c / screen-orientation

The screen orientation lock specification
https://w3c.github.io/screen-orientation/
Other
27 stars 29 forks source link

Deprecate angle? #162

Closed marcoscaceres closed 1 year ago

marcoscaceres commented 5 years ago

@Johanna-hub has been doing some testing and we are seeing unreliable result with angle... I wonder if angle is just going to turn into another "device orientation" disaster where different browsers on different devices (or even the same devices) end up reporting different things for the angle? Also, is there any value or use case for the angle? What would people use it for? (they can use gyroscope API or whatever instead, no?)

@mounirlamouri thoughts?

Johanna-hub commented 5 years ago

I have been testing that the primary and secondary orientations and associated angles match with different results on Firefox and Chrome. The web platform test is here https://github.com/web-platform-tests/wpt/pull/15429

I have been testing on my phone. The test checks that portrait-secondary angle is 180, that landscape-primary is either 90 or 270 and landscape-secondary is the angle left over.

When I run the tests in Firefox, sometimes the angles are exactly right, but running the tests multiple times - the angle can get "stuck" and doesn't change.

In Chrome, the results are variable, I have had some where all 3 angles are right but more often 2 out of 3 are right or more random results.

Would be great to hear thoughts. Also this is the new table in the spec where the primary/secondary orientations and angles are explained, in case you have any comments on that https://w3c.github.io/screen-orientation/#reading-the-screen-orientation

mounirlamouri commented 5 years ago

The main use cases of angles is to be used when doing some computation for rendering IIRC.

marcoscaceres commented 5 years ago

@kenchris would appreciate any thoughts you have here... specially in light of the gyro API and from a rendering perspective? I can’t think of anything personally.

Johanna-hub commented 5 years ago

Orientation/angle tests now merged and here https://github.com/web-platform-tests/wpt/blob/4950b69ed6774f1b97c41a5daddf7bfa2327372e/screen-orientation/orientation-reading.html#L25

Now that they have been merged and I can run on my phone, Firefox is consistently passing and Chrome is failing

marcoscaceres commented 5 years ago

CC'ing @anssiko also... as current editor of Gyro spec... might have a good perspective to share here. Core question: maybe we can deprecate angle on this API in light of Gyro spec?

anssiko commented 5 years ago

What are the key use cases for angle? Computation for rendering is a bit vague.

Depending on the use cases, OrientationSensor might be able to help. Nudging my esteemed co-editor @kenchris.

That spec uses the reference frame concept that provides web developers a knob to define whether the local coordinate system for orientation is relative to the device (stationary) or screen (can rotate).

marcoscaceres commented 5 years ago

OrientationSensor sounds event better, specially given the reference frame.

marcoscaceres commented 1 year ago

Closing, at it's been around too long to deprecate. It's still really unreliable by the looks of it.