Skip to content

Commit 6525225

Browse files
Michael BüßemeyerMichael Büßemeyer
authored andcommitted
apply feedback
- send datasource id in correct format to backend - fix dataset renaming in dataset settings - fix typo in filename
1 parent fbdf34d commit 6525225

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

frontend/javascripts/oxalis/view/right-border-tabs/scrollable_virtualized_tree.tsx

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { Tree as AntdTree, type TreeProps } from "antd";
22
import type { BasicDataNode } from "antd/es/tree";
33
import { throttle } from "lodash";
4-
import Constants from "oxalis/constants";
54
import { useCallback, useRef } from "react";
65
import type RcTree from "rc-tree";
76

8-
const SCROLL_SPEED_PX = 32;
9-
const MIN_SCROLL_AREA_HEIGHT = 48;
7+
const MIN_SCROLL_SPEED = 30;
8+
const MAX_SCROLL_SPEED = 200;
9+
const MIN_SCROLL_AREA_HEIGHT = 60;
1010
const SCROLL_AREA_RATIO = 10; // 1/10th of the container height
11+
const THROTTLE_TIME = 25;
1112

1213
function ScrollableVirtualizedTree<T extends BasicDataNode>(
1314
props: TreeProps<T> & { ref: React.RefObject<RcTree> },
@@ -23,18 +24,33 @@ function ScrollableVirtualizedTree<T extends BasicDataNode>(
2324
const { bottom: currentBottom, top: currentTop } = target.getBoundingClientRect();
2425
const { bottom: boxBottom, top: boxTop } = wrapperRef.current.getBoundingClientRect();
2526
const scrollableList = wrapperRef.current.getElementsByClassName("ant-tree-list-holder")[0];
27+
if (!scrollableList) {
28+
return;
29+
}
2630
const scrollAreaHeight = Math.max(
2731
MIN_SCROLL_AREA_HEIGHT,
2832
Math.round((boxBottom - boxTop) / SCROLL_AREA_RATIO),
2933
);
3034

3135
if (currentTop > boxBottom - scrollAreaHeight && scrollableList) {
32-
scrollableList.scrollTop += SCROLL_SPEED_PX;
36+
const ratioWithinScrollingArea =
37+
(currentTop - (boxBottom - scrollAreaHeight)) / scrollAreaHeight;
38+
const scrollingValue = Math.max(
39+
Math.round(ratioWithinScrollingArea * MAX_SCROLL_SPEED),
40+
MIN_SCROLL_SPEED,
41+
);
42+
scrollableList.scrollTop += scrollingValue;
3343
}
3444
if (boxTop + scrollAreaHeight > currentBottom && scrollableList) {
35-
scrollableList.scrollTop -= SCROLL_SPEED_PX;
45+
const ratioWithinScrollingArea =
46+
(boxTop + scrollAreaHeight - currentBottom) / scrollAreaHeight;
47+
const scrollingValue = Math.max(
48+
Math.round(ratioWithinScrollingArea * MAX_SCROLL_SPEED),
49+
MIN_SCROLL_SPEED,
50+
);
51+
scrollableList.scrollTop -= scrollingValue;
3652
}
37-
}, Constants.RESIZE_THROTTLE_TIME),
53+
}, THROTTLE_TIME),
3854
[wrapperRef],
3955
);
4056

File renamed without changes.

frontend/javascripts/oxalis/view/right-border-tabs/trees_tab/tree_hierarchy_renderers.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import {
5151
MISSING_GROUP_ID,
5252
type TreeNode,
5353
} from "oxalis/view/right-border-tabs/tree_hierarchy_view_helpers";
54-
import { HideTreeEdgesIcon } from "./hide_tree_eges_icon";
54+
import { HideTreeEdgesIcon } from "./hide_tree_edges_icon";
5555
import { ColoredDotIcon } from "../segments_tab/segment_list_item";
5656

5757
export type Props = {

0 commit comments

Comments
 (0)