mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-24 04:32:15 -04:00
The max page should be nbPages-1, not nbPages.
This commit is contained in:
parent
3311423ca1
commit
f81061f1f4
@ -69,7 +69,7 @@ function init() {
|
|||||||
changePage : function(delta) {
|
changePage : function(delta) {
|
||||||
var newPage = contentManager.currentPage+delta;
|
var newPage = contentManager.currentPage+delta;
|
||||||
if (newPage < 0) newPage = 0;
|
if (newPage < 0) newPage = 0;
|
||||||
if (newPage > contentManager.nbPages) newPage = contentManager.nbPages;
|
if (newPage > contentManager.nbPages-1) newPage = contentManager.nbPages-1;
|
||||||
contentManager.currentPage = newPage;
|
contentManager.currentPage = newPage;
|
||||||
},
|
},
|
||||||
downloadBook : function(book) {
|
downloadBook : function(book) {
|
||||||
@ -220,9 +220,9 @@ button {
|
|||||||
<div class="footer">
|
<div class="footer">
|
||||||
<button v-on:click="contentManager.currentPage = 0">First</button>
|
<button v-on:click="contentManager.currentPage = 0">First</button>
|
||||||
<button v-on:click="changePage(-1)">Previous</button>
|
<button v-on:click="changePage(-1)">Previous</button>
|
||||||
{{ contentManager.currentPage+1 }} / {{ contentManager.nbPages+1 }}
|
{{ contentManager.currentPage+1 }} / {{ contentManager.nbPages }}
|
||||||
<button v-on:click="changePage(1)">Next</button>
|
<button v-on:click="changePage(1)">Next</button>
|
||||||
<button v-on:click="contentManager.currentPage = contentManager.nbPages">Last</button>
|
<button v-on:click="contentManager.currentPage = contentManager.nbPages-1">Last</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -38,7 +38,7 @@ private:
|
|||||||
bool m_local = true;
|
bool m_local = true;
|
||||||
QString m_currentLanguage;
|
QString m_currentLanguage;
|
||||||
void setCurrentPage(int currentPage) {
|
void setCurrentPage(int currentPage) {
|
||||||
m_currentPage = max(0, min(currentPage, getNbPages()));
|
m_currentPage = max(0, min(currentPage, getNbPages()-1));
|
||||||
emit(booksChanged());
|
emit(booksChanged());
|
||||||
}
|
}
|
||||||
void setCurrentLanguage(QString language);
|
void setCurrentLanguage(QString language);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user