onHeadingChange(event) getting single value for geometrically opposite positions

旧街凉风 提交于 2020-08-09 07:10:23

问题


I am working on android device orientation and getting same values of event.alpha (270) in following positions as shared in image. i am using following code:

// called on device orientation change
  function onHeadingChange(event) {
    var heading = event.alpha;
    if (typeof event.webkitCompassHeading !== "undefined") {
      heading = event.webkitCompassHeading; //iOS non-standard
    }

    if (typeof heading !== "undefined" && heading !== null) {
    alert("heading:"+ heading);
    }
  }

来源:https://stackoverflow.com/questions/62453531/onheadingchangeevent-getting-single-value-for-geometrically-opposite-positions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!