【发布时间】:2017-07-02 13:50:43
【问题描述】:
我用 a-frame 构建了一个简单的应用程序,我发现如果我在任何 mouseup 事件之后在 android 设备中运行该应用程序,我的光标就会移动到我点击的位置。这有点烦人,因为我使用 vrbox 控制器中的 mouseup 事件,该控制器的指针与我的应用程序光标位于不同的位置。我只想使用 mouseup 事件来运行与我的光标指向的对象相关的事件(然后不是由控制器箭头指向)。
可能的解决方案是在任何 mouseup 事件之后阻止光标位置。有办法做到这一点吗?在此先感谢我的代码是这样的
home.html
<a-scene>
<a-entity id='cameraWrapper' position="0 -3 0" rotation="0 45 0">
<a-camera>
<a-entity cursor="fuse: true; fuseTimeout: 100;"
position="0 0 -1"
geometry="primitive: ring; radiusInner: 0.005; radiusOuter: 0.01"
material="color: black; shader: flat">
</a-entity>
</a-camera>
</a-entity>
<a-sky id="image-360" radius="20" src="./img/startroomHD.jpg"></a-sky>
<a-box event-listener position="-8 0 -8" rotation="0 45 0" depth="1" height="10" width="20"></a-box>
</a-scene>
controller.js
angular.module('app.controller', ['app.service', 'firebase', 'ngCordova'])
.controller('HomeCtrl', function($scope){
AFRAME.registerComponent('event-listener', {
init: function () {
this.el.addEventListener('mouseup', function(evt){
console.log("ciao");
});
}
});
});
【问题讨论】:
标签: javascript angularjs virtual-reality aframe