babylon.freeCameraInputsManager.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. var __extends = (this && this.__extends) || function (d, b) {
  2. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  3. function __() { this.constructor = d; }
  4. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5. };
  6. var BABYLON;
  7. (function (BABYLON) {
  8. var FreeCameraInputsManager = (function (_super) {
  9. __extends(FreeCameraInputsManager, _super);
  10. function FreeCameraInputsManager(camera) {
  11. _super.call(this, camera);
  12. }
  13. FreeCameraInputsManager.prototype.add = function (input) {
  14. _super.prototype.add.call(this, input);
  15. if (this.camera._attachedElement && input.attachElement) {
  16. input.attachElement(this.camera._attachedElement, this.camera._noPreventDefault);
  17. }
  18. };
  19. FreeCameraInputsManager.prototype.addKeyboard = function () {
  20. this.add(new BABYLON.FreeCameraKeyboardMoveInput());
  21. return this;
  22. };
  23. FreeCameraInputsManager.prototype.addMouse = function () {
  24. this.add(new BABYLON.FreeCameraMouseInput());
  25. return this;
  26. };
  27. FreeCameraInputsManager.prototype.addGamepad = function () {
  28. this.add(new BABYLON.FreeCameraGamepadInput());
  29. return this;
  30. };
  31. FreeCameraInputsManager.prototype.addDeviceOrientation = function () {
  32. this.add(new BABYLON.FreeCameraDeviceOrientationInput());
  33. return this;
  34. };
  35. FreeCameraInputsManager.prototype.addVRDeviceOrientation = function () {
  36. this.add(new BABYLON.FreeCameraVRDeviceOrientationInput());
  37. return this;
  38. };
  39. FreeCameraInputsManager.prototype.addTouch = function () {
  40. this.add(new BABYLON.FreeCameraTouchInput());
  41. return this;
  42. };
  43. FreeCameraInputsManager.prototype.addVirtualJoystick = function () {
  44. this.add(new BABYLON.FreeCameraVirtualJoystickInput());
  45. return this;
  46. };
  47. return FreeCameraInputsManager;
  48. }(BABYLON.CameraInputsManager));
  49. BABYLON.FreeCameraInputsManager = FreeCameraInputsManager;
  50. })(BABYLON || (BABYLON = {}));