1 |
- {"ast":null,"code":"import { DeviceEventFactory } from \"./eventFactory.js\";\nimport { DeviceType } from \"./InputDevices/deviceEnums.js\";\n/** @internal */\nexport class NativeDeviceInputSystem {\n constructor(onDeviceConnected, onDeviceDisconnected, onInputChanged) {\n this._nativeInput = _native.DeviceInputSystem ? new _native.DeviceInputSystem(onDeviceConnected, onDeviceDisconnected, (deviceType, deviceSlot, inputIndex, currentState) => {\n const evt = DeviceEventFactory.CreateDeviceEvent(deviceType, deviceSlot, inputIndex, currentState, this);\n onInputChanged(deviceType, deviceSlot, evt);\n }) : this._createDummyNativeInput();\n }\n // Public functions\n /**\n * Checks for current device input value, given an id and input index. Throws exception if requested device not initialized.\n * @param deviceType Enum specifying device type\n * @param deviceSlot \"Slot\" or index that device is referenced in\n * @param inputIndex Id of input to be checked\n * @returns Current value of input\n */\n pollInput(deviceType, deviceSlot, inputIndex) {\n return this._nativeInput.pollInput(deviceType, deviceSlot, inputIndex);\n }\n /**\n * Check for a specific device in the DeviceInputSystem\n * @param deviceType Type of device to check for\n * @returns bool with status of device's existence\n */\n isDeviceAvailable(deviceType) {\n //TODO: FIx native side first\n return deviceType === DeviceType.Mouse || deviceType === DeviceType.Touch;\n }\n /**\n * Dispose of all the observables\n */\n dispose() {\n this._nativeInput.dispose();\n }\n /**\n * For versions of BabylonNative that don't have the NativeInput plugin initialized, create a dummy version\n * @returns Object with dummy functions\n */\n _createDummyNativeInput() {\n const nativeInput = {\n pollInput: () => {\n return 0;\n },\n isDeviceAvailable: () => {\n return false;\n },\n dispose: () => {}\n };\n return nativeInput;\n }\n}","map":{"version":3,"names":["DeviceEventFactory","DeviceType","NativeDeviceInputSystem","constructor","onDeviceConnected","onDeviceDisconnected","onInputChanged","_nativeInput","_native","DeviceInputSystem","deviceType","deviceSlot","inputIndex","currentState","evt","CreateDeviceEvent","_createDummyNativeInput","pollInput","isDeviceAvailable","Mouse","Touch","dispose","nativeInput"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/DeviceInput/nativeDeviceInputSystem.js"],"sourcesContent":["import { DeviceEventFactory } from \"./eventFactory.js\";\nimport { DeviceType } from \"./InputDevices/deviceEnums.js\";\n/** @internal */\nexport class NativeDeviceInputSystem {\n constructor(onDeviceConnected, onDeviceDisconnected, onInputChanged) {\n this._nativeInput = _native.DeviceInputSystem\n ? new _native.DeviceInputSystem(onDeviceConnected, onDeviceDisconnected, (deviceType, deviceSlot, inputIndex, currentState) => {\n const evt = DeviceEventFactory.CreateDeviceEvent(deviceType, deviceSlot, inputIndex, currentState, this);\n onInputChanged(deviceType, deviceSlot, evt);\n })\n : this._createDummyNativeInput();\n }\n // Public functions\n /**\n * Checks for current device input value, given an id and input index. Throws exception if requested device not initialized.\n * @param deviceType Enum specifying device type\n * @param deviceSlot \"Slot\" or index that device is referenced in\n * @param inputIndex Id of input to be checked\n * @returns Current value of input\n */\n pollInput(deviceType, deviceSlot, inputIndex) {\n return this._nativeInput.pollInput(deviceType, deviceSlot, inputIndex);\n }\n /**\n * Check for a specific device in the DeviceInputSystem\n * @param deviceType Type of device to check for\n * @returns bool with status of device's existence\n */\n isDeviceAvailable(deviceType) {\n //TODO: FIx native side first\n return deviceType === DeviceType.Mouse || deviceType === DeviceType.Touch;\n }\n /**\n * Dispose of all the observables\n */\n dispose() {\n this._nativeInput.dispose();\n }\n /**\n * For versions of BabylonNative that don't have the NativeInput plugin initialized, create a dummy version\n * @returns Object with dummy functions\n */\n _createDummyNativeInput() {\n const nativeInput = {\n pollInput: () => {\n return 0;\n },\n isDeviceAvailable: () => {\n return false;\n },\n dispose: () => { },\n };\n return nativeInput;\n }\n}\n"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,mBAAmB;AACtD,SAASC,UAAU,QAAQ,+BAA+B;AAC1D;AACA,OAAO,MAAMC,uBAAuB,CAAC;EACjCC,WAAWA,CAACC,iBAAiB,EAAEC,oBAAoB,EAAEC,cAAc,EAAE;IACjE,IAAI,CAACC,YAAY,GAAGC,OAAO,CAACC,iBAAiB,GACvC,IAAID,OAAO,CAACC,iBAAiB,CAACL,iBAAiB,EAAEC,oBAAoB,EAAE,CAACK,UAAU,EAAEC,UAAU,EAAEC,UAAU,EAAEC,YAAY,KAAK;MAC3H,MAAMC,GAAG,GAAGd,kBAAkB,CAACe,iBAAiB,CAACL,UAAU,EAAEC,UAAU,EAAEC,UAAU,EAAEC,YAAY,EAAE,IAAI,CAAC;MACxGP,cAAc,CAACI,UAAU,EAAEC,UAAU,EAAEG,GAAG,CAAC;IAC/C,CAAC,CAAC,GACA,IAAI,CAACE,uBAAuB,CAAC,CAAC;EACxC;EACA;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;EACIC,SAASA,CAACP,UAAU,EAAEC,UAAU,EAAEC,UAAU,EAAE;IAC1C,OAAO,IAAI,CAACL,YAAY,CAACU,SAAS,CAACP,UAAU,EAAEC,UAAU,EAAEC,UAAU,CAAC;EAC1E;EACA;AACJ;AACA;AACA;AACA;EACIM,iBAAiBA,CAACR,UAAU,EAAE;IAC1B;IACA,OAAOA,UAAU,KAAKT,UAAU,CAACkB,KAAK,IAAIT,UAAU,KAAKT,UAAU,CAACmB,KAAK;EAC7E;EACA;AACJ;AACA;EACIC,OAAOA,CAAA,EAAG;IACN,IAAI,CAACd,YAAY,CAACc,OAAO,CAAC,CAAC;EAC/B;EACA;AACJ;AACA;AACA;EACIL,uBAAuBA,CAAA,EAAG;IACtB,MAAMM,WAAW,GAAG;MAChBL,SAAS,EAAEA,CAAA,KAAM;QACb,OAAO,CAAC;MACZ,CAAC;MACDC,iBAAiB,EAAEA,CAAA,KAAM;QACrB,OAAO,KAAK;MAChB,CAAC;MACDG,OAAO,EAAEA,CAAA,KAAM,CAAE;IACrB,CAAC;IACD,OAAOC,WAAW;EACtB;AACJ","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}
|