Zoom the bandmap with the mouse wheel and add a Centre on VFO toggle

The wheel steps along the span list and keeps the frequency under the
pointer in place. With Centre on VFO off, the slice stays put until the
receiver nears an edge. The span and the toggle are saved in the settings.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 00:52:06 +00:00
co-authored by Claude Sonnet 5.5
parent 476844a9f0
commit 047a3612cb
7 changed files with 200 additions and 14 deletions
+15
View File
@@ -11,6 +11,8 @@ namespace Nonemm.App.Windows;
/// Draws the band: a frequency scale down the left, the receiver and
/// transmitter as bars on it, and the stations as callsigns on the right with a
/// leader line back to where each one really is.
public sealed record BandmapZoom(bool In, Frequency At);
public sealed class BandmapView : Control
{
private const double ScaleX = 52;
@@ -64,6 +66,9 @@ public sealed class BandmapView : Control
/// Clicking where no station is asks for the radio, not a callsign.
public event EventHandler<Frequency>? FrequencyPicked;
/// The wheel was turned: forward zooms in on the frequency under the pointer.
public event EventHandler<BandmapZoom>? Zoomed;
public override void Render(DrawingContext context)
{
scale = new BandmapScale(Low, High, Math.Max(1, Bounds.Height - (2 * Inset)));
@@ -152,6 +157,16 @@ public sealed class BandmapView : Control
context.DrawText(Text(label.Spot.Call.Text, colour), new Point(LabelX, label.LabelY));
}
protected override void OnPointerWheelChanged(PointerWheelEventArgs e)
{
base.OnPointerWheelChanged(e);
if (e.Delta.Y != 0)
{
Zoomed?.Invoke(this, new BandmapZoom(e.Delta.Y > 0, scale.At(e.GetPosition(this).Y - Inset)));
e.Handled = true;
}
}
protected override void OnPointerPressed(PointerPressedEventArgs e)
{
base.OnPointerPressed(e);