logviewer: preserve horizontal scroll position

This commit is contained in:
Johannes Zellner
2023-11-14 14:24:58 +01:00
parent bf381aff7f
commit fe1c483b78
+2 -2
View File
@@ -20,7 +20,7 @@
<div v-for="line in logLines" :key="line.id" class="log-line">
<span class="time">{{ line.time }}</span><span v-html="line.html"></span>
</div>
<div ref="scrollAnchor" class="bottom-spacer"></div>
<div class="bottom-spacer"></div>
</template>
</MainLayout>
</template>
@@ -144,7 +144,7 @@ export default {
if (!tmp) return;
const autoScroll = tmp.scrollTop > (tmp.scrollHeight - tmp.clientHeight - 34);
if (autoScroll) setTimeout(() => this.$refs.scrollAnchor.scrollIntoView(false), 1);
if (autoScroll) setTimeout(() => tmp.scrollTop = tmp.scrollHeight, 1);
}, function (error) {
console.error('Failed to start log stream:', error);
})