mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-03 03:15:31 -04:00
Add preload lookahead controller
This commit is contained in:
parent
b02b28d3e3
commit
d544252e3e
@ -55,7 +55,7 @@ const readerComponent = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Preload Images
|
// Preload Images
|
||||||
this.preloadLookahead = 3;
|
this.preloadLookahead = +localStorage.getItem('preloadLookahead') ?? 3;
|
||||||
const limit = Math.min(page + this.preloadLookahead, this.items.length + 1);
|
const limit = Math.min(page + this.preloadLookahead, this.items.length + 1);
|
||||||
for (let idx = page + 1; idx <= limit; idx++) {
|
for (let idx = page + 1; idx <= limit; idx++) {
|
||||||
this.preloadImage(this.items[idx - 1].url);
|
this.preloadImage(this.items[idx - 1].url);
|
||||||
@ -305,6 +305,10 @@ const readerComponent = () => {
|
|||||||
marginChanged() {
|
marginChanged() {
|
||||||
localStorage.setItem('margin', this.margin);
|
localStorage.setItem('margin', this.margin);
|
||||||
this.toPage(this.selectedIndex);
|
this.toPage(this.selectedIndex);
|
||||||
|
},
|
||||||
|
|
||||||
|
preloadLookaheadChanged() {
|
||||||
|
localStorage.setItem('preloadLookahead', this.preloadLookahead);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="uk-margin" x-show="mode !== 'continuous'">
|
||||||
|
<label class="uk-form-label" for="preload-lookahead" x-text="`Preload Image: ${preloadLookahead} page(s)`"></label>
|
||||||
|
<div class="uk-form-controls">
|
||||||
|
<input id="preload-lookahead" class="uk-range" type="range" min="0" max="5" step="1" x-model.number="preloadLookahead" @change="preloadLookaheadChanged()">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr class="uk-divider-icon">
|
<hr class="uk-divider-icon">
|
||||||
|
|
||||||
<div class="uk-margin">
|
<div class="uk-margin">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user