-
Notifications
You must be signed in to change notification settings - Fork 63
Fix Overview crosshair disappearing after tab switches / layout passes #864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,6 @@ internal sealed class CorrelatedCrosshairManager : IDisposable | |
| private readonly Popup _tooltip; | ||
| private readonly TextBlock _tooltipText; | ||
| private DateTime _lastUpdate; | ||
| private bool _isRefreshing; | ||
|
|
||
| public CorrelatedCrosshairManager() | ||
| { | ||
|
|
@@ -144,10 +143,11 @@ public void SetComparisonLabel(string label) | |
|
|
||
| /// <summary> | ||
| /// Clears data and VLines. Call before re-populating charts. | ||
| /// The OnMouseMove guard relies on lane.VLine == null to detect "not ready", | ||
| /// so this is self-healing: once ReattachVLines runs, crosshairs resume. | ||
| /// </summary> | ||
| public void PrepareForRefresh() | ||
| { | ||
| _isRefreshing = true; | ||
| _tooltip.IsOpen = false; | ||
| _comparisonLabel = null; | ||
| foreach (var lane in _lanes) | ||
|
|
@@ -162,25 +162,54 @@ public void PrepareForRefresh() | |
|
|
||
| /// <summary> | ||
| /// Creates fresh VLine plottables on each lane's chart. | ||
| /// Must be called AFTER chart data is populated. | ||
| /// Must be called AFTER chart data is populated. Safe to call in a finally | ||
| /// block — if chart state is invalid, a failure on one lane won't prevent | ||
| /// the others from recovering. | ||
| /// </summary> | ||
| public void ReattachVLines() | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Heads-up: after removing the Generated by Claude Code |
||
| { | ||
| foreach (var lane in _lanes) | ||
| { | ||
| var vline = lane.Chart.Plot.Add.VerticalLine(0); | ||
| lane.VLine = CreateVLine(lane.Chart); | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Creates VLines only for lanes that don't already have one. Idempotent — | ||
| /// safe to call from a finally block as a recovery path after an exception | ||
| /// in the main refresh flow. | ||
| /// </summary> | ||
| public void EnsureVLinesAttached() | ||
| { | ||
| foreach (var lane in _lanes) | ||
| { | ||
| if (lane.VLine != null) continue; | ||
| lane.VLine = CreateVLine(lane.Chart); | ||
| } | ||
| } | ||
|
|
||
| private static ScottPlot.Plottables.VerticalLine? CreateVLine(ScottPlot.WPF.WpfPlot chart) | ||
| { | ||
| try | ||
| { | ||
| var vline = chart.Plot.Add.VerticalLine(0); | ||
| vline.Color = ScottPlot.Color.FromHex("#FFFFFF").WithAlpha(100); | ||
| vline.LineWidth = 1; | ||
| vline.LinePattern = ScottPlot.LinePattern.Dashed; | ||
| vline.IsVisible = false; | ||
| lane.VLine = vline; | ||
| return vline; | ||
| } | ||
| catch | ||
| { | ||
| /* If attach fails, return null so OnMouseMove skips this lane. | ||
| Next refresh will try again. */ | ||
| return null; | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Silent catch-all. Everywhere else in Generated by Claude Code |
||
| } | ||
| _isRefreshing = false; | ||
| } | ||
|
|
||
| private void OnMouseMove(LaneInfo sourceLane, MouseEventArgs e) | ||
| { | ||
| if (_isRefreshing || sourceLane.VLine == null) return; | ||
| if (sourceLane.VLine == null) return; | ||
|
|
||
| var now = DateTime.UtcNow; | ||
| if ((now - _lastUpdate).TotalMilliseconds < 16) return; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,6 @@ internal sealed class CorrelatedCrosshairManager : IDisposable | |
| private readonly Popup _tooltip; | ||
| private readonly TextBlock _tooltipText; | ||
| private DateTime _lastUpdate; | ||
| private bool _isRefreshing; | ||
|
|
||
| public CorrelatedCrosshairManager() | ||
| { | ||
|
|
@@ -144,10 +143,11 @@ public void SetComparisonLabel(string label) | |
|
|
||
| /// <summary> | ||
| /// Clears data and VLines. Call before re-populating charts. | ||
| /// The OnMouseMove guard relies on lane.VLine == null to detect "not ready", | ||
| /// so this is self-healing: once ReattachVLines runs, crosshairs resume. | ||
| /// </summary> | ||
| public void PrepareForRefresh() | ||
| { | ||
| _isRefreshing = true; | ||
| _tooltip.IsOpen = false; | ||
| _comparisonLabel = null; | ||
| foreach (var lane in _lanes) | ||
|
|
@@ -162,25 +162,54 @@ public void PrepareForRefresh() | |
|
|
||
| /// <summary> | ||
| /// Creates fresh VLine plottables on each lane's chart. | ||
| /// Must be called AFTER chart data is populated. | ||
| /// Must be called AFTER chart data is populated. Safe to call in a finally | ||
| /// block — if chart state is invalid, a failure on one lane won't prevent | ||
| /// the others from recovering. | ||
| /// </summary> | ||
| public void ReattachVLines() | ||
| { | ||
| foreach (var lane in _lanes) | ||
| { | ||
| var vline = lane.Chart.Plot.Add.VerticalLine(0); | ||
| lane.VLine = CreateVLine(lane.Chart); | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Creates VLines only for lanes that don't already have one. Idempotent — | ||
| /// safe to call from a finally block as a recovery path after an exception | ||
| /// in the main refresh flow. | ||
| /// </summary> | ||
| public void EnsureVLinesAttached() | ||
| { | ||
| foreach (var lane in _lanes) | ||
| { | ||
| if (lane.VLine != null) continue; | ||
| lane.VLine = CreateVLine(lane.Chart); | ||
| } | ||
| } | ||
|
|
||
| private static ScottPlot.Plottables.VerticalLine? CreateVLine(ScottPlot.WPF.WpfPlot chart) | ||
| { | ||
| try | ||
| { | ||
| var vline = chart.Plot.Add.VerticalLine(0); | ||
| vline.Color = ScottPlot.Color.FromHex("#FFFFFF").WithAlpha(100); | ||
| vline.LineWidth = 1; | ||
| vline.LinePattern = ScottPlot.LinePattern.Dashed; | ||
| vline.IsVisible = false; | ||
| lane.VLine = vline; | ||
| return vline; | ||
| } | ||
| catch | ||
| { | ||
| /* If attach fails, return null so OnMouseMove skips this lane. | ||
| Next refresh will try again. */ | ||
| return null; | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same silent-catch issue as the Dashboard copy. Kept in sync, but fix belongs in both — log the exception instead of swallowing it. A VLine attach failure here is invisible except as a missing crosshair. Generated by Claude Code |
||
| } | ||
| _isRefreshing = false; | ||
| } | ||
|
|
||
| private void OnMouseMove(LaneInfo sourceLane, MouseEventArgs e) | ||
| { | ||
| if (_isRefreshing || sourceLane.VLine == null) return; | ||
| if (sourceLane.VLine == null) return; | ||
|
|
||
| var now = DateTime.UtcNow; | ||
| if ((now - _lastUpdate).TotalMilliseconds < 16) return; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The body of this
try(lines 80-239) is not re-indented and there's a stray blank line at 79. Compiles fine, but the raw file now has ~160 lines sitting at outer-method indent inside atryblock, which will confuse anyone reading the file without a diff view. I get that leaving it un-indented minimizes this diff — worth a follow-up tidy-up commit to re-indent the block so future readers don't do a double-take.Generated by Claude Code