修复驱动管理与侧边栏展开的前台显示问题
* 修复标签页切换和侧边栏展开滚动 * chore: rerun ci --------- Co-authored-by: staff <staff@qimaos-MacBook-Pro.local>
This commit is contained in:
1 parent
886c11f8e6
commit
1cd3406e94
4 files changed
+4
-89
No files matched your search
@@ -29,25 +29,3 @@ export function flattenTree(nodes: TreeNode[]): FlatTreeNode[] {
|
||||
export function shouldVirtualizeFlatTree(count: number): boolean {
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
export function shouldAutoScrollExpandedTreeNode(type: TreeNodeType): boolean {
|
||||
return type !== "connection" && type !== "connection-group";
|
||||
}
|
||||
|
||||
export function scrollTopForExpandedTreeNode(options: { expandedIndex: number; insertedRowCount: number; currentScrollTop: number; viewportHeight: number; rowHeight?: number }): number {
|
||||
const rowHeight = options.rowHeight ?? SIDEBAR_TREE_ROW_HEIGHT;
|
||||
if (options.expandedIndex < 0 || options.insertedRowCount <= 0 || options.viewportHeight <= 0) {
|
||||
return options.currentScrollTop;
|
||||
}
|
||||
|
||||
const visibleRowCapacity = Math.max(1, Math.floor(options.viewportHeight / rowHeight) - 1);
|
||||
const rowsToReveal = Math.min(options.insertedRowCount, visibleRowCapacity);
|
||||
const expandedContentBottom = (options.expandedIndex + 1 + rowsToReveal) * rowHeight;
|
||||
const viewportBottom = options.currentScrollTop + options.viewportHeight;
|
||||
|
||||
if (expandedContentBottom <= viewportBottom) {
|
||||
return options.currentScrollTop;
|
||||
}
|
||||
|
||||
return Math.max(0, expandedContentBottom - options.viewportHeight);
|
||||
}
|
||||
Reference in new issue
Block a user