Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 15 additions & 22 deletions src/ProcessBus.App.Wpf/Controls/WaveformPanelControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
return new Size(Math.Max(480, width), Math.Max(320, height));
}

protected override void OnRender(DrawingContext dc)

Check warning on line 158 in src/ProcessBus.App.Wpf/Controls/WaveformPanelControl.cs

View workflow job for this annotation

GitHub Actions / Build verified Windows x64 candidate

In member void WaveformPanelControl.OnRender(DrawingContext dc), change parameter name dc to drawingContext in order to match the identifier as it has been declared in void UIElement.OnRender(DrawingContext drawingContext) (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1725)
{
base.OnRender(dc);

Expand All @@ -174,9 +174,9 @@

var visibleLanes = new List<LaneDefinition>(2);
if (showVoltage)
visibleLanes.Add(new LaneDefinition("Voltage", snapshot.VoltageSeries.FirstOrDefault()?.Unit ?? "counts", snapshot.VoltageSeries));

Check warning on line 177 in src/ProcessBus.App.Wpf/Controls/WaveformPanelControl.cs

View workflow job for this annotation

GitHub Actions / Build verified Windows x64 candidate

Do not use Enumerable methods on indexable collections. Instead use the collection directly. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1826)
if (showCurrent)
visibleLanes.Add(new LaneDefinition("Current", snapshot.CurrentSeries.FirstOrDefault()?.Unit ?? "counts", snapshot.CurrentSeries));

Check warning on line 179 in src/ProcessBus.App.Wpf/Controls/WaveformPanelControl.cs

View workflow job for this annotation

GitHub Actions / Build verified Windows x64 candidate

Do not use Enumerable methods on indexable collections. Instead use the collection directly. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1826)

if (visibleLanes.Count == 0)
{
Expand Down Expand Up @@ -214,11 +214,17 @@
var amplitudeMax = ResolveLaneAmplitudeMax(lane, laneSeries);

dc.DrawText(CreateText(lane.Title, 13, TitleBrush, TitleTypeface), new Point(rect.Left + 12, rect.Top + 7));
// Shape quality is reported once in the main scope header. Repeating it inside
// both lanes and the footer created visual noise during harmonic tests.
dc.DrawText(
CreateText($"+/-{amplitudeMax:0.#} {lane.Unit}", 11, LabelBrush, LabelTypeface),
new Point(rect.Right - 104, rect.Top + 8));
// Stable header legend, not badges covering the trace. Samples remain
// geometrically unmodified and every phase retains its color identity.
var legendX = rect.Left + 103;
foreach (var visible in laneSeries)
{
var legend = CreateText(visible.Name, 10.5, LabelBrush, LabelTypeface);
dc.DrawEllipse(GetSeriesBrush(visible.Name), null,
new Point(legendX, rect.Top + 15), 3.5, 3.5);
dc.DrawText(legend, new Point(legendX + 7, rect.Top + 7));
legendX += legend.Width + 25;
}

DrawGrid(dc, innerRect);
DrawYAxisScale(dc, innerRect, amplitudeMax, lane.Unit);
Expand All @@ -233,9 +239,9 @@
for (var index = 0; index < laneSeries.Count; index++)
DrawSeries(dc, innerRect, laneSeries[index], amplitudeMax, stacked, index, laneSeries.Count);

// Cursor overlay is expensive during repaint/resize.
// Re-enable later with cached text layout.
if (MarkersEnabled)
// Inspection overlay is interactive only: never obstruct live curves
// with a permanent cursor/tooltip when the operator is not inspecting.
if (MarkersEnabled && _isDraggingCursor)
DrawCursor(dc, innerRect, laneSeries, amplitudeMax, stacked, snapshot);

DrawTimebaseLabel(dc, innerRect, snapshot);
Expand Down Expand Up @@ -703,20 +709,6 @@
dc.DrawGeometry(null, pens.Shadow, geometry);
dc.DrawGeometry(null, pens.Main, geometry);

// cleaner label badge at right side
var labelY = GetLastY(rect, series.Samples, amplitudeMax, stacked, index, totalSeries) - 9;
var labelText = CreateText(series.Name, 11, brush, TitleTypeface);
var badge = new Rect(rect.Right - 43, labelY - 3, 38, labelText.Height + 6);

dc.DrawRoundedRectangle(CloneBrushOpacity(brush, series.HasShapeDistortion ? 0.24 : 0.12), null, badge, 7, 7);
dc.DrawText(labelText, new Point(badge.Left + 8, badge.Top + 3));

if (series.HasShapeDistortion)
{
var marker = new Rect(badge.Left - 18, badge.Top + 1, 14, 14);
dc.DrawRoundedRectangle(CloneBrushOpacity(ShapeAlertBrush, 0.24), null, marker, 7, 7);
dc.DrawText(CreateText("!", 10.5, ShapeAlertBrush, TitleTypeface), new Point(marker.Left + 4.2, marker.Top - 0.5));
}
}

private static void DrawLaneShapeBadge(DrawingContext dc, Rect rect, IReadOnlyList<WaveformSeriesModel> series)
Expand Down Expand Up @@ -1051,6 +1043,7 @@

_isDraggingCursor = false;
ReleaseMouseCapture();
InvalidateVisual();
e.Handled = true;
}

Expand Down
Loading
Loading