Skip to content
Snippets Groups Projects
Commit a420b985 authored by Kevin Lee's avatar Kevin Lee
Browse files

cleanup _isInteractable(); _handleWheel properly handles different deltaModes now.

parent 379e6b5c
No related branches found
No related tags found
No related merge requests found
...@@ -104,15 +104,10 @@ AFRAME.registerComponent("super-cursor", { ...@@ -104,15 +104,10 @@ AFRAME.registerComponent("super-cursor", {
}, },
_isInteractable: function(el) { _isInteractable: function(el) {
if (el.className === "interactable") { return (
return true; el.className === "interactable" ||
} (el.parentNode && el.parentNode != el.sceneEl && this._isInteractable(el.parentNode))
);
if (el.parentNode && el.parentNode != el.sceneEl) {
return this._isInteractable(el.parentNode);
}
return false;
}, },
_handleMouseDown: function() { _handleMouseDown: function() {
...@@ -134,7 +129,19 @@ AFRAME.registerComponent("super-cursor", { ...@@ -134,7 +129,19 @@ AFRAME.registerComponent("super-cursor", {
}, },
_handleWheel: function(e) { _handleWheel: function(e) {
if (this.isGrabbing) this.currentDistanceMod += e.deltaY / 10; if (this.isGrabbing) {
switch (e.deltaMode) {
case e.DOM_DELTA_PIXEL:
this.currentDistanceMod += e.deltaY / 500;
break;
case e.DOM_DELTA_LINE:
this.currentDistanceMod += e.deltaY / 10;
break;
case e.DOM_DELTA_PAGE:
this.currentDistanceMod += e.deltaY / 2;
break;
}
}
}, },
_handleEnterVR: function() { _handleEnterVR: function() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment