mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-21 23:50:45 +00:00
* improve SFTP sorting and keyboard navigation * fix SFTP keyboard actions for empty views * fix SFTP file row context menu * fix folders-first kind sorting
23 lines
549 B
TypeScript
23 lines
549 B
TypeScript
interface SftpVirtualListScrollInput {
|
|
itemIndex: number;
|
|
rowHeight: number;
|
|
currentScrollTop: number;
|
|
viewportHeight: number;
|
|
}
|
|
|
|
export const getSftpVirtualListScrollTop = ({
|
|
itemIndex,
|
|
rowHeight,
|
|
currentScrollTop,
|
|
viewportHeight,
|
|
}: SftpVirtualListScrollInput): number => {
|
|
const rowTop = itemIndex * rowHeight;
|
|
const rowBottom = rowTop + rowHeight;
|
|
|
|
if (rowTop < currentScrollTop) return rowTop;
|
|
if (rowBottom > currentScrollTop + viewportHeight) {
|
|
return rowBottom - viewportHeight;
|
|
}
|
|
return currentScrollTop;
|
|
};
|