fix(v1.6.36): smooth COMTRADE scrub presentation at display cadence - #315
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0cea3d38a2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| var now = Stopwatch.GetTimestamp(); | ||
| _lastPresentationTimestamp = now; | ||
| _presentationAnimationStartedTimestamp = now; | ||
| if (_presentationRenderingHooked) return; |
There was a problem hiding this comment.
Preserve the frame timestamp when retargeting
During the checked live-scrub path in ComtradeWorkspaceWindow.P1D4LiveScrub.cs, native results can arrive between composition frames; every such result calls this method and overwrites _lastPresentationTimestamp before the already-hooked guard, so the next frame eases only for the small result-to-frame interval rather than the full frame interval. If results repeatedly arrive shortly before rendering, the vectors barely advance while dragging and then visibly catch up after release, defeating the display-cadence smoothing. Initialize the frame timestamp only when attaching the handler (while still restarting the settle deadline for a new target), and apply the same correction to ComtradeHarmonicsWorkstationView.StartPresentationAnimation.
AGENTS.md reference: AGENTS.md:L103-L106
Useful? React with 👍 / 👎.
| _smoothedSpectra = CloneSpectra(_targetSpectra); | ||
| StopPresentationAnimation(); | ||
| } | ||
| RefreshPreparedSpectra(); |
There was a problem hiding this comment.
Reuse prepared harmonic presentation assets across frames
For the supported eight-channel overview, every composition tick calls RefreshPreparedSpectra, which rebuilds all plot-bin arrays, formatted labels, and two frozen brushes per channel, while SmoothSpectra also allocates a new record for every native bin. A continuously retargeted scrub therefore creates thousands of UI-thread objects per second and moves the normalization/formatting work that this class previously performed once per native result into the 60 Hz frame path, introducing avoidable GC and frame-time pressure in the exact interaction this change is intended to smooth. Cache the static row assets and update only the animated numeric state or otherwise reuse the per-frame buffers.
AGENTS.md reference: AGENTS.md:L133-L135
Useful? React with 👍 / 👎.
Scope
Narrow continuation from exact qualified v1.6.36 head
4f5c2742f978a0ccc9be426c0ff15e468eba28c9.The previous analyzer easing advanced only when a new native analysis result arrived, so sparse/irregular native cadence could still look stepped while scrubbing. This PR keeps cursor/native analysis exact and immediate, but animates only the derived Phasor/Harmonics presentation toward the latest native target on WPF composition frames.
Phasor
CompositionTarget.Rendering.Harmonics
Interaction/performance invariants
DispatcherTimerand no per-vector/per-channel timers.Unloadedand after settling.Regression protection
Adds
ComtradePresentationAnimationRegressionTeststo lock the composition-driven presentation contract and preserve the existing latest-wins native scrub scheduler.Changed source relative to exact qualified base: only
Controls/ComtradePhasorView.cs,Controls/ComtradeHarmonicsWorkstationView.cs, and the new regression test.