Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segment multiselect #7242

Merged
merged 24 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
93e439e
copy changes from old branch
dieknolle3333 Jul 21, 2023
361be14
segment ids vs segment keys
dieknolle3333 Jul 21, 2023
b31717b
WIP: implement functions for multiselect
dieknolle3333 Jul 21, 2023
b973570
ignore select events when a popover a dropdown is open
philippotto Jul 24, 2023
ef0fc83
implement reset color and remove segment from list batch actions
dieknolle3333 Jul 24, 2023
dd8d41f
add more batch actions such as show/hide meshes for multiselect
dieknolle3333 Jul 24, 2023
5762493
fix visibility
dieknolle3333 Jul 25, 2023
1eb8e65
recover group selection
dieknolle3333 Jul 25, 2023
1aa783b
WIP: implement modal if group and segment are selected
dieknolle3333 Jul 27, 2023
b2338bb
WIP: actions on segments in different groups
dieknolle3333 Jul 28, 2023
87e8b1a
get selected segments
dieknolle3333 Jul 28, 2023
1740bf1
fix handledropdownvisibility
dieknolle3333 Jul 28, 2023
e359eba
make linter happy(er)
dieknolle3333 Jul 28, 2023
c78e6a9
fix error that there is only one id for segment and group dropdown
dieknolle3333 Jul 30, 2023
1d83cd3
actually make segment and group dropdown id two fields
dieknolle3333 Jul 31, 2023
28b2baa
delete dev remains
dieknolle3333 Jul 31, 2023
990b999
Merge branch 'master' into segment-multiselect
dieknolle3333 Jul 31, 2023
02495cc
add changelog
dieknolle3333 Jul 31, 2023
a465c40
handle case where group is selected after having selected multiple se…
dieknolle3333 Jul 31, 2023
75c47c1
improve comment
dieknolle3333 Jul 31, 2023
62c2d11
address review
dieknolle3333 Aug 1, 2023
f68f9fb
adjust if-condition to improve performance
dieknolle3333 Aug 1, 2023
0d29c93
improve regex
dieknolle3333 Aug 4, 2023
d5c5605
Merge branch 'master' into segment-multiselect
dieknolle3333 Aug 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Added the option to change the ordering of color layers via drag and drop. This is useful when using the cover blend mode. [#7188](https://github.com/scalableminds/webknossos/pull/7188)
- Added configuration to require users' emails to be verified, added flow to verify emails via link. [#7161](https://github.com/scalableminds/webknossos/pull/7161)
- Added a route to explore and add remote datasets via API. [#7176](https://github.com/scalableminds/webknossos/pull/7176)
- Added option to select multiple segments in segment list in order to perform batch actions. [#7242](https://github.com/scalableminds/webknossos/pull/7242)
philippotto marked this conversation as resolved.
Show resolved Hide resolved

### Changed
- Small messages during annotating (e.g. “finished undo”, “applying mapping…”) are now click-through so they do not block users from selecting tools. [7239](https://github.com/scalableminds/webknossos/pull/7239)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ type Props = {
mappingInfo: ActiveMappingInfo;
isHoveredSegmentId: boolean;
centeredSegmentId: number | null | undefined;
selectedSegmentId: number | null | undefined;
selectedSegmentIds: number[] | null | undefined;
activeCellId: number | null | undefined;
setHoveredSegmentId: (arg0: number | null | undefined) => void;
handleSegmentDropdownMenuVisibility: (arg0: number, arg1: boolean) => void;
handleSegmentDropdownMenuVisibility: (arg0: boolean, arg1: number) => void;
activeDropdownSegmentId: number | null | undefined;
allowUpdate: boolean;
updateSegment: (
Expand All @@ -170,14 +170,15 @@ type Props = {
currentMeshFile: APIMeshFile | null | undefined;
onRenameStart: () => void;
onRenameEnd: () => void;
multiSelectMenu: MenuProps;
};

function _MeshInfoItem(props: {
segment: Segment;
isSelectedInList: boolean;
isHovered: boolean;
isosurface: IsosurfaceInformation | null | undefined;
handleSegmentDropdownMenuVisibility: (arg0: number, arg1: boolean) => void;
handleSegmentDropdownMenuVisibility: (arg0: boolean, arg1: number) => void;
visibleSegmentationLayer: APISegmentationLayer | null | undefined;
setPosition: (arg0: Vector3) => void;
}) {
Expand All @@ -197,7 +198,7 @@ function _MeshInfoItem(props: {
style={{ marginLeft: 8 }}
onContextMenu={(evt) => {
evt.preventDefault();
props.handleSegmentDropdownMenuVisibility(segment.id, true);
props.handleSegmentDropdownMenuVisibility(true, segment.id);
}}
>
No mesh loaded. Use right-click to add one.
Expand Down Expand Up @@ -315,7 +316,7 @@ function _SegmentListItem({
mappingInfo,
isHoveredSegmentId,
centeredSegmentId,
selectedSegmentId,
selectedSegmentIds,
activeCellId,
setHoveredSegmentId,
handleSegmentDropdownMenuVisibility,
Expand All @@ -333,6 +334,7 @@ function _SegmentListItem({
currentMeshFile,
onRenameStart,
onRenameEnd,
multiSelectMenu,
}: Props) {
const isEditingDisabled = !allowUpdate;

Expand All @@ -349,7 +351,7 @@ function _SegmentListItem({
return null;
}

const andCloseContextMenu = (_ignore?: any) => handleSegmentDropdownMenuVisibility(0, false);
const andCloseContextMenu = (_ignore?: any) => handleSegmentDropdownMenuVisibility(false, 0);

const createSegmentContextMenu = (): MenuProps => ({
items: [
Expand Down Expand Up @@ -454,10 +456,7 @@ function _SegmentListItem({
style={{
padding: "2px 5px",
}}
className={classnames("segment-list-item", {
"is-selected-cell": segment.id === selectedSegmentId,
"is-hovered-cell": isHoveredSegmentId,
})}
className={classnames("segment-list-item")}
philippotto marked this conversation as resolved.
Show resolved Hide resolved
onMouseEnter={() => {
setHoveredSegmentId(segment.id);
}}
Expand All @@ -466,7 +465,11 @@ function _SegmentListItem({
}}
>
<Dropdown
Copy link
Contributor Author

@dieknolle3333 dieknolle3333 Jul 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@philippotto I know we talked about increasing the zone where a segment item can be right-clicked by letting the dropdown be the parent of more content. I did not manage to do that however, because then the segment name would not react to the click anymore (so only the MeshInfoItem) – I had tried to include the MeshInfoItem into the dropdown.

menu={createSegmentContextMenu()} // The overlay is generated lazily. By default, this would make the overlay
menu={
selectedSegmentIds?.includes(segment.id) && selectedSegmentIds.length > 1
philippotto marked this conversation as resolved.
Show resolved Hide resolved
? multiSelectMenu
: createSegmentContextMenu()
} // The overlay is generated lazily. By default, this would make the overlay
// re-render on each parent's render() after it was shown for the first time.
// The reason for this is that it's not destroyed after closing.
// Therefore, autoDestroy is passed.
Expand All @@ -476,7 +479,7 @@ function _SegmentListItem({
autoDestroy
placement="bottom"
open={activeDropdownSegmentId === segment.id}
onOpenChange={(isVisible) => handleSegmentDropdownMenuVisibility(segment.id, isVisible)}
onOpenChange={(isVisible) => handleSegmentDropdownMenuVisibility(isVisible, segment.id)}
trigger={["contextMenu"]}
>
<div style={{ display: "inline-flex", alignItems: "center" }}>
Expand Down Expand Up @@ -504,7 +507,7 @@ function _SegmentListItem({
/>
<Tooltip title="Open context menu (also available via right-click)">
<EllipsisOutlined
onClick={() => handleSegmentDropdownMenuVisibility(segment.id, true)}
onClick={() => handleSegmentDropdownMenuVisibility(true, segment.id)}
/>
</Tooltip>
{/* Show Default Segment Name if another one is already defined*/}
Expand Down Expand Up @@ -539,7 +542,9 @@ function _SegmentListItem({
>
<MeshInfoItem
segment={segment}
isSelectedInList={segment.id === selectedSegmentId}
isSelectedInList={
selectedSegmentIds != null ? selectedSegmentIds?.includes(segment.id) : false
}
isHovered={isHoveredSegmentId}
isosurface={isosurface}
handleSegmentDropdownMenuVisibility={handleSegmentDropdownMenuVisibility}
Expand Down
Loading