Skip to content

feat: a crosshair with the values under the mouse in Point mode - #14

Merged
icyspirit merged 3 commits into
mainfrom
feat/point-crosshair
Sep 29, 2026
Merged

icyspirit merged 3 commits into
mainfrom
feat/point-crosshair

Conversation

@icyspirit

@icyspirit icyspirit commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

A crosshair in Point mode. It follows the mouse in the panel under it. A label beside it gives the values there, and dots mark where it meets the curves.

  • Time traces: the header is t = 5 s, then one row per curve with its color, e.g. ■ Ip (equilibrium) [A] = 1.
  • Profiles: the header is the coordinate, e.g. rho_tor_norm = 0.3, then one row per curve.
  • Bars: the element (e.g. PF1), then its bars, one per source.
  • Maps and time-space images: both coordinates, then the value of the image at that place.

Values:

  • They are read along the lines of the curves, on log axes too.
  • A curve that does not reach that x is left out.
  • At most ten are listed, then "… N more".

The label:

  • It keeps to the side of the cursor with more room, and stays within the plot.
  • It is drawn over the legend and the title.
  • It follows the view when the view changes (autoscale, shared x axes).
  • Its values follow the time when the time is stepped with , . while the mouse rests on a profile.
  • The crosshair goes away when the mouse leaves the plot, and in the Pan and Zoom modes.

Coordinates in the label and in the status bar:

  • They are rounded to about a thousandth of the view, so 2.2e-16 shows as 0 (and a tiny negative coordinate as 0, not -0).
  • On log axes they are the values, not their logarithms. The status bar used to show log10 of them.

Notes

  • The lines and dots are in the coordinates of the view. The label is placed in pixels, like the title, so that it can be drawn over the legend.
  • Its position is updated from the view box's sigTransformChanged. A guard skips the callback that the mapping itself can trigger.
  • Clicking or dragging in a time trace still sets the time, as before.
  • README: the Point mode bullet describes the crosshair.
  • main (with Recent sources, and files dropped on the window #13) is merged in; the only conflict was the tests both branches added at the end of tests/test_gui.py, and both are kept.

Test plan

  • QT_QPA_PLATFORM=offscreen pytest: 190 passed in the dev environment, a clean PySide6 6.11 environment and a PyQt5 5.15 environment, after merging main.
  • New tests:
    • values and dots on time traces;
    • nothing beyond the data;
    • a profile whose values follow the time;
    • the value of a map and rounded coordinates;
    • the values of bars;
    • the label within the plot, over the legend, and beside the cursor after the view changes;
    • hidden when the mouse leaves the plot (also by a Leave event) and in Pan mode;
    • log axes: values, not logarithms, in the label and the status bar;
    • the rounding itself, including 0 rather than -0 (fails without the fix).
  • Checked on screenshots of the demo: the label next to the legend of a trace, a profile, a time-space image, and a map corner.
  • pyflakes src tests reports nothing.

🤖 Generated with Claude Code

https://claude.ai/code/session_018aVekYzCRLPE71Mm6UH8Zp

In Point mode, a crosshair follows the mouse in the panel under it. A label beside
it lists the values of the curves at its x, with dots where it meets them: of a
time trace at that time, of a profile at that coordinate. Over bars it lists the
bars of the element, and over a map or a time-space image the value of the image
at that place.

- The values are along the lines of the curves, on log axes too; a curve that
  does not reach that x is left out. At most ten are listed.
- The label keeps to the side with more room, stays within the plot, and is drawn
  over the legend and the title. It follows the view when it changes, and its
  values follow the time when it is stepped with the keys.
- It goes away when the mouse leaves the plot, and in the other modes.
- The coordinates, in the label and in the status bar, are rounded to what the
  view resolves (0, not 2.2e-16), and are values on log axes, not logarithms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018aVekYzCRLPE71Mm6UH8Zp
The crosshair and the status bar round the coordinates of the mouse to what the
view resolves. A tiny negative coordinate, such as the mapping of the scene gives
for 0, was rounded to -0.0 and shown as "-0".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018aVekYzCRLPE71Mm6UH8Zp
@icyspirit
icyspirit merged commit a2fa0b7 into main Sep 29, 2026
2 checks passed
@icyspirit
icyspirit deleted the feat/point-crosshair branch September 29, 2026 22:25
icyspirit pushed a commit that referenced this pull request Sep 29, 2026
Main now has the crosshair (#14) and the device template (#15). The
crosshair gives the value of the image through Panel._image_value_at,
so it also says the value of the cell of an unstructured grid under it,
and the status bar keeps the coordinates rounded to the view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018aVekYzCRLPE71Mm6UH8Zp
icyspirit pushed a commit that referenced this pull request Sep 29, 2026
Main now has the crosshair (#14) and the device template (#15). The
crosshair reads the curves a panel draws, so with sources relative to
the first it gives B − A or B / A; a test checks it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018aVekYzCRLPE71Mm6UH8Zp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants