Aframe:光标单击事件未在桌面上触发

Aframe: Cursor click event not triggering on desktop

点击事件不会在设置了光标侦听器的实体上触发。这是我的源代码。

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Panorama</title>
    <meta name="description" content="Panorama — A-Frame">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/aframe/0.4.0/aframe.min.js"></script>
    <script type="javascript" >

    AFRAME.registerComponent('cursor-listener', {
      init: function () {
        var COLORS = ['red', 'green', 'blue'];
        this.el.addEventListener('click', function (evt) {
          var randomIndex = Math.floor(Math.random() * COLORS.length);
          this.setAttribute('material', 'color', COLORS[randomIndex]);
          console.log('I was clicked at: ', evt.detail.intersection.point);
        });
      }
    });

    </script>
</head>
<body>
<a-scene>
    <a-sky src="image.jpg" rotation="0 0 0"></a-sky>
    <a-camera fov=60 >
        <a-entity cursor="fuse: false; fuseTimeout: 500;"
                  position="0 0 -1"
                  geometry="primitive: ring; radiusOuter: 0.05; radiusInner: 0.02"
                  material="color: white; shader: flat" >
        </a-entity>
    </a-camera>
    <a-box color="#aa77dd" cursor-listener width="50" height="10" depth="20" position="-7.45 40.00 -141.77" id="Play">
    </a-box>
</a-scene>
</body>
</html>

我尝试在 phone 和桌面浏览器上执行此操作,但均无效。

光标组件在桌面上工作,鼠标拖动相机查看实体。在手机上,它使用保险丝或纸板按钮。在 VR 上,它也是 gaze-based。

仅单击鼠标或点击 phone 无效。看看https://github.com/mayognaise/aframe-mouse-cursor-component