diff options
author | Adrian Kummerlaender | 2015-08-31 19:53:49 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2015-08-31 19:53:49 +0200 |
commit | 2897ec000a55f832a4032a64c8f9de8dd7e370f0 (patch) | |
tree | 244db9c66f3e3bc4235ca3c269bfb0c5bc163833 | |
parent | 49edb32662e20c284e4a0a1a5b248eb65f2b42b6 (diff) | |
download | MetaTerm-2897ec000a55f832a4032a64c8f9de8dd7e370f0.tar MetaTerm-2897ec000a55f832a4032a64c8f9de8dd7e370f0.tar.gz MetaTerm-2897ec000a55f832a4032a64c8f9de8dd7e370f0.tar.bz2 MetaTerm-2897ec000a55f832a4032a64c8f9de8dd7e370f0.tar.lz MetaTerm-2897ec000a55f832a4032a64c8f9de8dd7e370f0.tar.xz MetaTerm-2897ec000a55f832a4032a64c8f9de8dd7e370f0.tar.zst MetaTerm-2897ec000a55f832a4032a64c8f9de8dd7e370f0.zip |
Improve scrolling to items larger than the viewport
-rw-r--r-- | src/list/TerminalList.qml | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/list/TerminalList.qml b/src/list/TerminalList.qml index 9c1636f..cafefeb 100644 --- a/src/list/TerminalList.qml +++ b/src/list/TerminalList.qml @@ -37,12 +37,17 @@ Item { function scrollTo(index) { if ( column.height >= flickable.height ) { - var offset = children[index].y - + (children[index].height / 2) - - (flickable.height / 2); + var offset = children[index].y; + + if ( children[index].height > flickable.height ) { + offset -= (flickable.height / 2); + } else { + offset += (children[index].height / 2) + - (flickable.height / 2); + } var bound = column.height - - flickable.height; + - flickable.height; if ( offset < 0 ) { flickable.contentY = 0; |