xrcostume.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. this.onMove = function (idata) {
  2. if (this.mousedown_state || this.triggerdown_state) {
  3. let controller = this.parent.parent;
  4. if (controller && controller.dragID) {
  5. let point = idata && idata.point ? AFRAME.utils.coordinates.parse(idata.point) : null;
  6. //console.log("Point: ", point)
  7. vwf.callMethod(controller.dragID, "moveAction", [controller.id, point])
  8. }
  9. // else if (idata) {
  10. // //console.log('Move POINT: ', idata.point, + ' on ' + idata.elID);
  11. // let point = AFRAME.utils.coordinates.parse(idata.point);
  12. // vwf.callMethod(idata.elID, "moveAction", [controller.id, point])
  13. // }
  14. }
  15. }
  16. this.triggerupAction = function (point, elID, controllerID) {
  17. //do on trigger up
  18. this.cursorVisual.color = this.cursorVisual.avatarColor;
  19. if (elID) {
  20. //let node = this.findNodeByID(elID);
  21. let pointData = AFRAME.utils.coordinates.parse(point);
  22. vwf.callMethod(elID, "triggerupAction", [pointData, controllerID])
  23. }
  24. this.triggerdown_state = false;
  25. }
  26. this.triggerdownAction = function (point, elID, controllerID) {
  27. //do on trigger down
  28. this.triggerdown_state = true;
  29. this.cursorVisual.color = "red";
  30. if (elID) {
  31. //let node = this.findNodeByID(elID);
  32. let pointData = AFRAME.utils.coordinates.parse(point);
  33. vwf.callMethod(elID, "triggerdownAction", [pointData, controllerID])
  34. }
  35. }
  36. this.mouseupAction = function (point, elID, controllerID) {
  37. if (elID) {
  38. //let node = this.findNodeByID(elID);
  39. let pointData = AFRAME.utils.coordinates.parse(point);
  40. vwf.callMethod(elID, "mouseupAction", [pointData, controllerID])
  41. }
  42. this.mousedown_state = false;
  43. }
  44. this.mousedownAction = function (point, elID, controllerID) {
  45. this.mousedown_state = true;
  46. if (elID) {
  47. //let node = this.findNodeByID(elID);
  48. let pointData = AFRAME.utils.coordinates.parse(point);
  49. vwf.callMethod(elID, "mousedownAction", [pointData, controllerID])
  50. }
  51. }