Remove min and max font setting

This commit is contained in:
Jorik Schellekens 2020-05-20 13:45:54 +01:00
parent 3e30df17fb
commit 55e72dd5bf
3 changed files with 8 additions and 17 deletions

View file

@ -18,6 +18,10 @@ import dis from './dispatcher';
import SettingsStore, {SettingLevel} from './settings/SettingsStore'; import SettingsStore, {SettingLevel} from './settings/SettingsStore';
export class FontWatcher { export class FontWatcher {
static minSize = 13;
static maxSize = 20;
constructor() { constructor() {
this._dispatcherRef = null; this._dispatcherRef = null;
} }
@ -38,10 +42,7 @@ export class FontWatcher {
}; };
_setRootFontSize = (size) => { _setRootFontSize = (size) => {
const min = SettingsStore.getValue("fontSizeMin"); const fontSize = Math.max(Math.min(this.maxSize, size), this.minSize);
const max = SettingsStore.getValue("fontSizeMax");
const fontSize = Math.max(Math.min(max, size), min);
if (fontSize != size) { if (fontSize != size) {
SettingsStore.setValue("fontSize", null, SettingLevel.Device, fontSize); SettingsStore.setValue("fontSize", null, SettingLevel.Device, fontSize);

View file

@ -25,7 +25,7 @@ import Field from "../../../elements/Field";
import Slider from "../../../elements/Slider"; import Slider from "../../../elements/Slider";
import AccessibleButton from "../../../elements/AccessibleButton"; import AccessibleButton from "../../../elements/AccessibleButton";
import dis from "../../../../../dispatcher"; import dis from "../../../../../dispatcher";
import _range from "lodash/range"; import { FontWatcher } from "../../../../../FontWatcher";
export default class AppearanceUserSettingsTab extends React.Component { export default class AppearanceUserSettingsTab extends React.Component {
constructor() { constructor() {
@ -109,8 +109,8 @@ export default class AppearanceUserSettingsTab extends React.Component {
console.log({value}); console.log({value});
const parsedSize = parseFloat(value); const parsedSize = parseFloat(value);
const min = SettingsStore.getValue("fontSizeMin"); const min = FontWatcher.minSize;
const max = SettingsStore.getValue("fontSizeMax"); const max = FontWatcher.maxSize;
if (isNaN(parsedSize)) { if (isNaN(parsedSize)) {
return {valid: false, feedback: _t("Size must be a number")}; return {valid: false, feedback: _t("Size must be a number")};

View file

@ -171,16 +171,6 @@ export const SETTINGS = {
default: 16, default: 16,
controller: new FontSizeController(), controller: new FontSizeController(),
}, },
"fontSizeMin": {
displayName: _td("Min font size"),
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
default: 13,
},
"fontSizeMax": {
displayName: _td("Max font size"),
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
default: 20,
},
"useCustomFontSize": { "useCustomFontSize": {
displayName: _td("Custom font size"), displayName: _td("Custom font size"),
supportedLevels: LEVELS_ACCOUNT_SETTINGS, supportedLevels: LEVELS_ACCOUNT_SETTINGS,