babylon.touchCamera.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /// <reference path="babylon.freeCamera.ts" />
  2. module BABYLON {
  3. // We're mainly based on the logic defined into the FreeCamera code
  4. export class TouchCamera extends FreeCamera {
  5. //-- Begin properties for backward compatibility for inputs
  6. public get touchAngularSensibility() {
  7. var touch = <FreeCameraTouchInput>this.inputs.attached["touch"];
  8. if (touch)
  9. return touch.touchAngularSensibility;
  10. }
  11. public set touchAngularSensibility(value) {
  12. var touch = <FreeCameraTouchInput>this.inputs.attached["touch"];
  13. if (touch)
  14. touch.touchAngularSensibility = value;
  15. }
  16. public get touchMoveSensibility() {
  17. var touch = <FreeCameraTouchInput>this.inputs.attached["touch"];
  18. if (touch)
  19. return touch.touchMoveSensibility;
  20. }
  21. public set touchMoveSensibility(value) {
  22. var touch = <FreeCameraTouchInput>this.inputs.attached["touch"];
  23. if (touch)
  24. touch.touchMoveSensibility = value;
  25. }
  26. //-- end properties for backward compatibility for inputs
  27. constructor(name: string, position: Vector3, scene: Scene) {
  28. super(name, position, scene);
  29. this.inputs.addTouch();
  30. this._setupInputs();
  31. }
  32. public getClassName(): string {
  33. return "TouchCamera";
  34. }
  35. public _setupInputs() {
  36. var mouse = <FreeCameraMouseInput>this.inputs.attached["mouse"];
  37. if (mouse) {
  38. mouse.touchEnabled = false;
  39. }
  40. }
  41. }
  42. }