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

Improve Bounding Box Selection #8054

Merged
merged 7 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -11,6 +11,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
[Commits](https://github.com/scalableminds/webknossos/compare/24.08.1...HEAD)

### Added
- It is now possible to focus a bounding box in the bounding box tab by clicking its edges in a viewport or via a newly added context menu entry. [#8054](https://github.com/scalableminds/webknossos/pull/8054)

### Changed
- Clicking on a bounding box within the bounding box tab centers it within the viewports and focusses it in the list. [#8049](https://github.com/scalableminds/webknossos/pull/8049)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,12 @@ export class MoveTool {
if (SkeletonHandlers.handleSelectNode(planeView, pos, plane, isTouch)) {
return;
}
const clickedEdge = getClosestHoveredBoundingBox(pos, planeId);
if (clickedEdge) {
Store.dispatch(setActiveUserBoundingBoxId(clickedEdge[0].boxId));
return;
}
}

handleClickSegment(pos);
},
middleClick: (pos: Point2, _plane: OrthoView, event: MouseEvent) => {
Expand All @@ -142,7 +146,18 @@ export class MoveTool {
MoveHandlers.setMousePosition(center);
MoveHandlers.zoom(delta, true);
},
mouseMove: MoveHandlers.moveWhenAltIsPressed,
mouseMove: (delta: Point2, position: Point2, _id: any, event: MouseEvent) => {
MoveHandlers.moveWhenAltIsPressed(delta, position, _id, event);
if (planeId !== OrthoViews.TDView) {
const hoveredEdgesInfo = getClosestHoveredBoundingBox(position, planeId);
if (hoveredEdgesInfo) {
const [primaryEdge] = hoveredEdgesInfo;
getSceneController().highlightUserBoundingBox(primaryEdge.boxId);
} else {
getSceneController().highlightUserBoundingBox(null);
}
}
},
out: () => {
MoveHandlers.setMousePosition(null);
},
Expand Down
7 changes: 6 additions & 1 deletion frontend/javascripts/oxalis/view/context_menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ import {
ensureLayerMappingsAreLoadedAction,
ensureSegmentIndexIsLoadedAction,
} from "oxalis/model/actions/dataset_actions";
import { hideContextMenuAction } from "oxalis/model/actions/ui_actions";
import { hideContextMenuAction, setActiveUserBoundingBoxId } from "oxalis/model/actions/ui_actions";
import { getDisabledInfoForTools } from "oxalis/model/accessors/tool_accessor";
import FastTooltip from "components/fast_tooltip";

Expand Down Expand Up @@ -834,6 +834,11 @@ function getBoundingBoxMenuOptions({

return [
newBoundingBoxMenuItem,
{
key: "focus-in-bbox-tab",
label: "Focus in Bounding Box Tab",
onClick: () => Store.dispatch(setActiveUserBoundingBoxId(hoveredBBox.id)),
},
{
key: "change-bounding-box-name",
label: (
Expand Down