Basic font settings.

Include a default value getter in the store in order to make the
default value easy to work with.
This commit is contained in:
Jorik Schellekens 2020-04-14 16:18:57 +01:00
parent e10a511997
commit 61f2e19d95
3 changed files with 54 additions and 0 deletions

View file

@ -370,6 +370,20 @@ export default class SettingsStore {
return SettingsStore._getFinalValue(setting, level, roomId, null, null);
}
/**
* Gets the default value of a setting.
* @param {string} settingName The name of the setting to read the value of.
* @return {*} The value, or null if not found
*/
static getDefaultValue(settingName, roomId = null, excludeDefault = false) {
// Verify that the setting is actually a setting
if (!SETTINGS[settingName]) {
throw new Error("Setting '" + settingName + "' does not appear to be a setting.");
}
return SETTINGS[settingName].default;
}
static _getFinalValue(setting, level, roomId, calculatedValue, calculatedAtLevel) {
let resultingValue = calculatedValue;