mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Selection consistency #2
This commit is contained in:
parent
ec591c4da0
commit
ffcccacfa5
1 changed files with 13 additions and 5 deletions
|
@ -141,21 +141,27 @@ Item {
|
||||||
bottomMargin: 0
|
bottomMargin: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
function setButtonState(buttonIndex) {
|
function setButtonState(buttonIndex, buttonstate) {
|
||||||
var itemat = gridView.contentItem.children[buttonIndex];
|
if (buttonIndex < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var itemat = gridView.contentItem.children[buttonIndex].children[0];
|
||||||
|
console.warn("changing item at", buttonIndex, state, itemat.objectName,
|
||||||
|
gridView.contentItem.children[buttonIndex].objectName)
|
||||||
if (itemat.isActive) {
|
if (itemat.isActive) {
|
||||||
itemat.state = "active state";
|
itemat.state = "active state";
|
||||||
} else {
|
} else {
|
||||||
itemat.state = state;
|
itemat.state = buttonstate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: {
|
||||||
setButtonState(previousGridIndex)
|
setButtonState(previousGridIndex, "base state");
|
||||||
rowIndex = Math.floor(currentIndex / TabletEnums.ButtonsColumnsOnPage);
|
rowIndex = Math.floor(currentIndex / TabletEnums.ButtonsColumnsOnPage);
|
||||||
columnIndex = currentIndex % TabletEnums.ButtonsColumnsOnPage
|
columnIndex = currentIndex % TabletEnums.ButtonsColumnsOnPage
|
||||||
console.warn("current index", currentIndex, rowIndex, columnIndex)
|
console.warn("current index", currentIndex, rowIndex, columnIndex)
|
||||||
setButtonState(currentIndex)
|
setButtonState(currentIndex, "hover state");
|
||||||
previousGridIndex = currentIndex
|
previousGridIndex = currentIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,6 +172,7 @@ Item {
|
||||||
|
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
id: wrapper
|
id: wrapper
|
||||||
|
objectName: "wrapper"
|
||||||
width: gridView.cellWidth
|
width: gridView.cellWidth
|
||||||
height: gridView.cellHeight
|
height: gridView.cellHeight
|
||||||
|
|
||||||
|
@ -214,6 +221,7 @@ Item {
|
||||||
|
|
||||||
currentGridItems.currentIndex = (previousIndex > swipeView.currentIndex ? currentGridItems.count - 1 : 0);
|
currentGridItems.currentIndex = (previousIndex > swipeView.currentIndex ? currentGridItems.count - 1 : 0);
|
||||||
previousIndex = currentIndex;
|
previousIndex = currentIndex;
|
||||||
|
setButtonState(currentIndex, "hover state");
|
||||||
}
|
}
|
||||||
|
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
Loading…
Reference in a new issue