Skip to content

Commit

Permalink
Cursor .onIntersection timout, a-cursor cursor.fuseTimeout (#1616)
Browse files Browse the repository at this point in the history
* Changed a-cursor mappings to cursor.fuseTimeout

Added default value for raycaster.far

* Fixed cursor.onIntersection timout delay

* Changed a-cursor dom attr timeout to fuse-timeout

* Updated fuseTimeout in cursor tests
  • Loading branch information
mkungla authored and ngokevin committed Jul 7, 2016
1 parent 398294f commit 861c369
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ module.exports.Component = registerComponent('cursor', {
this.fuseTimeout = setTimeout(function fuse () {
cursorEl.removeState(STATES.FUSING);
self.twoWayEmit(EVENTS.CLICK);
}, data.timeout);
}, data.fuseTimeout);
},

/**
Expand Down
6 changes: 4 additions & 2 deletions src/extras/primitives/primitives/a-cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ registerPrimitive('a-cursor', utils.extendDeep({}, getMeshMixin(), {
y: 0,
z: -1
},
raycaster: {}
raycaster: {
far: 1000
}
},

mappings: {
far: 'raycaster.far',
fuse: 'cursor.fuse',
interval: 'raycaster.interval',
objects: 'raycaster.objects',
timeout: 'cursor.timeout'
'fuse-timeout': 'cursor.fuseTimeout'
}
}));
4 changes: 2 additions & 2 deletions tests/components/cursor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ suite('cursor', function () {
test('removes fuse state and emits event on fuse click', function (done) {
var cursorEl = this.cursorEl;
var intersectedEl = this.intersectedEl;
cursorEl.setAttribute('cursor', {fuse: true, timeout: 1});
cursorEl.setAttribute('cursor', {fuse: true, fuseTimeout: 1});
cursorEl.emit('raycaster-intersection', {els: [intersectedEl]});
cursorEl.addEventListener('click', function () {
assert.notOk(cursorEl.is('cursor-fusing'));
Expand All @@ -173,7 +173,7 @@ suite('cursor', function () {
test('emits event on intersectedEl on fuse click', function (done) {
var cursorEl = this.cursorEl;
var intersectedEl = this.intersectedEl;
cursorEl.setAttribute('cursor', {fuse: true, timeout: 1});
cursorEl.setAttribute('cursor', {fuse: true, fuseTimeout: 1});
cursorEl.emit('raycaster-intersection', {els: [intersectedEl]});
intersectedEl.addEventListener('click', function () {
done();
Expand Down

0 comments on commit 861c369

Please sign in to comment.