mirror of
https://github.com/YACReader/yacreader
synced 2025-07-19 05:24:57 -04:00
Index can't exceed count - 1
This commit is contained in:
@ -525,7 +525,7 @@ Rectangle {
|
|||||||
var numCells = grid.numCellsPerRow();
|
var numCells = grid.numCellsPerRow();
|
||||||
var ci
|
var ci
|
||||||
if (event.key === Qt.Key_Right) {
|
if (event.key === Qt.Key_Right) {
|
||||||
ci = Math.min(grid.currentIndex+1,grid.count);
|
ci = Math.min(grid.currentIndex+1,grid.count - 1);
|
||||||
}
|
}
|
||||||
else if (event.key === Qt.Key_Left) {
|
else if (event.key === Qt.Key_Left) {
|
||||||
ci = Math.max(0,grid.currentIndex-1);
|
ci = Math.max(0,grid.currentIndex-1);
|
||||||
@ -534,7 +534,7 @@ Rectangle {
|
|||||||
ci = Math.max(0,grid.currentIndex-numCells);
|
ci = Math.max(0,grid.currentIndex-numCells);
|
||||||
}
|
}
|
||||||
else if (event.key === Qt.Key_Down) {
|
else if (event.key === Qt.Key_Down) {
|
||||||
ci = Math.min(grid.currentIndex+numCells,grid.count);
|
ci = Math.min(grid.currentIndex+numCells,grid.count - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
|
Reference in New Issue
Block a user