"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Lighting = void 0; var Lighting = /** @class */ (function () { function Lighting(Main) { this.autoLightingInput = document.querySelector('.ntsh-autolighting input'); this.gainInput = document.querySelector('.ntsh_lightingsettings-gain'); this.exposureInput = document.querySelector('.ntsh_lightingsettings-exposure'); this.whiteBalanceInput = document.querySelector('.ntsh_lightingsettings-whitebalance'); this._Main = Main; this.registerListeners(); } Lighting.prototype.update = function (state) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r; if (((_a = state === null || state === void 0 ? void 0 : state.parameters) === null || _a === void 0 ? void 0 : _a.advancedSliders) == null) return; var autoExposureIndex = (_b = state.parameters) === null || _b === void 0 ? void 0 : _b.advancedSliders.findIndex(function (slider) { return slider.sliderName === 'AutoExposure'; }); var autoExposureSlider = (_c = state.parameters) === null || _c === void 0 ? void 0 : _c.advancedSliders[autoExposureIndex !== null && autoExposureIndex !== void 0 ? autoExposureIndex : -1]; var gainSliderIndex = (_d = state.parameters) === null || _d === void 0 ? void 0 : _d.advancedSliders.findIndex(function (slider) { return slider.sliderName === 'Gain'; }); var gainSlider = (_e = state.parameters) === null || _e === void 0 ? void 0 : _e.advancedSliders[gainSliderIndex !== null && gainSliderIndex !== void 0 ? gainSliderIndex : -1]; var exposureSliderIndex = (_f = state.parameters) === null || _f === void 0 ? void 0 : _f.advancedSliders.findIndex(function (slider) { return slider.sliderName === 'Exposure'; }); var exposureSlider = (_g = state.parameters) === null || _g === void 0 ? void 0 : _g.advancedSliders[exposureSliderIndex !== null && exposureSliderIndex !== void 0 ? exposureSliderIndex : -1]; var whiteBalanceSliderIndex = (_h = state.parameters) === null || _h === void 0 ? void 0 : _h.advancedSliders.findIndex(function (slider) { return slider.sliderName === 'Whitebalance'; }); var whiteBalanceSlider = (_j = state.parameters) === null || _j === void 0 ? void 0 : _j.advancedSliders[whiteBalanceSliderIndex !== null && whiteBalanceSliderIndex !== void 0 ? whiteBalanceSliderIndex : -1]; this.autoLightingInput.checked = (autoExposureSlider === null || autoExposureSlider === void 0 ? void 0 : autoExposureSlider.outputValue) === 1; this.gainInput.valueAsNumber = (_k = gainSlider === null || gainSlider === void 0 ? void 0 : gainSlider.outputValue) !== null && _k !== void 0 ? _k : this.gainInput.valueAsNumber; this.exposureInput.valueAsNumber = (_l = exposureSlider === null || exposureSlider === void 0 ? void 0 : exposureSlider.outputValue) !== null && _l !== void 0 ? _l : this.exposureInput.valueAsNumber; this.whiteBalanceInput.valueAsNumber = (_m = whiteBalanceSlider === null || whiteBalanceSlider === void 0 ? void 0 : whiteBalanceSlider.outputValue) !== null && _m !== void 0 ? _m : this.whiteBalanceInput.valueAsNumber; this.autoLightingInput.setAttribute('index', (_o = autoExposureIndex === null || autoExposureIndex === void 0 ? void 0 : autoExposureIndex.toString()) !== null && _o !== void 0 ? _o : '-1'); this.gainInput.setAttribute('index', (_p = gainSliderIndex === null || gainSliderIndex === void 0 ? void 0 : gainSliderIndex.toString()) !== null && _p !== void 0 ? _p : '-1'); this.exposureInput.setAttribute('index', (_q = exposureSliderIndex === null || exposureSliderIndex === void 0 ? void 0 : exposureSliderIndex.toString()) !== null && _q !== void 0 ? _q : '-1'); this.whiteBalanceInput.setAttribute('index', (_r = whiteBalanceSliderIndex === null || whiteBalanceSliderIndex === void 0 ? void 0 : whiteBalanceSliderIndex.toString()) !== null && _r !== void 0 ? _r : '-1'); }; Lighting.prototype.registerListeners = function () { var _this = this; this.autoLightingInput.onchange = function () { var _a; _this._Main.socket.emit('unityWebSocket', 'advancedParameterValue', parseInt((_a = _this.autoLightingInput.getAttribute('index')) !== null && _a !== void 0 ? _a : '-1'), _this.autoLightingInput.checked ? 1 : 0); }; this.gainInput.onchange = function () { var _a; _this._Main.socket.emit('unityWebSocket', 'advancedParameterValue', parseInt((_a = _this.gainInput.getAttribute('index')) !== null && _a !== void 0 ? _a : '-1'), _this.gainInput.valueAsNumber); }; this.exposureInput.onchange = function () { var _a; _this._Main.socket.emit('unityWebSocket', 'advancedParameterValue', parseInt((_a = _this.exposureInput.getAttribute('index')) !== null && _a !== void 0 ? _a : '-1'), _this.exposureInput.valueAsNumber); }; this.whiteBalanceInput.onchange = function () { var _a; _this._Main.socket.emit('unityWebSocket', 'advancedParameterValue', parseInt((_a = _this.whiteBalanceInput.getAttribute('index')) !== null && _a !== void 0 ? _a : '-1'), _this.whiteBalanceInput.valueAsNumber); }; }; return Lighting; }()); exports.Lighting = Lighting; //# sourceMappingURL=lighting.js.map