Commit 85e7a9d7 authored by Noah Davis's avatar Noah Davis 🌵

Add moving sounds to TileRepeater and TileView

parent ff234384
......@@ -149,14 +149,26 @@ FocusScope {
}
}
Keys.onLeftPressed: currentIndex = Math.max(0, currentIndex - 1)
Keys.onRightPressed: currentIndex = Math.min(count - 1, currentIndex + 1)
Keys.onLeftPressed: {
if (currentIndex > 0) {
BigScreen.NavigationSoundEffects.playMovingSound();
currentIndex = Math.max(0, currentIndex - 1);
}
}
Keys.onRightPressed: {
if (currentIndex < count - 1) {
BigScreen.NavigationSoundEffects.playMovingSound();
currentIndex = Math.min(count - 1, currentIndex + 1);
}
}
Keys.onDownPressed: {
if (!root.navigationDown) {
return;
}
BigScreen.NavigationSoundEffects.playMovingSound();
if (root.navigationDown instanceof TileView ||
root.navigationDown instanceof TileRepeater) {
root.navigationDown.currentIndex = Math.min(Math.floor(root.navigationDown.view.indexAt(root.navigationDown.view.contentX, height/2)), root.navigationDown.view.count - 1);
......@@ -174,6 +186,8 @@ FocusScope {
return;
}
BigScreen.NavigationSoundEffects.playMovingSound();
if (root.navigationUp instanceof TileView ||
root.navigationUp instanceof TileRepeater) {
root.navigationUp.currentIndex = Math.min(Math.floor(root.navigationUp.view.indexAt(root.navigationUp.view.contentX, height/2)), root.navigationUp.view.count - 1);
......
......@@ -116,6 +116,8 @@ FocusScope {
return;
}
BigScreen.NavigationSoundEffects.playMovingSound();
if (navigationDown instanceof TileView) {
navigationDown.currentIndex = Math.min(Math.floor(navigationDown.view.indexAt(navigationDown.view.contentX + cellWidth/2, height/2)) + (view.currentIndex - view.indexAt(view.contentX + cellWidth/2, height/2)), navigationDown.view.count - 1);
......@@ -132,6 +134,8 @@ FocusScope {
return;
}
BigScreen.NavigationSoundEffects.playMovingSound();
if (navigationUp instanceof TileView) {
navigationUp.currentIndex = Math.min(Math.floor(navigationUp.view.indexAt(navigationUp.view.contentX + cellWidth/2, height/2)) + (view.currentIndex - view.indexAt(view.contentX + cellWidth/2, height/2)), navigationUp.view.count - 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment