Skip to content

v0.6.0 UI6-C6 partial: spectrum hover readout (Hz + dB) - #16

Open
SeamusMullan wants to merge 1 commit into
v0.6.0/ui6-m2-resizefrom
v0.6.0/ui6-c6-hover-readout
Open

v0.6.0 UI6-C6 partial: spectrum hover readout (Hz + dB)#16
SeamusMullan wants to merge 1 commit into
v0.6.0/ui6-m2-resizefrom
v0.6.0/ui6-c6-hover-readout

Conversation

@SeamusMullan

Copy link
Copy Markdown
Member

Summary

Partial UI6-C6 — the spectrum already had draggable crossover handles and per-band threshold-line drag from v0.5.0 work. What was missing for the "direct manipulation surface" feel: an in-context readout of where the cursor sits in frequency / dB.

This PR adds:

  • hoverValid / hoverHz / hoverDb / hoverPos state in SpectrumVisualizer.
  • mouseMove fills them when the cursor is inside the plot area and triggers a repaint; mouseExit clears them.
  • paint() draws a small rounded-rect readout near the cursor with the Hz value (auto kHz above 1 kHz) and the dB value with sign, positioned so it does not run off the right edge or sit under the cursor.

Still deferred for UI6-C6 / scoped for v0.6.1

  • Per-band gain-reduction overlay — needs a per-band reduction aggregate that fetchSpectralVisualData() does not expose; either a small DSP plumbing change or a post-fetch averaging pass in the visualiser.
  • Threshold-line snap to dB grid — current drag is continuous; snap modifier would be 1-line addition once GR overlay lands.

Refs v0.6.0-threshold.md UI6-C6.

Dependencies

Test plan

  • cmake --build build --target BandGate_VST3 succeeds.
  • Open the editor, hover over the spectrum — confirm Hz + dB readout follows the cursor.
  • Move the cursor near the right edge — readout should flip to the left of the cursor instead of running off-screen.
  • Move the cursor near the top edge — readout should flip below the cursor.
  • Move the cursor out of the plot — readout should disappear.

🤖 Generated with Claude Code

UI6-C6 partial — the spectrum already had draggable crossover handles
and per-band threshold-line drag (mouseDown / mouseDrag). What was
missing for "direct manipulation" feel: an in-context readout of where
the cursor actually sits in frequency / dB.

This commit adds:
- hoverValid / hoverHz / hoverDb / hoverPos state in SpectrumVisualizer
- mouseMove fills them when the cursor is inside the plot area and
  repaints; mouseExit clears them and repaints
- paint() draws a small rounded-rect readout near the cursor with the
  Hz value (auto kHz above 1 kHz) and the dB value with sign, placed so
  it does not run off the right edge or sit under the cursor itself

Per-band gain-reduction overlay still pending — needs a per-band reduction
aggregate that the existing fetchSpectralVisualData() does not expose;
deferred to v0.6.1.

Refs v0.6.0-threshold.md UI6-C6.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 25, 2026 18:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an in-context hover readout to the spectrum plot so users can see the cursor’s frequency (Hz/kHz) and dB value directly on the visualization, supporting the UI6-C6 “direct manipulation surface” goal.

Changes:

  • Added hover state (hoverValid, hoverHz, hoverDb, hoverPos) to SpectrumVisualizer.
  • Updated mouseMove/mouseExit to populate/clear hover state.
  • Updated paint() to render a small rounded readout box near the cursor with edge-aware positioning.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
source/SpectrumVisualizer.h Adds stored hover state for the cursor readout.
source/SpectrumVisualizer.cpp Computes hover readout values on mouse movement and draws the Hz/dB overlay in paint().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 755 to +765
setMouseCursor (juce::MouseCursor::NormalCursor);

// UI6-C6: record cursor freq + dB so paint() can render a readout near it.
if (plot.contains (juce::Point<float> (mx, my)))
{
hoverValid = true;
hoverPos = e.position.toInt();
hoverHz = xToHz (mx, kFreqPlotMinHz, fMax, plot);
hoverDb = yToDb (my, plot, dbFloor, dbCeil);
repaint();
}
Comment on lines 773 to +780
void SpectrumVisualizer::mouseExit (const juce::MouseEvent&)
{
setMouseCursor (juce::MouseCursor::NormalCursor);
if (hoverValid)
{
hoverValid = false;
repaint();
}
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