Skip to content

Commit

Permalink
[fingerterm] Adjust scroll indicator. Contributes JB#49213
Browse files Browse the repository at this point in the history
Moves the scroll indicator to the right hand side, where it's less
likely to get in the way of the text. Pressing the scroll indicator
resets the scroll position.
  • Loading branch information
llewelld authored and David Llewellyn-Jones committed Feb 5, 2021
1 parent 4182ad7 commit 741222c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
22 changes: 16 additions & 6 deletions qml/Main.qml
Expand Up @@ -211,13 +211,23 @@ Item {
}
}

Image {
// terminal buffer scroll indicator
source: "icons/scroll-indicator.png"
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom

MouseArea {
// terminal buffer scroll button
x: window.width - width
width: scrollImg.width + 60*window.pixelRatio
height: scrollImg.height + 30*window.pixelRatio
anchors.bottom: textrender.bottom
visible: textrender.showBufferScrollIndicator
scale: window.pixelRatio
onClicked: textrender.scrollToEnd()

Image {
id: scrollImg

anchors.centerIn: parent
source: "icons/scroll-indicator.png"
scale: window.pixelRatio
}
}

TextRender {
Expand Down
5 changes: 5 additions & 0 deletions textrender.cpp
Expand Up @@ -437,6 +437,11 @@ QPointF TextRender::scrollBackBuffer(QPointF now, QPointF last)
return last;
}

void TextRender::scrollToEnd()
{
sTerm->resetBackBufferScrollPos();
}

void TextRender::doGesture(PanGesture gesture)
{
if( gesture==PanLeft ) {
Expand Down
1 change: 1 addition & 0 deletions textrender.h
Expand Up @@ -54,6 +54,7 @@ class TextRender : public QQuickPaintedItem

Q_INVOKABLE QPoint cursorPixelPos();
Q_INVOKABLE QSize cursorPixelSize();
Q_INVOKABLE void scrollToEnd();

bool allowGestures();
void setAllowGestures(bool allow);
Expand Down

0 comments on commit 741222c

Please sign in to comment.