mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-28 07:22:50 -05:00
@@ -214,7 +214,7 @@ FocusScope {
|
|||||||
color: Theme.outlineStrong
|
color: Theme.outlineStrong
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateIndicator(enableAnimation = true) {
|
function updateIndicator() {
|
||||||
if (tabRepeater.count === 0 || currentIndex < 0 || currentIndex >= tabRepeater.count) {
|
if (tabRepeater.count === 0 || currentIndex < 0 || currentIndex >= tabRepeater.count) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -229,25 +229,26 @@ FocusScope {
|
|||||||
const indicatorWidth = 60
|
const indicatorWidth = 60
|
||||||
|
|
||||||
if (tabPos.x < 10 && currentIndex > 0) {
|
if (tabPos.x < 10 && currentIndex > 0) {
|
||||||
Qt.callLater(() => updateIndicator(enableAnimation))
|
Qt.callLater(updateIndicator)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
indicator.animationEnabled = enableAnimation
|
if (!indicator.initialSetupComplete) {
|
||||||
indicator.width = indicatorWidth
|
indicator.animationEnabled = false
|
||||||
indicator.x = tabCenterX - indicatorWidth / 2
|
indicator.width = indicatorWidth
|
||||||
indicator.visible = true
|
indicator.x = tabCenterX - indicatorWidth / 2
|
||||||
|
indicator.visible = true
|
||||||
|
indicator.initialSetupComplete = true
|
||||||
|
indicator.animationEnabled = true
|
||||||
|
} else {
|
||||||
|
indicator.width = indicatorWidth
|
||||||
|
indicator.x = tabCenterX - indicatorWidth / 2
|
||||||
|
indicator.visible = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: {
|
||||||
if (indicator.initialSetupComplete) {
|
Qt.callLater(updateIndicator)
|
||||||
Qt.callLater(() => updateIndicator(true))
|
|
||||||
} else {
|
|
||||||
Qt.callLater(() => {
|
|
||||||
updateIndicator(false)
|
|
||||||
indicator.initialSetupComplete = true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
onWidthChanged: Qt.callLater(() => updateIndicator(indicator.initialSetupComplete))
|
onWidthChanged: Qt.callLater(updateIndicator)
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user