Skip to content

Commit 2b2469c

Browse files
Improve Bounding Box Selection (#8054)
* 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 <philippotto@users.noreply.github.com>
1 parent 8b7fa1c commit 2b2469c

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

CHANGELOG.unreleased.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
1111
[Commits](https://github.com/scalableminds/webknossos/compare/24.08.1...HEAD)
1212

1313
### Added
14+
- 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)
1415

1516
### Changed
1617
- 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)

frontend/javascripts/oxalis/controller/combinations/tool_controls.ts

+17-2
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,12 @@ export class MoveTool {
129129
if (SkeletonHandlers.handleSelectNode(planeView, pos, plane, isTouch)) {
130130
return;
131131
}
132+
const clickedEdge = getClosestHoveredBoundingBox(pos, planeId);
133+
if (clickedEdge) {
134+
Store.dispatch(setActiveUserBoundingBoxId(clickedEdge[0].boxId));
135+
return;
136+
}
132137
}
133-
134138
handleClickSegment(pos);
135139
},
136140
middleClick: (pos: Point2, _plane: OrthoView, event: MouseEvent) => {
@@ -142,7 +146,18 @@ export class MoveTool {
142146
MoveHandlers.setMousePosition(center);
143147
MoveHandlers.zoom(delta, true);
144148
},
145-
mouseMove: MoveHandlers.moveWhenAltIsPressed,
149+
mouseMove: (delta: Point2, position: Point2, _id: any, event: MouseEvent) => {
150+
MoveHandlers.moveWhenAltIsPressed(delta, position, _id, event);
151+
if (planeId !== OrthoViews.TDView) {
152+
const hoveredEdgesInfo = getClosestHoveredBoundingBox(position, planeId);
153+
if (hoveredEdgesInfo) {
154+
const [primaryEdge] = hoveredEdgesInfo;
155+
getSceneController().highlightUserBoundingBox(primaryEdge.boxId);
156+
} else {
157+
getSceneController().highlightUserBoundingBox(null);
158+
}
159+
}
160+
},
146161
out: () => {
147162
MoveHandlers.setMousePosition(null);
148163
},

frontend/javascripts/oxalis/view/context_menu.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ import {
128128
ensureLayerMappingsAreLoadedAction,
129129
ensureSegmentIndexIsLoadedAction,
130130
} from "oxalis/model/actions/dataset_actions";
131-
import { hideContextMenuAction } from "oxalis/model/actions/ui_actions";
131+
import { hideContextMenuAction, setActiveUserBoundingBoxId } from "oxalis/model/actions/ui_actions";
132132
import { getDisabledInfoForTools } from "oxalis/model/accessors/tool_accessor";
133133
import FastTooltip from "components/fast_tooltip";
134134

@@ -834,6 +834,11 @@ function getBoundingBoxMenuOptions({
834834

835835
return [
836836
newBoundingBoxMenuItem,
837+
{
838+
key: "focus-in-bbox-tab",
839+
label: "Focus in Bounding Box Tab",
840+
onClick: () => Store.dispatch(setActiveUserBoundingBoxId(hoveredBBox.id)),
841+
},
837842
{
838843
key: "change-bounding-box-name",
839844
label: (

0 commit comments

Comments
 (0)