Skip to content

Commit

Permalink
Improve Bounding Box Selection (#8054)
Browse files Browse the repository at this point in the history
* add focus bbox to context menu

* focus on click and highlight on hover BBox in move mode

* improve controls for bbox selection in move mode

* improve var naming

* add changelog

---------

Co-authored-by: Philipp Otto <[email protected]>
  • Loading branch information
knollengewaechs and philippotto authored Sep 9, 2024
1 parent 8b7fa1c commit 2b2469c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
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

0 comments on commit 2b2469c

Please sign in to comment.