From 7b4c942a1fad8bc2e3033f14f736173243ca1933 Mon Sep 17 00:00:00 2001 From: Coteh <3276350+Coteh@users.noreply.github.com> Date: Sat, 26 Mar 2022 03:27:19 -0400 Subject: [PATCH] Increase jump to context delay to 1s for split pane mode to ensure correct line is jumped to. Single pane mode does not have this issue so the 10ms delay can remain for that mode. Also renamed the click handler function since it technically doesn't perform the actual scroll action anymore. --- assets/components/LogViewer.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/assets/components/LogViewer.vue b/assets/components/LogViewer.vue index eb895588..9c5b06ad 100644 --- a/assets/components/LogViewer.vue +++ b/assets/components/LogViewer.vue @@ -9,7 +9,7 @@ >
- +
@@ -59,7 +59,7 @@ const { activeContainers } = storeToRefs(store); const filtered = filteredMessages(messages); const events = ref(null); let selectedLine; -const jumpToLine = async (e) => { +const handleJumpLineSelected = async (e) => { const line = e.target.closest("li"); if (line.tagName !== "LI") { return; @@ -79,9 +79,11 @@ watch(filtered, async (newVal, oldVal) => { } } // when in split pane mode - scroll the pane element, when not in split pane mode - scroll the window element - const elemToScroll = activeContainers.value.length > 0 ? events.value.closest("main") : window; + const inSplitPane = activeContainers.value.length > 0; + const elemToScroll = inSplitPane ? events.value.closest("main") : window; elemToScroll.scrollTo(0, 0); - await new Promise((resolve) => setTimeout(resolve, 10)); + // wait 1s before jumping when in split pane mode to ensure the correct line is scrolled to, single pane mode does not have this issue thus only 10ms is needed + await new Promise((resolve) => setTimeout(resolve, inSplitPane ? 1000 : 10)); elemToScroll.scrollTo(0, selectedLine.offsetTop - 200); selectedLine = null; });