"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Lighting = void 0; var Lighting = /** @class */ (function () { function Lighting(Main) { 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; if (((_a = state === null || state === void 0 ? void 0 : state.parameters) === null || _a === void 0 ? void 0 : _a.dataAdvancedSliders) == null) return; var gainSliderIndex = (_b = state.parameters) === null || _b === void 0 ? void 0 : _b.dataAdvancedSliders.findIndex(function (slider) { return slider.sliderName === 'Gain'; }); var gainSlider = (_c = state.parameters) === null || _c === void 0 ? void 0 : _c.dataAdvancedSliders[gainSliderIndex !== null && gainSliderIndex !== void 0 ? gainSliderIndex : -1]; var exposureSliderIndex = (_d = state.parameters) === null || _d === void 0 ? void 0 : _d.dataAdvancedSliders.findIndex(function (slider) { return slider.sliderName === 'Exposure'; }); var exposureSlider = (_e = state.parameters) === null || _e === void 0 ? void 0 : _e.dataAdvancedSliders[exposureSliderIndex !== null && exposureSliderIndex !== void 0 ? exposureSliderIndex : -1]; var whiteBalanceSliderIndex = (_f = state.parameters) === null || _f === void 0 ? void 0 : _f.dataAdvancedSliders.findIndex(function (slider) { return slider.sliderName === 'WhiteBalance'; }); var whiteBalanceSlider = (_g = state.parameters) === null || _g === void 0 ? void 0 : _g.dataAdvancedSliders[whiteBalanceSliderIndex !== null && whiteBalanceSliderIndex !== void 0 ? whiteBalanceSliderIndex : -1]; this.gainInput.valueAsNumber = (_h = gainSlider === null || gainSlider === void 0 ? void 0 : gainSlider.outputValue) !== null && _h !== void 0 ? _h : this.gainInput.valueAsNumber; this.exposureInput.valueAsNumber = (_j = exposureSlider === null || exposureSlider === void 0 ? void 0 : exposureSlider.outputValue) !== null && _j !== void 0 ? _j : this.exposureInput.valueAsNumber; this.whiteBalanceInput.valueAsNumber = (_k = whiteBalanceSlider === null || whiteBalanceSlider === void 0 ? void 0 : whiteBalanceSlider.outputValue) !== null && _k !== void 0 ? _k : this.whiteBalanceInput.valueAsNumber; this.gainInput.setAttribute('index', (_l = gainSliderIndex === null || gainSliderIndex === void 0 ? void 0 : gainSliderIndex.toString()) !== null && _l !== void 0 ? _l : '-1'); this.exposureInput.setAttribute('index', (_m = exposureSliderIndex === null || exposureSliderIndex === void 0 ? void 0 : exposureSliderIndex.toString()) !== null && _m !== void 0 ? _m : '-1'); this.whiteBalanceInput.setAttribute('index', (_o = whiteBalanceSliderIndex === null || whiteBalanceSliderIndex === void 0 ? void 0 : whiteBalanceSliderIndex.toString()) !== null && _o !== void 0 ? _o : '-1'); }; Lighting.prototype.registerListeners = function () { var _this = this; this.gainInput.onchange = function () { var _a; _this._Main.socket.emit('unityWebSocket', 'dataAdvancedParameterValue', parseInt((_a = _this.gainInput.getAttribute('index')) !== null && _a !== void 0 ? _a : '-1'), _this.gainInput.valueAsNumber); }; }; return Lighting; }()); exports.Lighting = Lighting; //# sourceMappingURL=lighting.js.map