Sketcher: expose picked candidates when performing 2D picking/selection
- Dominant language
- C++
- Stars
- 33.6k
- Forks
- 6k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 196
Description
### Problem description
In #32255, the issue of nailing down the "best" candidate while picking 2D elements is discussed, as well as the impact of changing prioritization and regressing expectations. While investigating, the fact that there is only one candidate stood out as a key factor, as there will often be times when the system and rules simply won't resolve to what the user expects. When this occurs, the user should have at their disposal a list of objects which fell within the selection radius, so that they can refine the selection using this smaller subset of the scene graph.
### Overview
1. The picking implementation for 2D objects does not provide all pickable objects within the selection radius
2. The picking implementation for 3D objects does provide them
3. The `Selection View` panel exposes this information for 3D picking via the `Picked candidate list` and allows users to choose alternates
4. The `Picked candidate list` panel remains empty for 2D picking
### Details
There is both a native Coin picking implementation for 3D scene elements, and a custom 2D implementation for sketcher elements. In the Coin based implementation, both the ranked candidate for the click, as well as all matched elements within the selection radius are provided. This allows granular, manual selection when the hit target does not match expectations and users can work through the `Picked candidate list` to find better targets within the selection radius. This is analogous to what other tools provide (Onshape → `Select Other`) and for similar reasons. For 2D picking, only a single "best" candidate is provided and when it's not the expected/preferred object under the mouse (sometimes there are multiple), the user is forced to abandon mouse interactions and resort to the unfiltered `Constraints` and `Elements` lists in the `Tasks` panel for selection (often difficult and has a learning curve).
It seems plausible that while finding the best match in the 2D implementation that a vector could be built up for objects within the selection radius, the existing best candidate logic could remain as is, and the data to populate the `Picked candidate list` could be returned. Seemingly, this would provide consistent `Selection View` → `Picked candidate list` behavior across modes and expose alternate targets within the selection radius for improved user control. In cases where the expected item is not selected, this provides solid fallback.
### Workbench affected?
Sketcher
### Steps to reproduce
From the issue depicted in #32255
1. Create a new sketch
2. Add a circle to the sketch
3. Dimension the x-axis distance
4. Drag the dimension over the axis line
5. Click the dimension label to invoke the 2D picking implementation
### Expected behavior
Ideally, in addition to the "best" candidate, all objects lying with the selection radius should be listed in the `Picked candidate list`, so users can refine/override the "best" match determination.
### Actual behavior
Only the best match is returned, no `Picked candidate list` is presented, and there's no opportunity refine the pick. In recent builds and as depicted in #32255, when the axis line falls under the dimension label, that the axis line maybe be the "best" candidate due to stacking order. In this case, users maybe be able to click around and find a region that works, but in other cases, they must switch to manual object selection using the more complicated methods exposed in the `Tasks` panel.
### Development version About Info (in Safe Mode)
```shell
OS: Windows 11 build 26200
Architecture: x86_64
Version: 26.3.0dev.48355 (Git)
Build date: 2026/08/31 04:23:34
Build type: Release
Branch: main
Hash: 433b2b142dc89b12d20dacb92217f7378f4bbfc9
Python 3.11.14, Qt 6.8.3, Coin 4.0.10 (bundled), Pivy 0.6.11 (bundled), Vtk 9.3.0, boost 1_84, Eigen3 3.4.0, PySide 6.8.3
shiboken 6.8.3, xerces-c 3.3.0, Clipper2 , IfcOpenShell 0.0.0, OCC 7.8.1
Locale: English/United States (en_US) [ OS: English/United States (en_US) ]
Stylesheet/Theme/QtStyle: FreeCAD.qss/FreeCAD Light/
QPA/File dialog/Color dialog: windows/via Win32/via Qt
Navigation Style/Orbit Style/Rotation Mode: TinkerCAD/Rounded Arcball/Window center
Logical DPI/Physical DPI/Pixel Ratio: 96/81.6656/2
OpenGL version/vendor/renderer: 4.6.0 Compatibility Profile Context 24.30.58.08.260716/ATI Technologies Inc./AMD Radeon(TM) 880M Graphics
```
### Last known good version (optional)
```shell
```
Contributor guide
Research direction
No source files or tests are named. Start by tracing the Sketcher custom 2D picking implementation and compare it with the Coin-based 3D path that supplies the Selection View's Picked candidate list. Done means 2D picking retains the best match while exposing all objects within the selection radius for alternate selection.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics, desktop
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100