GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||
GeezerVison is showing github.com — cursor tool and better tooltips by kushalkolar · Pull Request #947 · fastplotlib/fastplotlib Conversation
|
|
📚 Docs preview built and uploaded! https://www.fastplotlib.org/ver/cursor-simpler |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@kushalkolar general comments to make sure everything is properly documented/commented etc.
I know you want to merge this today, besides one logic issue with the mode, it looks good to me
The other things are less critical and can be updated in another PR. I just wanted to document them. I went ahead and linted and added the doc updates so everything would pass.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
This is gonna need a bit more work. Display tooltip at corresponding location in other subplots by manually picking at that location to get the info about the graphic at that location. Basically: If system cursor is on subplot A, and we want to display tooltip at same world space location in subplot B: # system cursor over position in subplot A, get world pos pos = subplot_A.map_screen_to_world(ev) # get corresponding screen space position in subplot B x, y = subplot_B.map_world_to_screen(pos) # get pick info of this screen pixel pick = subplot.get_pick_info((x, y)) if pick is None: # no graphic at this screen pixel in subplot B tooltips2.visible = False return # display graphic metadata or anyrelevant info in the tooltip in subplot B info = pick["graphic"].metadata tooltips2.display((x, y), str(info)) manual_picking-2025-11-20_04.29.45.mp4 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@clewis7 I'm thinking about changing who "owns" tooltips. Right now Subplot.display_tooltip(pos: tuple[float, float], space: Literal["world", "screen"], info: str): ... Tooltips are drawn in the overlay render pass which is in screen space, so the tooltip position in the end always has to be in screen space. However it is useful to think of them in world space since that's where the graphics are. It'll just be much easier to know the position of a graphic in world space where you want to show the tooltip, and the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
And why would tooltips not be owned by the graphic they correspond to? I could also imagine a property that is |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I didn't think of that! This might be a better way to do it, and customization of tooltips per-graphic makes most sense I think. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I think then, if you wanted to not display all of the tooltips for graphics in the subplot, you would just need to iterate: for g in subplot.graphics: g.tooltip.display = False |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
ok all this stuff works now: tooltips update on every render, useful when data under the cursor changes: tooltips-update-2025-12-06_05.14.36.mp4Tooltips are now enabled on graphics by default, and a cursor can trigger a tooltip to show up in other subplots: cursor-tooltips-2025-12-06_05.46.04.mp4Added more mapping functions, these are explained in the guide: Need to test a bit, add some more examples maybe, and possibly cleanup some of the code if it can be simplified. Need to add tests to make sure the right default tooltip display comes up for all graphics. I should add examples that explain all the spaces (model, world, screen) using a variety of graphics. Show a few points on the graphic and put text that indicates model, world and screen space positions.
Do this with Image, Line and an ellipsoid, should be enough. @clewis7 you can take a look, but I'm guessing you're deep in CPU design optimizations for the next few days 😆 . I'll summarize everything in this PR later, required quite a bit more than I thought to get this to work. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
OK things getting slightly messy, I think this will be better:
The Perhaps the renderer |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I think things are much simpler now.
cursor-tooltips-2025-12-07_03.43.05.mp4 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
For the examples to demonstrate the different spaces I think I'll make one example for each of these (instead of separate subplots in one Figure) and two sets, one with an image and one with a line:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@clewis7 finally r4r! And just before midnight here 😂 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
There is a bug in Volume, will figure out. Edit: this is a pygfx thing, posted: pygfx/pygfx#1251 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Until pygfx/pygfx#1253 is in the next release of pygfx I've kinda disabled tooltips for |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Co-authored-by: Kushal Kolar <[email protected]>
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.