1 |
- {"ast":null,"code":"import { FreeCamera } from \"./freeCamera.js\";\nimport { Vector3 } from \"../Maths/math.vector.js\";\nimport { Node } from \"../node.js\";\nNode.AddNodeConstructor(\"TouchCamera\", (name, scene) => {\n return () => new TouchCamera(name, Vector3.Zero(), scene);\n});\n/**\n * This represents a FPS type of camera controlled by touch.\n * This is like a universal camera minus the Gamepad controls.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_introduction#universal-camera\n */\nexport class TouchCamera extends FreeCamera {\n /**\n * Defines the touch sensibility for rotation.\n * The higher the faster.\n */\n get touchAngularSensibility() {\n const touch = this.inputs.attached[\"touch\"];\n if (touch) {\n return touch.touchAngularSensibility;\n }\n return 0;\n }\n set touchAngularSensibility(value) {\n const touch = this.inputs.attached[\"touch\"];\n if (touch) {\n touch.touchAngularSensibility = value;\n }\n }\n /**\n * Defines the touch sensibility for move.\n * The higher the faster.\n */\n get touchMoveSensibility() {\n const touch = this.inputs.attached[\"touch\"];\n if (touch) {\n return touch.touchMoveSensibility;\n }\n return 0;\n }\n set touchMoveSensibility(value) {\n const touch = this.inputs.attached[\"touch\"];\n if (touch) {\n touch.touchMoveSensibility = value;\n }\n }\n /**\n * Instantiates a new touch camera.\n * This represents a FPS type of camera controlled by touch.\n * This is like a universal camera minus the Gamepad controls.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_introduction#universal-camera\n * @param name Define the name of the camera in the scene\n * @param position Define the start position of the camera in the scene\n * @param scene Define the scene the camera belongs to\n */\n constructor(name, position, scene) {\n super(name, position, scene);\n this.inputs.addTouch();\n this._setupInputs();\n }\n /**\n * Gets the current object class name.\n * @returns the class name\n */\n getClassName() {\n return \"TouchCamera\";\n }\n /** @internal */\n _setupInputs() {\n const touch = this.inputs.attached[\"touch\"];\n const mouse = this.inputs.attached[\"mouse\"];\n if (mouse) {\n // enable touch in mouse input if touch module is not enabled\n mouse.touchEnabled = !touch;\n } else {\n // allow mouse in touch input if mouse module is not available\n touch.allowMouse = !mouse;\n }\n }\n}","map":{"version":3,"names":["FreeCamera","Vector3","Node","AddNodeConstructor","name","scene","TouchCamera","Zero","touchAngularSensibility","touch","inputs","attached","value","touchMoveSensibility","constructor","position","addTouch","_setupInputs","getClassName","mouse","touchEnabled","allowMouse"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Cameras/touchCamera.js"],"sourcesContent":["import { FreeCamera } from \"./freeCamera.js\";\nimport { Vector3 } from \"../Maths/math.vector.js\";\nimport { Node } from \"../node.js\";\nNode.AddNodeConstructor(\"TouchCamera\", (name, scene) => {\n return () => new TouchCamera(name, Vector3.Zero(), scene);\n});\n/**\n * This represents a FPS type of camera controlled by touch.\n * This is like a universal camera minus the Gamepad controls.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_introduction#universal-camera\n */\nexport class TouchCamera extends FreeCamera {\n /**\n * Defines the touch sensibility for rotation.\n * The higher the faster.\n */\n get touchAngularSensibility() {\n const touch = this.inputs.attached[\"touch\"];\n if (touch) {\n return touch.touchAngularSensibility;\n }\n return 0;\n }\n set touchAngularSensibility(value) {\n const touch = this.inputs.attached[\"touch\"];\n if (touch) {\n touch.touchAngularSensibility = value;\n }\n }\n /**\n * Defines the touch sensibility for move.\n * The higher the faster.\n */\n get touchMoveSensibility() {\n const touch = this.inputs.attached[\"touch\"];\n if (touch) {\n return touch.touchMoveSensibility;\n }\n return 0;\n }\n set touchMoveSensibility(value) {\n const touch = this.inputs.attached[\"touch\"];\n if (touch) {\n touch.touchMoveSensibility = value;\n }\n }\n /**\n * Instantiates a new touch camera.\n * This represents a FPS type of camera controlled by touch.\n * This is like a universal camera minus the Gamepad controls.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_introduction#universal-camera\n * @param name Define the name of the camera in the scene\n * @param position Define the start position of the camera in the scene\n * @param scene Define the scene the camera belongs to\n */\n constructor(name, position, scene) {\n super(name, position, scene);\n this.inputs.addTouch();\n this._setupInputs();\n }\n /**\n * Gets the current object class name.\n * @returns the class name\n */\n getClassName() {\n return \"TouchCamera\";\n }\n /** @internal */\n _setupInputs() {\n const touch = this.inputs.attached[\"touch\"];\n const mouse = this.inputs.attached[\"mouse\"];\n if (mouse) {\n // enable touch in mouse input if touch module is not enabled\n mouse.touchEnabled = !touch;\n }\n else {\n // allow mouse in touch input if mouse module is not available\n touch.allowMouse = !mouse;\n }\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,OAAO,QAAQ,yBAAyB;AACjD,SAASC,IAAI,QAAQ,YAAY;AACjCA,IAAI,CAACC,kBAAkB,CAAC,aAAa,EAAE,CAACC,IAAI,EAAEC,KAAK,KAAK;EACpD,OAAO,MAAM,IAAIC,WAAW,CAACF,IAAI,EAAEH,OAAO,CAACM,IAAI,CAAC,CAAC,EAAEF,KAAK,CAAC;AAC7D,CAAC,CAAC;AACF;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,SAASN,UAAU,CAAC;EACxC;AACJ;AACA;AACA;EACI,IAAIQ,uBAAuBA,CAAA,EAAG;IAC1B,MAAMC,KAAK,GAAG,IAAI,CAACC,MAAM,CAACC,QAAQ,CAAC,OAAO,CAAC;IAC3C,IAAIF,KAAK,EAAE;MACP,OAAOA,KAAK,CAACD,uBAAuB;IACxC;IACA,OAAO,CAAC;EACZ;EACA,IAAIA,uBAAuBA,CAACI,KAAK,EAAE;IAC/B,MAAMH,KAAK,GAAG,IAAI,CAACC,MAAM,CAACC,QAAQ,CAAC,OAAO,CAAC;IAC3C,IAAIF,KAAK,EAAE;MACPA,KAAK,CAACD,uBAAuB,GAAGI,KAAK;IACzC;EACJ;EACA;AACJ;AACA;AACA;EACI,IAAIC,oBAAoBA,CAAA,EAAG;IACvB,MAAMJ,KAAK,GAAG,IAAI,CAACC,MAAM,CAACC,QAAQ,CAAC,OAAO,CAAC;IAC3C,IAAIF,KAAK,EAAE;MACP,OAAOA,KAAK,CAACI,oBAAoB;IACr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