Improve chat scrolling and minimap bounds

This commit is contained in:
Levi Neely 2026-08-16 14:47:41 +02:00
parent 183f30ca23
commit 100572b94e
1 changed files with 23 additions and 2 deletions

View File

@ -5,15 +5,23 @@ import QtQuick.Layouts 1.15
Item {
id: chatPane
property bool sidebarVisible: true
property int maxVisibleBlocks: 80
signal toggleSidebar()
function scrollToBottom() {
chatView.positionViewAtEnd()
}
function trimVisibleBlocks() {
if (chatModel.count > chatPane.maxVisibleBlocks)
chatModel.trimFront(chatPane.maxVisibleBlocks)
}
function loadChat() {
chatModel.reset()
if (ollie.activeSessionId && ollie.activeAgentId) {
var log = ollie.readLogForSession(ollie.activeSessionId, ollie.activeAgentId)
if (log) { chatModel.appendData(log); chatModel.trimFront(20) }
if (log) {
chatModel.appendData(log)
chatModel.trimFront(chatPane.maxVisibleBlocks)
}
}
scrollToBottom()
}
@ -124,6 +132,13 @@ Item {
anchors.margins: 4
visible: ollie.daemonConnected && ollie.activeAgentId !== ""
onCountChanged: {
if (!scrollButton.visible) chatPane.scrollToBottom()
}
onContentHeightChanged: {
if (!scrollButton.visible) chatPane.scrollToBottom()
}
delegate: ChatBlockDelegate {
width: chatView.width - 8
}
@ -167,7 +182,8 @@ Item {
}
}
Button {
anchors.right: parent.right
id: scrollButton
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.margins: 12
text: "↓"
@ -272,6 +288,11 @@ Item {
}
Connections {
target: chatModel
function onCountChanged() { chatPane.trimVisibleBlocks() }
}
Connections {
target: ollie
function onSessionsChanged() { chatPane.loadChat() }