GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Cursor tool by kushalkolar · Pull Request #608 · fastplotlib/fastplotlib

Conversation

@kushalkolar

@kushalkolar kushalkolar commented Sep 17, 2024

Copy link
Copy Markdown
Member

Make it possible to easily use the cursor to point at the same positions w.r.t. world space across subplots

Idea: when added to a subplot, a new world object is created and added to that subplot. All the world objects across the various subplots use the same buffer.

WIP

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kushalkolar
start crosshair tool
4c5bfc8
@kushalkolar kushalkolar mentioned this pull request Sep 20, 2024
Cursor image control pygfx/wgpu-py#595
Closed
@kushalkolar

kushalkolar commented Sep 21, 2024

Copy link
Copy Markdown
Member Author

It would be useful to add crosshairs to multiple graphics in a subplot, in this case it can use the bbox of a graphic as the reference space that it lives in. This is particularly useful when adding multiple images to a subplot in a grid.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kushalkolar

kushalkolar commented Sep 26, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

I think I have some better ideas on this after playing with using a scatter dot.

  1. Allow adding a Cursor to subplots or Graphics
  2. The cursor's current "source" position is where the pointer currently is. Either the subplot or the graphic the pointer is on.
  3. When added to graphics, the cursor's current "source" position is based on the graphic the mouse pointer is currently on. When added to a graphic the cursor's data is always in the same space as the parent graphic's data, i.e. Cursor.data maps directly to Graphic.data. The offset of an individual cursor matches the offset of the graphic is is on top of. To map from the source graphic to other graphics, just do linear transform, I think this will work:
# w_source, h_source and width and height of source graphic bbox
# w_target, h_target are width and height of target graphic bbox

A = np.array([
    [w_target / w_source, 0],
    [0, h_target / h_source],
])

u = [source_x, source_y]

target_pos = A @ u

Allowing an arbitrary non-linear transform could also be useful for some visualizations, so allow setting an arbitrary function as a transform.

If the Cursor has a permanent set parent graphic, an inverse transform could also be useful and settable!

  1. Allow a cursor to be a scatter point of any shape, one line, or two lines. If a line, then the endpoints are based on the bbox of the graphic or the subplot's extents.

  2. When calling target graphics, know what the source graphic was to prevent the source graphic from also becoming a target during that "event call cycle". Could happen if bbox of graphics overlap.

  3. When a graphic is deleted, remove it from the cursor list.

  4. Have modes, for example to allow double click to "add a marker" that sticks in that location.

  5. Let the source graphic either be dynamic (i.e. based on current mouse pointer position), or fixed so it only responds to a fixed source graphic.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kushalkolar kushalkolar changed the title crosshair tool Cursor tool Sep 26, 2024
@kushalkolar

kushalkolar commented Sep 28, 2024

Copy link
Copy Markdown
Member Author

@hmaarrfk, thought you might be interested too, outline of what I'm going to implement is above

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hmaarrfk

hmaarrfk commented Sep 28, 2024

Copy link
Copy Markdown
Contributor

interesting work!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kushalkolar

kushalkolar commented Oct 18, 2024

Copy link
Copy Markdown
Member Author

superseeded by #662

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kushalkolar kushalkolar closed this Oct 18, 2024
@kushalkolar
kushalkolar deleted the crosshair branch November 20, 2025 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@clewis7 clewis7 Awaiting requested review from clewis7 clewis7 will be requested when the pull request is marked ready for review clewis7 is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@kushalkolar @hmaarrfk
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.