1 |
- {"ast":null,"code":"import { DeviceType } from \"./InputDevices/deviceEnums.js\";\nimport { NativeDeviceInputSystem } from \"./nativeDeviceInputSystem.js\";\nimport { WebDeviceInputSystem } from \"./webDeviceInputSystem.js\";\nimport { DeviceSource } from \"./InputDevices/deviceSource.js\";\n/** @internal */\nexport class InternalDeviceSourceManager {\n constructor(engine) {\n this._registeredManagers = new Array();\n this._refCount = 0;\n // Public Functions\n this.registerManager = manager => {\n for (let deviceType = 0; deviceType < this._devices.length; deviceType++) {\n const device = this._devices[deviceType];\n for (const deviceSlotKey in device) {\n const deviceSlot = +deviceSlotKey;\n manager._addDevice(new DeviceSource(this._deviceInputSystem, deviceType, deviceSlot));\n }\n }\n this._registeredManagers.push(manager);\n };\n this.unregisterManager = manager => {\n const idx = this._registeredManagers.indexOf(manager);\n if (idx > -1) {\n this._registeredManagers.splice(idx, 1);\n }\n };\n const numberOfDeviceTypes = Object.keys(DeviceType).length / 2;\n this._devices = new Array(numberOfDeviceTypes);\n const onDeviceConnected = (deviceType, deviceSlot) => {\n if (!this._devices[deviceType]) {\n this._devices[deviceType] = new Array();\n }\n if (!this._devices[deviceType][deviceSlot]) {\n this._devices[deviceType][deviceSlot] = deviceSlot;\n }\n for (const manager of this._registeredManagers) {\n const deviceSource = new DeviceSource(this._deviceInputSystem, deviceType, deviceSlot);\n manager._addDevice(deviceSource);\n }\n };\n const onDeviceDisconnected = (deviceType, deviceSlot) => {\n var _this$_devices$device;\n if ((_this$_devices$device = this._devices[deviceType]) !== null && _this$_devices$device !== void 0 && _this$_devices$device[deviceSlot]) {\n delete this._devices[deviceType][deviceSlot];\n }\n for (const manager of this._registeredManagers) {\n manager._removeDevice(deviceType, deviceSlot);\n }\n };\n const onInputChanged = (deviceType, deviceSlot, eventData) => {\n if (eventData) {\n for (const manager of this._registeredManagers) {\n manager._onInputChanged(deviceType, deviceSlot, eventData);\n }\n }\n };\n if (typeof _native !== \"undefined\") {\n this._deviceInputSystem = new NativeDeviceInputSystem(onDeviceConnected, onDeviceDisconnected, onInputChanged);\n } else {\n this._deviceInputSystem = new WebDeviceInputSystem(engine, onDeviceConnected, onDeviceDisconnected, onInputChanged);\n }\n }\n dispose() {\n this._deviceInputSystem.dispose();\n }\n}","map":{"version":3,"names":["DeviceType","NativeDeviceInputSystem","WebDeviceInputSystem","DeviceSource","InternalDeviceSourceManager","constructor","engine","_registeredManagers","Array","_refCount","registerManager","manager","deviceType","_devices","length","device","deviceSlotKey","deviceSlot","_addDevice","_deviceInputSystem","push","unregisterManager","idx","indexOf","splice","numberOfDeviceTypes","Object","keys","onDeviceConnected","deviceSource","onDeviceDisconnected","_this$_devices$device","_removeDevice","onInputChanged","eventData","_onInputChanged","_native","dispose"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/DeviceInput/internalDeviceSourceManager.js"],"sourcesContent":["import { DeviceType } from \"./InputDevices/deviceEnums.js\";\nimport { NativeDeviceInputSystem } from \"./nativeDeviceInputSystem.js\";\nimport { WebDeviceInputSystem } from \"./webDeviceInputSystem.js\";\nimport { DeviceSource } from \"./InputDevices/deviceSource.js\";\n/** @internal */\nexport class InternalDeviceSourceManager {\n constructor(engine) {\n this._registeredManagers = new Array();\n this._refCount = 0;\n // Public Functions\n this.registerManager = (manager) => {\n for (let deviceType = 0; deviceType < this._devices.length; deviceType++) {\n const device = this._devices[deviceType];\n for (const deviceSlotKey in device) {\n const deviceSlot = +deviceSlotKey;\n manager._addDevice(new DeviceSource(this._deviceInputSystem, deviceType, deviceSlot));\n }\n }\n this._registeredManagers.push(manager);\n };\n this.unregisterManager = (manager) => {\n const idx = this._registeredManagers.indexOf(manager);\n if (idx > -1) {\n this._registeredManagers.splice(idx, 1);\n }\n };\n const numberOfDeviceTypes = Object.keys(DeviceType).length / 2;\n this._devices = new Array(numberOfDeviceTypes);\n const onDeviceConnected = (deviceType, deviceSlot) => {\n if (!this._devices[deviceType]) {\n this._devices[deviceType] = new Array();\n }\n if (!this._devices[deviceType][deviceSlot]) {\n this._devices[deviceType][deviceSlot] = deviceSlot;\n }\n for (const manager of this._registeredManagers) {\n const deviceSource = new DeviceSource(this._deviceInputSystem, deviceType, deviceSlot);\n manager._addDevice(deviceSource);\n }\n };\n const onDeviceDisconnected = (deviceType, deviceSlot) => {\n if (this._devices[deviceType]?.[deviceSlot]) {\n delete this._devices[deviceType][deviceSlot];\n }\n for (const manager of this._registeredManagers) {\n manager._removeDevice(deviceType, deviceSlot);\n }\n };\n const onInputChanged = (deviceType, deviceSlot, eventData) => {\n if (eventData) {\n for (const manager of this._registeredManagers) {\n manager._onInputChanged(deviceType, deviceSlot, eventData);\n }\n }\n };\n if (typeof _native !== \"undefined\") {\n this._deviceInputSystem = new NativeDeviceInputSystem(onDeviceConnected, onDeviceDisconnected, onInputChanged);\n }\n else {\n this._deviceInputSystem = new WebDeviceInputSystem(engine, onDeviceConnected, onDeviceDisconnected, onInputChanged);\n }\n }\n dispose() {\n this._deviceInputSystem.dispose();\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,+BAA+B;AAC1D,SAASC,uBAAuB,QAAQ,8BAA8B;AACtE,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,YAAY,QAAQ,gCAAgC;AAC7D;AACA,OAAO,MAAMC,2BAA2B,CAAC;EACrCC,WAAWA,CAACC,MAAM,EAAE;IAChB,IAAI,CAACC,mBAAmB,GAAG,IAAIC,KAAK,CAAC,CAAC;IACtC,IAAI,CAACC,SAAS,GAAG,CAAC;IAClB;IACA,IAAI,CAACC,eAAe,GAAIC,OAAO,IAAK;MAChC,KAAK,IAAIC,UAAU,GAAG,CAAC,EAAEA,UAAU,GAAG,IAAI,CAACC,QAAQ,CAACC,MAAM,EAAEF,UAAU,EAAE,EAAE;QACtE,MAAMG,MAAM,GAAG,IAAI,CAACF,QAAQ,CAACD,UAAU,CAAC;QACxC,KAAK,MAAMI,aAAa,IAAID,MAAM,EAAE;UAChC,MAAME,UAAU,GAAG,CAACD,aAAa;UACjC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