You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by tisztamo <gi...@git.apache.org> on 2014/10/23 16:38:11 UTC

[GitHub] cordova-plugin-device-orientation pull request: Fixed invalid orie...

GitHub user tisztamo opened a pull request:

    https://github.com/apache/cordova-plugin-device-orientation/pull/16

    Fixed invalid orientation reports on iOS related to landscape mode

    The iOS plugin sets the locationManager.headingOrientation at the first heading request but later it doesn't adapt to (screen) orientation changes while the heading watch is running which causes invalid reports when the first request happens in landscape orientation.
    
    The fix is just removing this setting.
    
    ### Note 1
    The documentation is not clear about the plugin behaviour at screen orientation changes. The only place where it talks about this question is at iOS quirks: 
    
    *"For iOS 4 devices and above, heading factors in the device's current orientation, and does not reference its absolute position, for apps that supports that orientation."*
    
    This feature is not working correctly and being not compatible with other platforms it just creates unneeded hassle for the user. At the time both Android and iOS versions behave the same: nothing happens at orientation change. This is how the native sensor APIs are working too so I think that removing this is the correct fix of the problem.
    
    I have removed this from the documentation too.
    
    ### Note 2
    To correct the reported value based on screen orientation the user can do something like (Do not use the % operator because of this: http://wiki.ecmascript.org/doku.php?id=strawman:modulo_operator ):
    
    var corrected = heading + window.orientation;
    if (corrected < 0) {
       corrected += 360;
    } else if (corrected >= 360) {
       corrected -= 360;
    }
    
    I haven't updated the documentation with this but I suggest to include this info

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/tisztamo/cordova-plugin-device-orientation fixiosorientation

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-device-orientation/pull/16.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #16
    
----
commit 0623d82f8f5e298d98f7967d0b518bc11cc68c7a
Author: ko <sc...@gmail.com>
Date:   2014-10-23T13:52:32Z

    Fixed invalid heading reports on iOS when the first request is initiated in landscape orientation

commit 8adaa2367a22fedd4426e5575d2d5bb29d1f5399
Author: ko <sc...@gmail.com>
Date:   2014-10-23T14:30:20Z

    Removed the ios orientation quirk from the documentation

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-device-orientation pull request: Fixed invalid orie...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-plugin-device-orientation/pull/16


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org