mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mobile UI: add consistent way to show a page
And have the existing shortcut functions use that helper. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e5c62f0858
commit
93080f129d
1 changed files with 14 additions and 13 deletions
|
|
@ -76,30 +76,31 @@ Kirigami.ApplicationWindow {
|
||||||
diveList.scrollToTop()
|
diveList.scrollToTop()
|
||||||
}
|
}
|
||||||
|
|
||||||
function showMap() {
|
function showPage(page) {
|
||||||
if (globalDrawer.drawerOpen)
|
if (globalDrawer.drawerOpen)
|
||||||
globalDrawer.close()
|
globalDrawer.close()
|
||||||
var i=pageIndex(mapPage)
|
var i=pageIndex(page)
|
||||||
if (i === -1)
|
if (i === -1)
|
||||||
pageStack.push(mapPage)
|
pageStack.push(page)
|
||||||
else
|
else
|
||||||
pageStack.currentIndex = i
|
pageStack.currentIndex = i
|
||||||
|
manager.appendTextToLog("switched to page " + page.title)
|
||||||
|
}
|
||||||
|
|
||||||
|
function showMap() {
|
||||||
|
showPage(mapPage)
|
||||||
}
|
}
|
||||||
|
|
||||||
function showDiveList() {
|
function showDiveList() {
|
||||||
if (globalDrawer.drawerOpen)
|
showPage(diveList)
|
||||||
globalDrawer.close()
|
|
||||||
var i=pageIndex(diveList)
|
|
||||||
if (i === -1)
|
|
||||||
pageStack.push(diveList)
|
|
||||||
else
|
|
||||||
pageStack.currentIndex = i
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function pageIndex(pageToFind) {
|
function pageIndex(pageToFind) {
|
||||||
for (var i = 0; i < pageStack.contentItem.contentChildren.length; i++) {
|
if (pageStack.contentItem !== null) {
|
||||||
if (pageStack.contentItem.contentChildren[i] === pageToFind)
|
for (var i = 0; i < pageStack.contentItem.contentChildren.length; i++) {
|
||||||
return i
|
if (pageStack.contentItem.contentChildren[i] === pageToFind)
|
||||||
|
return i
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue