mirror of
https://github.com/wavetermdev/waveterm
synced 2026-05-24 01:08:27 +00:00
Fix directory preview scroll to selected entry (#996)
This commit is contained in:
parent
9f57d2d46b
commit
1eb458dc16
1 changed files with 4 additions and 2 deletions
|
|
@ -261,6 +261,7 @@ function DirectoryTable({
|
|||
|
||||
const onScroll = useCallback(
|
||||
debounce(2, () => {
|
||||
console.log("onScroll");
|
||||
setScrollHeight(osRef.current.osInstance().elements().viewport.scrollTop);
|
||||
}),
|
||||
[]
|
||||
|
|
@ -376,8 +377,8 @@ function TableBody({
|
|||
const parentRect = bodyRef.current.getBoundingClientRect();
|
||||
const viewportScrollTop = viewport.scrollTop;
|
||||
|
||||
const rowTopRelativeToViewport = rowRect.top - parentRect.top + viewportScrollTop;
|
||||
const rowBottomRelativeToViewport = rowRect.bottom - parentRect.top + viewportScrollTop;
|
||||
const rowTopRelativeToViewport = rowRect.top - parentRect.top;
|
||||
const rowBottomRelativeToViewport = rowRect.bottom - parentRect.top;
|
||||
|
||||
if (rowTopRelativeToViewport < viewportScrollTop) {
|
||||
// Row is above the visible area
|
||||
|
|
@ -387,6 +388,7 @@ function TableBody({
|
|||
viewport.scrollTo({ top: rowBottomRelativeToViewport - viewportHeight });
|
||||
}
|
||||
}
|
||||
// setIndexChangedFromClick(false);
|
||||
}, [focusIndex]);
|
||||
|
||||
const handleFileContextMenu = useCallback(
|
||||
|
|
|
|||
Loading…
Reference in a new issue