67cdb4bf879aecef1b864c28d44f3750d1ec243bd4fdc303b1c9349f84781992.json 11 KB

1
  1. {"ast":null,"code":"import { VirtualJoystick } from \"../../Misc/virtualJoystick.js\";\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager.js\";\nimport { Matrix, Vector3 } from \"../../Maths/math.vector.js\";\nimport { FreeCameraInputsManager } from \"../../Cameras/freeCameraInputsManager.js\";\n/**\n * Add virtual joystick input support to the input manager.\n * @returns the current input manager\n */\nFreeCameraInputsManager.prototype.addVirtualJoystick = function () {\n this.add(new FreeCameraVirtualJoystickInput());\n return this;\n};\n/**\n * Manage the Virtual Joystick inputs to control the movement of a free camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs\n */\nexport class FreeCameraVirtualJoystickInput {\n /**\n * Gets the left stick of the virtual joystick.\n * @returns The virtual Joystick\n */\n getLeftJoystick() {\n return this._leftjoystick;\n }\n /**\n * Gets the right stick of the virtual joystick.\n * @returns The virtual Joystick\n */\n getRightJoystick() {\n return this._rightjoystick;\n }\n /**\n * Update the current camera state depending on the inputs that have been used this frame.\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\n */\n checkInputs() {\n if (this._leftjoystick) {\n const camera = this.camera;\n const speed = camera._computeLocalCameraSpeed() * 50;\n const cameraTransform = Matrix.RotationYawPitchRoll(camera.rotation.y, camera.rotation.x, 0);\n const deltaTransform = Vector3.TransformCoordinates(new Vector3(this._leftjoystick.deltaPosition.x * speed, this._leftjoystick.deltaPosition.y * speed, this._leftjoystick.deltaPosition.z * speed), cameraTransform);\n camera.cameraDirection = camera.cameraDirection.add(deltaTransform);\n camera.cameraRotation = camera.cameraRotation.addVector3(this._rightjoystick.deltaPosition);\n if (!this._leftjoystick.pressed) {\n this._leftjoystick.deltaPosition = this._leftjoystick.deltaPosition.scale(0.9);\n }\n if (!this._rightjoystick.pressed) {\n this._rightjoystick.deltaPosition = this._rightjoystick.deltaPosition.scale(0.9);\n }\n }\n }\n /**\n * Attach the input controls to a specific dom element to get the input from.\n */\n attachControl() {\n this._leftjoystick = new VirtualJoystick(true);\n this._leftjoystick.setAxisForUpDown(2 /* JoystickAxis.Z */);\n this._leftjoystick.setAxisForLeftRight(0 /* JoystickAxis.X */);\n this._leftjoystick.setJoystickSensibility(0.15);\n this._rightjoystick = new VirtualJoystick(false);\n this._rightjoystick.setAxisForUpDown(0 /* JoystickAxis.X */);\n this._rightjoystick.setAxisForLeftRight(1 /* JoystickAxis.Y */);\n this._rightjoystick.reverseUpDown = true;\n this._rightjoystick.setJoystickSensibility(0.05);\n this._rightjoystick.setJoystickColor(\"yellow\");\n }\n /**\n * Detach the current controls from the specified dom element.\n */\n detachControl() {\n this._leftjoystick.releaseCanvas();\n this._rightjoystick.releaseCanvas();\n }\n /**\n * Gets the class name of the current input.\n * @returns the class name\n */\n getClassName() {\n return \"FreeCameraVirtualJoystickInput\";\n }\n /**\n * Get the friendly name associated with the input class.\n * @returns the input friendly name\n */\n getSimpleName() {\n return \"virtualJoystick\";\n }\n}\nCameraInputTypes[\"FreeCameraVirtualJoystickInput\"] = FreeCameraVirtualJoystickInput;","map":{"version":3,"names":["VirtualJoystick","CameraInputTypes","Matrix","Vector3","FreeCameraInputsManager","prototype","addVirtualJoystick","add","FreeCameraVirtualJoystickInput","getLeftJoystick","_leftjoystick","getRightJoystick","_rightjoystick","checkInputs","camera","speed","_computeLocalCameraSpeed","cameraTransform","RotationYawPitchRoll","rotation","y","x","deltaTransform","TransformCoordinates","deltaPosition","z","cameraDirection","cameraRotation","addVector3","pressed","scale","attachControl","setAxisForUpDown","setAxisForLeftRight","setJoystickSensibility","reverseUpDown","setJoystickColor","detachControl","releaseCanvas","getClassName","getSimpleName"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Cameras/Inputs/freeCameraVirtualJoystickInput.js"],"sourcesContent":["import { VirtualJoystick } from \"../../Misc/virtualJoystick.js\";\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager.js\";\nimport { Matrix, Vector3 } from \"../../Maths/math.vector.js\";\nimport { FreeCameraInputsManager } from \"../../Cameras/freeCameraInputsManager.js\";\n/**\n * Add virtual joystick input support to the input manager.\n * @returns the current input manager\n */\nFreeCameraInputsManager.prototype.addVirtualJoystick = function () {\n this.add(new FreeCameraVirtualJoystickInput());\n return this;\n};\n/**\n * Manage the Virtual Joystick inputs to control the movement of a free camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs\n */\nexport class FreeCameraVirtualJoystickInput {\n /**\n * Gets the left stick of the virtual joystick.\n * @returns The virtual Joystick\n */\n getLeftJoystick() {\n return this._leftjoystick;\n }\n /**\n * Gets the right stick of the virtual joystick.\n * @returns The virtual Joystick\n */\n getRightJoystick() {\n return this._rightjoystick;\n }\n /**\n * Update the current camera state depending on the inputs that have been used this frame.\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\n */\n checkInputs() {\n if (this._leftjoystick) {\n const camera = this.camera;\n const speed = camera._computeLocalCameraSpeed() * 50;\n const cameraTransform = Matrix.RotationYawPitchRoll(camera.rotation.y, camera.rotation.x, 0);\n const deltaTransform = Vector3.TransformCoordinates(new Vector3(this._leftjoystick.deltaPosition.x * speed, this._leftjoystick.deltaPosition.y * speed, this._leftjoystick.deltaPosition.z * speed), cameraTransform);\n camera.cameraDirection = camera.cameraDirection.add(deltaTransform);\n camera.cameraRotation = camera.cameraRotation.addVector3(this._rightjoystick.deltaPosition);\n if (!this._leftjoystick.pressed) {\n this._leftjoystick.deltaPosition = this._leftjoystick.deltaPosition.scale(0.9);\n }\n if (!this._rightjoystick.pressed) {\n this._rightjoystick.deltaPosition = this._rightjoystick.deltaPosition.scale(0.9);\n }\n }\n }\n /**\n * Attach the input controls to a specific dom element to get the input from.\n */\n attachControl() {\n this._leftjoystick = new VirtualJoystick(true);\n this._leftjoystick.setAxisForUpDown(2 /* JoystickAxis.Z */);\n this._leftjoystick.setAxisForLeftRight(0 /* JoystickAxis.X */);\n this._leftjoystick.setJoystickSensibility(0.15);\n this._rightjoystick = new VirtualJoystick(false);\n this._rightjoystick.setAxisForUpDown(0 /* JoystickAxis.X */);\n this._rightjoystick.setAxisForLeftRight(1 /* JoystickAxis.Y */);\n this._rightjoystick.reverseUpDown = true;\n this._rightjoystick.setJoystickSensibility(0.05);\n this._rightjoystick.setJoystickColor(\"yellow\");\n }\n /**\n * Detach the current controls from the specified dom element.\n */\n detachControl() {\n this._leftjoystick.releaseCanvas();\n this._rightjoystick.releaseCanvas();\n }\n /**\n * Gets the class name of the current input.\n * @returns the class name\n */\n getClassName() {\n return \"FreeCameraVirtualJoystickInput\";\n }\n /**\n * Get the friendly name associated with the input class.\n * @returns the input friendly name\n */\n getSimpleName() {\n return \"virtualJoystick\";\n }\n}\nCameraInputTypes[\"FreeCameraVirtualJoystickInput\"] = FreeCameraVirtualJoystickInput;\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,+BAA+B;AAC/D,SAASC,gBAAgB,QAAQ,sCAAsC;AACvE,SAASC,MAAM,EAAEC,OAAO,QAAQ,4BAA4B;AAC5D,SAASC,uBAAuB,QAAQ,0CAA0C;AAClF;AACA;AACA;AACA;AACAA,uBAAuB,CAACC,SAAS,CAACC,kBAAkB,GAAG,YAAY;EAC/D,IAAI,CAACC,GAAG,CAAC,IAAIC,8BAA8B,CAAC,CAAC,CAAC;EAC9C,OAAO,IAAI;AACf,CAAC;AACD;AACA;AACA;AACA;AACA,OAAO,MAAMA,8BAA8B,CAAC;EACxC;AACJ;AACA;AACA;EACIC,eAAeA,CAAA,EAAG;IACd,OAAO,IAAI,CAACC,aAAa;EAC7B;EACA;AACJ;AACA;AACA;EACIC,gBAAgBA,CAAA,EAAG;IACf,OAAO,IAAI,CAACC,cAAc;EAC9B;EACA;AACJ;AACA;AACA;EACIC,WAAWA,CAAA,EAAG;IACV,IAAI,IAAI,CAACH,aAAa,EAAE;MACpB,MAAMI,MAAM,GAAG,IAAI,CAACA,MAAM;MA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