Skip to content
This repository has been archived by the owner on Jul 13, 2021. It is now read-only.

Update pick functions #696

Merged
merged 2 commits into from
May 7, 2021
Merged

Conversation

ffreyer
Copy link
Collaborator

@ffreyer ffreyer commented Apr 17, 2021

This pr ...

  • formally adds pick(scene, rect), which was already in GLMakie, but not connected and I believe not working.
  • adds pick_closest(scene, screen, xy, range) as fallback/implementation for pick(scene, xy, range).
  • adds pick_sorted(scene, screen, xy, range) to get all plots and indices in a given range of xy, sorted by distance. Required for Data inspector #677.

Requires JuliaPlots/GLMakie.jl#177.

I checked the following with a small scatter plot

  • pick(scene, pos)
  • pick(scene, pos, range) with and without overloads from GLMakie
  • pick(scene, rect)
  • pick_sorted(scene, pos, range) with and without overloads from GLMakie

This removes what pick(screen, rect) for unique(pick(scene, rect)) so it's technically a breaking change. But I think that function was broken anyway and didn't follow the usual syntax.

@ffreyer
Copy link
Collaborator Author

ffreyer commented Apr 17, 2021

With this backends need to implement:

  • pick(scene, screen, xy) -> (plot, idx) (like before)
  • pick(scene, screen, rect) -> Matrix{Tuple{AbstractPlot, Int}} (sort of new)

which is somewhat simpler than before.

They can also implement

  • pick_closest(scene, screen, xy, range) -> (plot, idx)
  • pick_sorted(scene, screen, xy, range) -> distance sorted Vector{Tuple{AbstractPlot, Int}}

if those can be done more efficiently

@SimonDanisch SimonDanisch merged commit 329dd1d into JuliaPlots:master May 7, 2021
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants