Добавил fontVertShift в настройки, местами рефакторинг

This commit is contained in:
Book Pauk
2019-01-29 19:28:48 +07:00
parent 57bf25c2d5
commit e208697aef
3 changed files with 51 additions and 18 deletions

View File

@@ -5,8 +5,8 @@ const fonts = [
{name: 'GEO_1', label: 'BPG Arial', fontVertShift: 10},
{name: 'Arimo', fontVertShift: 0},
{name: 'Avrile', fontVertShift: -10},
{name: 'OpenSans', fontVertShift: 0},
{name: 'Roboto', fontVertShift: 0},
{name: 'OpenSans', fontVertShift: -5},
{name: 'Roboto', fontVertShift: 10},
{name: 'Rubik', fontVertShift: 0},
];
@@ -14,7 +14,7 @@ const webFonts = [
{css: 'https://fonts.googleapis.com/css?family=Comfortaa', name: 'Comfortaa', fontVertShift: 10},
{css: 'https://fonts.googleapis.com/css?family=Lobster', name: 'Lobster', fontVertShift: 0},
{css: 'https://fonts.googleapis.com/css?family=Oswald', name: 'Oswald', fontVertShift: -20},
{css: 'https://fonts.googleapis.com/css?family=Pacifico', name: 'Pacifico', fontVertShift: -40},
{css: 'https://fonts.googleapis.com/css?family=Pacifico', name: 'Pacifico', fontVertShift: -35},
];
@@ -26,6 +26,7 @@ const settingDefaults = {
fontSize: 20,// px
fontName: 'ReaderDefault',
webFontName: '',
fontVertShift: 0,
lineInterval: 3,// px, межстрочный интервал
textAlignJustify: true,// выравнивание по ширине
@@ -44,8 +45,14 @@ const settingDefaults = {
pageChangeTransitionSpeed: 50, //0-100%
allowUrlParamBookPos: false,
fontShifts: {},
};
for (const font of fonts)
settingDefaults.fontShifts[font.name] = font.fontVertShift;
for (const font of webFonts)
settingDefaults.fontShifts[font.name] = font.fontVertShift;
// initial state
const state = {
toolBarActive: true,