Can't select/click a 2D primitive without also selecting underlying image
When I hover a 2D primitive, like a box or a point, I expect only to hover that thing, not also all images under it.
Affects 2D spatial views, and maybe 3D ones too.
This is probably related to draw order and depth offsets.
The offending code is this:
https://github.com/rerun-io/rerun/blob/9b0c4a22834fe6679dc92773efcdad59927815d9/crates/re_space_view_spatial/src/picking.rs#L144-L146
There is no motivation for the behavior in the code, but the blame points to
- https://github.com/rerun-io/rerun/pull/1908
Which was created to fix
- https://github.com/rerun-io/rerun/issues/1885
I don't actually agree with this expectation. If I run an object detector on an image, the edges of the bounding boxes are the most interesting parts of the image to inspect. If we only hover one thing at a time, it makes it super hard to look closely at around those borders. We used to have it that we only hovered one entity at a time but changed that because it made it really hard to debug for instance detections on images
I can understand it for hovering, but for clicking it becomes quite confusing, and will become even more confusing when we have solid primitives. Say you click the middle of a solid-filled rectangle. Then you see an image in the selection view. WTH!?
In either case, I suggest we don't close this until we explain in the code (and maybe in the UI) that this behavior is intentional.
Fair enough. I think it would be pretty reasonable for clicking to just select the topmost thing but hovering going all the way through
I suggest we bite the bullet and roll a heuristic-y approach here.
-
For hover, don't change the current behaviour (aka everything that's under the mouse gets highlighted).
-
For click/cmd-click:
- if the picked items are all image-like, select them all
- if the picked items are a mix of image-like and primitive-like (point, line, etc.), ignore the image-like ones and select only the primitive-like ones