Chrome on android: touchevent not work on a-entity click

删除回忆录丶 提交于 2021-02-11 14:02:39

问题


The problem of question is: click event via touch click on mobile from VR mode not work from android Chrome 79+. Otherwords touchstart event does not fired on entity from VR mode. Google Vr services are installed and enabled.

The goal a-entity should be clickable in Chrome latest 79+ on user click (VR mode touch click from mobile)

Links to whole code: here 2 config simple app: https://4dkly.csb.app/ (config: fuse 3.6sec; but click on entity does Not work from chrome vr) https://codesandbox.io/s/aframe-example-4dkly?fontsize=14&hidenavigation=1&theme=white

https://12k87.csb.app/ (cursor color red; fuse turned off , cursor still does not work)
https://codesandbox.io/s/aframe-example-12k87?fontsize=14&hidenavigation=1&theme=dark Could you please take a look for any of this example, and tell what to do, to make chrome latest, vr mode touch click. Any new good approach new api is also ok.

Here code excerpt

 <script src="https://aframe.io/releases/1.0.1/aframe.min.js"></script>

    <a-scene main> 
      <a-sphere position="0 2 -5" radius="1.25" color="#EF2D5E"> </a-sphere>
 <!-- ... -->

      <a-camera id="camera" camera rotation>
        <a-entity
          id="cursor"
          cursor="fuse:false"
          position="0 0 -1"
          material="color: #111;"

        >
        </a-entity>
      </a-camera>
//simple event on click 
 document.querySelector("a-box").addEventListener("click", () => {
   alert("box");
});```  


回答1:


The behavior you described is expected. Touch events are disabled by the browser when entering immersive mode via WebXR as it's the case for Chrome 79+ and content served over https. There are new APIs in the works to enable interactivity while presenting in AR. You can find additional details in this blog post: https://aframe.io/blog/webxr-ar-module/

On devices that don't have a native WebXR implementation VR mode relies on the full screen API and touchevents are available.

I don't recommend relying on screen input while in VR and use a fuse based cursor



来源:https://stackoverflow.com/questions/59740484/chrome-on-android-touchevent-not-work-on-a-entity-click

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