diff --git a/index.js b/index.js index 1a80cec..b1b6579 100644 --- a/index.js +++ b/index.js @@ -161,11 +161,16 @@ AFRAME.registerComponent('super-hands', { let carried = this.state.get(this.GRAB_EVENT) this.dispatchMouseEventAll('mousedown', this.el) this.gehClicking = new Set(this.hoverEls) + const detail = { + hand: this.el, + buttonEvent: evt + } if (!carried) { - carried = this.findTarget(this.GRAB_EVENT, { - hand: this.el, - buttonEvent: evt - }) + if (evt.detail && evt.detail.targetEntity && !this.emitCancelable(evt.detail.targetEntity, this.GRAB_EVENT, detail)) { + carried = evt.detail.targetEntity + } else { + carried = this.findTarget(this.GRAB_EVENT, detail) + } if (carried) { this.state.set(this.GRAB_EVENT, carried) this._unHover(carried)