modaq
Version:
Quiz Bowl Reader using TypeScript, React, and MobX
39 lines • 1.52 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.update = exports.changeFontFamily = exports.changePendingSize = exports.cancel = void 0;
const AppState_1 = require("src/state/AppState");
const defaultFont = "Segoe UI";
const minimumFontSize = 12;
function cancel() {
hideDialog();
}
exports.cancel = cancel;
function changePendingSize(newValue) {
const appState = AppState_1.AppState.instance;
if (newValue == undefined) {
return;
}
const size = Number.parseInt(newValue, 10);
if (!isNaN(size)) {
appState.uiState.setPendingFontSize(size);
}
}
exports.changePendingSize = changePendingSize;
function changeFontFamily(newValue) {
AppState_1.AppState.instance.uiState.setPendingFontFamily(newValue !== null && newValue !== void 0 ? newValue : defaultFont);
}
exports.changeFontFamily = changeFontFamily;
function update() {
var _a, _b;
const appState = AppState_1.AppState.instance;
if (appState.uiState.pendingFontSize != undefined) {
appState.uiState.setFontFamily((_a = appState.uiState.pendingFontFamily) !== null && _a !== void 0 ? _a : defaultFont);
appState.uiState.setQuestionFontSize((_b = appState.uiState.pendingFontSize) !== null && _b !== void 0 ? _b : minimumFontSize);
hideDialog();
}
}
exports.update = update;
function hideDialog() {
AppState_1.AppState.instance.uiState.resetPendingFonts();
}
//# sourceMappingURL=FontDialogController.js.map