08932d5a64af2a77c940a8e0c5006d3f6e4350772663e946a48d8b6b0c163f7f.json 7.2 KB

1
  1. {"ast":null,"code":"import { Scene } from \"../scene.js\";\nimport { SceneComponentConstants } from \"../sceneComponent.js\";\nimport { GamepadManager } from \"./gamepadManager.js\";\nimport { FreeCameraInputsManager } from \"../Cameras/freeCameraInputsManager.js\";\nimport { FreeCameraGamepadInput } from \"../Cameras/Inputs/freeCameraGamepadInput.js\";\nimport { ArcRotateCameraInputsManager } from \"../Cameras/arcRotateCameraInputsManager.js\";\nimport { ArcRotateCameraGamepadInput } from \"../Cameras/Inputs/arcRotateCameraGamepadInput.js\";\nObject.defineProperty(Scene.prototype, \"gamepadManager\", {\n get: function () {\n if (!this._gamepadManager) {\n this._gamepadManager = new GamepadManager(this);\n let component = this._getComponent(SceneComponentConstants.NAME_GAMEPAD);\n if (!component) {\n component = new GamepadSystemSceneComponent(this);\n this._addComponent(component);\n }\n }\n return this._gamepadManager;\n },\n enumerable: true,\n configurable: true\n});\n/**\n * Adds a gamepad to the free camera inputs manager\n * @returns the FreeCameraInputsManager\n */\nFreeCameraInputsManager.prototype.addGamepad = function () {\n this.add(new FreeCameraGamepadInput());\n return this;\n};\n/**\n * Adds a gamepad to the arc rotate camera inputs manager\n * @returns the camera inputs manager\n */\nArcRotateCameraInputsManager.prototype.addGamepad = function () {\n this.add(new ArcRotateCameraGamepadInput());\n return this;\n};\n/**\n * Defines the gamepad scene component responsible to manage gamepads in a given scene\n */\nexport class GamepadSystemSceneComponent {\n /**\n * Creates a new instance of the component for the given scene\n * @param scene Defines the scene to register the component in\n */\n constructor(scene) {\n /**\n * The component name helpfull to identify the component in the list of scene components.\n */\n this.name = SceneComponentConstants.NAME_GAMEPAD;\n this.scene = scene;\n }\n /**\n * Registers the component in a given scene\n */\n register() {\n // Nothing to do for gamepads\n }\n /**\n * Rebuilds the elements related to this component in case of\n * context lost for instance.\n */\n rebuild() {\n // Nothing to do for gamepads\n }\n /**\n * Disposes the component and the associated resources\n */\n dispose() {\n const gamepadManager = this.scene._gamepadManager;\n if (gamepadManager) {\n gamepadManager.dispose();\n this.scene._gamepadManager = null;\n }\n }\n}","map":{"version":3,"names":["Scene","SceneComponentConstants","GamepadManager","FreeCameraInputsManager","FreeCameraGamepadInput","ArcRotateCameraInputsManager","ArcRotateCameraGamepadInput","Object","defineProperty","prototype","get","_gamepadManager","component","_getComponent","NAME_GAMEPAD","GamepadSystemSceneComponent","_addComponent","enumerable","configurable","addGamepad","add","constructor","scene","name","register","rebuild","dispose","gamepadManager"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Gamepads/gamepadSceneComponent.js"],"sourcesContent":["import { Scene } from \"../scene.js\";\nimport { SceneComponentConstants } from \"../sceneComponent.js\";\nimport { GamepadManager } from \"./gamepadManager.js\";\nimport { FreeCameraInputsManager } from \"../Cameras/freeCameraInputsManager.js\";\nimport { FreeCameraGamepadInput } from \"../Cameras/Inputs/freeCameraGamepadInput.js\";\nimport { ArcRotateCameraInputsManager } from \"../Cameras/arcRotateCameraInputsManager.js\";\nimport { ArcRotateCameraGamepadInput } from \"../Cameras/Inputs/arcRotateCameraGamepadInput.js\";\nObject.defineProperty(Scene.prototype, \"gamepadManager\", {\n get: function () {\n if (!this._gamepadManager) {\n this._gamepadManager = new GamepadManager(this);\n let component = this._getComponent(SceneComponentConstants.NAME_GAMEPAD);\n if (!component) {\n component = new GamepadSystemSceneComponent(this);\n this._addComponent(component);\n }\n }\n return this._gamepadManager;\n },\n enumerable: true,\n configurable: true,\n});\n/**\n * Adds a gamepad to the free camera inputs manager\n * @returns the FreeCameraInputsManager\n */\nFreeCameraInputsManager.prototype.addGamepad = function () {\n this.add(new FreeCameraGamepadInput());\n return this;\n};\n/**\n * Adds a gamepad to the arc rotate camera inputs manager\n * @returns the camera inputs manager\n */\nArcRotateCameraInputsManager.prototype.addGamepad = function () {\n this.add(new ArcRotateCameraGamepadInput());\n return this;\n};\n/**\n * Defines the gamepad scene component responsible to manage gamepads in a given scene\n */\nexport class GamepadSystemSceneComponent {\n /**\n * Creates a new instance of the component for the given scene\n * @param scene Defines the scene to register the component in\n */\n constructor(scene) {\n /**\n * The component name helpfull to identify the component in the list of scene components.\n */\n this.name = SceneComponentConstants.NAME_GAMEPAD;\n this.scene = scene;\n }\n /**\n * Registers the component in a given scene\n */\n register() {\n // Nothing to do for gamepads\n }\n /**\n * Rebuilds the elements related to this component in case of\n * context lost for instance.\n */\n rebuild() {\n // Nothing to do for gamepads\n }\n /**\n * Disposes the component and the associated resources\n */\n dispose() {\n const gamepadManager = this.scene._gamepadManager;\n if (gamepadManager) {\n gamepadManager.dispose();\n this.scene._gamepadManager = null;\n }\n }\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,aAAa;AACnC,SAASC,uBAAuB,QAAQ,sBAAsB;AAC9D,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,uBAAuB,QAAQ,uCAAuC;AAC/E,SAASC,sBAAsB,QAAQ,6CAA6C;AACpF,SAASC,4BAA4B,QAAQ,4CAA4C;AACzF,SAASC,2BAA2B,QAAQ,kDAAkD;AAC9FC,MAAM,CAACC,cAAc,CAACR,KAAK,CAACS,SAAS,EAAE,gBAAgB,EAAE;EACrDC,GAAG,EAAE,SAAAA,CAAA,EAAY;IACb,IAAI,CAAC,IAAI,CAACC,eAAe,EAAE;MACvB,IAAI,CAACA,eAAe,GAAG,IAAIT,cAAc,CAAC,IAAI,CAAC;MAC/C,IAAIU,SAAS,GAAG,IAAI,CAACC,aAAa,CAACZ,uBAAuB,CAACa,YAAY,CAAC;MACxE,IAAI,CAACF,SAAS,EAAE;QACZA,SAAS,GAAG,IAAIG,2BAA2B,CAAC,IAAI,CAAC;QACjD,IAAI,CAACC,aAAa,CAACJ,SAAS,CAAC;MACjC;IACJ;IACA,OAAO,IAAI,CAACD,eAAe;EAC/B,CAAC;EACDM,UAAU,EAAE,IAAI;EAChBC,YAAY,EAAE;AAClB,CAAC,CAAC;AACF;AACA;AACA;AACA;AACAf,uBAAuB,CAACM,SAAS,CAACU,UAAU,GAAG,YAAY;EACvD,IAAI,CAACC,GAAG,CAAC,IAAIhB,sBAAsB,CAAC,CAAC,CAAC;EACtC,OAAO,IAAI;AACf,CAAC;AACD;AACA;AACA;AACA;AACAC,4BAA4B,CAACI,SAAS,CAACU,UAAU,GAAG,YAAY;EAC5D,IAAI,CAACC,GAAG,CAAC,IAAId,2BAA2B,CAAC,CAAC,CAAC;EAC3C,OAAO,IAAI;AACf,CAAC;AACD;AACA;AACA;AACA,OAAO,MAAMS,2BAA2B,CAAC;EACrC;AACJ;AACA;AACA;EACIM,WAAWA,CAACC,KAAK,EAAE;IACf;AACR;AACA;IACQ,IAAI,CAACC,IAAI,GAAGtB,uBAAuB,CAACa,YAAY;IAChD,IAAI,CAACQ,KAAK,GAAGA,KAAK;EACtB;EACA;AACJ;AACA;EACIE,QAAQA,CAAA,EAAG;IACP;EAAA;EAEJ;AACJ;AACA;AACA;EACIC,OAAOA,CAAA,EAAG;IACN;EAAA;EAEJ;AACJ;AACA;EACIC,OAAOA,CAAA,EAAG;IACN,MAAMC,cAAc,GAAG,IAAI,CAACL,KAAK,CAACX,eAAe;IACjD,IAAIgB,cAAc,EAAE;MAChBA,cAAc,CAACD,OAAO,CAAC,CAAC;MACxB,IAAI,CAACJ,KAAK,CAACX,eAAe,GAAG,IAAI;IACrC;EACJ;AACJ","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}