how separate the mouse click event and the courser click event in Aframe

喜你入骨 提交于 2019-12-06 22:07:55

Discriminate by the cursor element:

AFRAME.registerComponent('on-click', {
    init: function () {
      var self = this;
      this.el.addEventListener('click', function (evt) {
        if (self.el.sceneEl === evt.detail.cursorEl) {
          console.log("MOUSE");
        } else {
          console.log("CURSOR");
        }
      });
    }
  });

Example: https://glitch.com/edit/#!/winter-sagittarius

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