Skip to content

Commit

Permalink
store initial vertical scroll value
Browse files Browse the repository at this point in the history
  • Loading branch information
aferditamuriqi committed Oct 9, 2020
1 parent 86025b5 commit 023ec09
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/model/user-settings/UserSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,6 @@ export class UserSettings implements UserSettings {
if(initialUserSettings.verticalScroll) {
settings.verticalScroll = UserSettings.scrollValues.findIndex((el: any) => el === initialUserSettings.verticalScroll);
if (IS_DEV) console.log(settings.verticalScroll);
let v =await settings.getProperty(ReadiumCSS.SCROLL_KEY)
if (v != null) {
(await settings.getProperty(ReadiumCSS.SCROLL_KEY)).value = settings.verticalScroll;
await settings.saveProperty(settings.getProperty(ReadiumCSS.SCROLL_KEY))
} else {
await settings.saveProperty(new Switchable("readium-scroll-on", "readium-scroll-off", settings.verticalScroll, ReadiumCSS.SCROLL_REF, ReadiumCSS.SCROLL_KEY))
}
}
if(initialUserSettings.appearance) {
settings.appearance = UserSettings.appearanceValues.findIndex((el: any) => el === initialUserSettings.appearance);
Expand Down Expand Up @@ -228,7 +221,7 @@ export class UserSettings implements UserSettings {
private async reset() {

this.appearance = 0
this.verticalScroll = 1
this.verticalScroll = 0
this.fontSize = 100.0
this.fontOverride = false
this.fontFamily = 0
Expand All @@ -248,6 +241,12 @@ export class UserSettings implements UserSettings {
private async initializeSelections(): Promise<void> {

if (this.headerMenu) this.settingsView = HTMLUtilities.findElement(this.headerMenu, "#container-view-settings") as HTMLDivElement;
if (await this.getProperty(ReadiumCSS.SCROLL_KEY) != null) {
(await this.getProperty(ReadiumCSS.SCROLL_KEY)).value = this.verticalScroll;
await this.saveProperty(this.getProperty(ReadiumCSS.SCROLL_KEY))
} else {
await this.saveProperty(new Switchable("readium-scroll-on", "readium-scroll-off", this.verticalScroll, ReadiumCSS.SCROLL_REF, ReadiumCSS.SCROLL_KEY))
}

}

Expand Down

0 comments on commit 023ec09

Please sign in to comment.