Remove min and max font setting
parent
3e30df17fb
commit
55e72dd5bf
|
@ -18,6 +18,10 @@ import dis from './dispatcher';
|
|||
import SettingsStore, {SettingLevel} from './settings/SettingsStore';
|
||||
|
||||
export class FontWatcher {
|
||||
|
||||
static minSize = 13;
|
||||
static maxSize = 20;
|
||||
|
||||
constructor() {
|
||||
this._dispatcherRef = null;
|
||||
}
|
||||
|
@ -38,10 +42,7 @@ export class FontWatcher {
|
|||
};
|
||||
|
||||
_setRootFontSize = (size) => {
|
||||
const min = SettingsStore.getValue("fontSizeMin");
|
||||
const max = SettingsStore.getValue("fontSizeMax");
|
||||
|
||||
const fontSize = Math.max(Math.min(max, size), min);
|
||||
const fontSize = Math.max(Math.min(this.maxSize, size), this.minSize);
|
||||
|
||||
if (fontSize != size) {
|
||||
SettingsStore.setValue("fontSize", null, SettingLevel.Device, fontSize);
|
||||
|
|
|
@ -25,7 +25,7 @@ import Field from "../../../elements/Field";
|
|||
import Slider from "../../../elements/Slider";
|
||||
import AccessibleButton from "../../../elements/AccessibleButton";
|
||||
import dis from "../../../../../dispatcher";
|
||||
import _range from "lodash/range";
|
||||
import { FontWatcher } from "../../../../../FontWatcher";
|
||||
|
||||
export default class AppearanceUserSettingsTab extends React.Component {
|
||||
constructor() {
|
||||
|
@ -109,8 +109,8 @@ export default class AppearanceUserSettingsTab extends React.Component {
|
|||
console.log({value});
|
||||
|
||||
const parsedSize = parseFloat(value);
|
||||
const min = SettingsStore.getValue("fontSizeMin");
|
||||
const max = SettingsStore.getValue("fontSizeMax");
|
||||
const min = FontWatcher.minSize;
|
||||
const max = FontWatcher.maxSize;
|
||||
|
||||
if (isNaN(parsedSize)) {
|
||||
return {valid: false, feedback: _t("Size must be a number")};
|
||||
|
|
|
@ -171,16 +171,6 @@ export const SETTINGS = {
|
|||
default: 16,
|
||||
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": {
|
||||
displayName: _td("Custom font size"),
|
||||
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
||||
|
|
Loading…
Reference in New Issue