babylon.touchCamera.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. // We're mainly based on the logic defined into the FreeCamera code
  9. var TouchCamera = (function (_super) {
  10. __extends(TouchCamera, _super);
  11. //-- end properties for backward compatibility for inputs
  12. function TouchCamera(name, position, scene) {
  13. _super.call(this, name, position, scene);
  14. this.inputs.addTouch();
  15. this._setupInputs();
  16. }
  17. Object.defineProperty(TouchCamera.prototype, "touchAngularSensibility", {
  18. //-- Begin properties for backward compatibility for inputs
  19. get: function () {
  20. var touch = this.inputs.attached["touch"];
  21. if (touch)
  22. return touch.touchAngularSensibility;
  23. },
  24. set: function (value) {
  25. var touch = this.inputs.attached["touch"];
  26. if (touch)
  27. touch.touchAngularSensibility = value;
  28. },
  29. enumerable: true,
  30. configurable: true
  31. });
  32. Object.defineProperty(TouchCamera.prototype, "touchMoveSensibility", {
  33. get: function () {
  34. var touch = this.inputs.attached["touch"];
  35. if (touch)
  36. return touch.touchMoveSensibility;
  37. },
  38. set: function (value) {
  39. var touch = this.inputs.attached["touch"];
  40. if (touch)
  41. touch.touchMoveSensibility = value;
  42. },
  43. enumerable: true,
  44. configurable: true
  45. });
  46. TouchCamera.prototype.getTypeName = function () {
  47. return "TouchCamera";
  48. };
  49. TouchCamera.prototype._setupInputs = function () {
  50. var mouse = this.inputs.attached["mouse"];
  51. if (mouse) {
  52. mouse.touchEnabled = false;
  53. }
  54. };
  55. return TouchCamera;
  56. })(BABYLON.FreeCamera);
  57. BABYLON.TouchCamera = TouchCamera;
  58. })(BABYLON || (BABYLON = {}));