Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tooltips to blocks #4380

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bjarthur
Copy link
Contributor

Adds tooltips to Textboxes which appear on hover.

Screenshot 2024-09-18 at 6 26 13 PM

sadly, despite specifying overdraw=true to tooltip!, they sometimes appear behind other blocks. see for yourself by executing the code below and hovering over tb21. will this be fixed by #4150? is there a workaround in the meantime?

using GLMakie
f = Figure()
tb11 = Textbox(f[1,1], tooltip_text="hi\nthere", tooltip_enable=true, tooltip_placement=:below)
tb21 = Textbox(f[2,1], tooltip_text="okay\nhere", tooltip_enable=true, tooltip_placement=:below)
m31 = Menu(f[3,1], options = ["a", "b", "c"], default = "a")
m32 = Menu(f[3,2], options = ["a", "b", "c"], default = "a")
tb22 = Textbox(f[2,2], tooltip_text="okay\nhere", tooltip_enable=true, tooltip_placement=:below)
tb12 = Textbox(f[1,2], tooltip_text="hi\nthere", tooltip_enable=true, tooltip_placement=:below)
  • New feature (non-breaking change which adds functionality)

Checklist

  • Added an entry in CHANGELOG.md (for new features and breaking changes)
  • Added or changed relevant sections in the documentation
  • Added unit tests for new algorithms, conversion methods, etc.
  • Added reference image tests for new plotting functions, recipes, visual options, etc.

@jkrumbiegel
Copy link
Member

My first reaction is that it feels like this should maybe be something that is implemented between DataInspector and Blocks in general, instead of adding these attributes to Textbox itself? In principle, anything should be "tooltip-able", not just textbox, but it would be a lot of work adding this to every Block manually. @ffreyer do you think DataInspector would lend itself to this at all? I haven't really used it myself.

@bjarthur
Copy link
Contributor Author

bjarthur commented Oct 1, 2024

thanks for the comments @jkrumbiegel. as it happens, since submitting the initial PR i have added tooltips in a similar fashion to many other blocks. just pushed these changes. i'd happily consider a more generic way as you describe if possible.

i'm still not able to consistently get the tooltips to render on top of everything though. that's my main concern.

@bjarthur bjarthur changed the title add tooltips to Textboxes add tooltips to blocks Oct 1, 2024
@jkrumbiegel
Copy link
Member

What I was thinking about was more like a tooltip!(block) function that adds this thing on an existing Block, maybe determining the area of interest via layoutobservables.computedbbox or some other rectangle / area that's specific to that type. If we really want to add these parameters to every Block instead (I'm not sure if we do) we should modify the @Block macro instead so they'd be added by default without having to be repeated everywhere.

@ffreyer
Copy link
Collaborator

ffreyer commented Oct 1, 2024

DataInspector doesn't know about Blocks and blocks aren't reachable from a plot afaik. We could have blocks attach tooltip information to a scene and have DataInspector go up to parent_scene(picked_plot) instead. That would take priority over plto tooltips though. Not sure if that's a good idea...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Work in progress
Development

Successfully merging this pull request may close these issues.

3 participants