mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-27 08:21:05 -04:00
fix(desktop): keep the cut simulator moving while the plate view pans
Panning invalidates the view on every mouse move, so a paint is always pending and WM_TIMER never arrives; the torch froze until the pan ended. Paints now advance the playhead from the playback clock too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
455c543501
commit
42f1762c56
1 file changed
+14
-2
@@ -132,11 +132,21 @@ internal sealed class CutSimulationOverlay : IDisposable
|
||||
}
|
||||
|
||||
private void Tick()
|
||||
{
|
||||
Advance();
|
||||
view.Invalidate();
|
||||
}
|
||||
|
||||
// Moves the playhead by the wall time since the last advance. Paints call it too: WM_TIMER
|
||||
// is only delivered when no paint is pending, so a pan's stream of repaints starves the timer.
|
||||
private void Advance()
|
||||
{
|
||||
var elapsed = clock.Elapsed;
|
||||
clock.Restart();
|
||||
Time = time + TimeSpan.FromTicks((long)(elapsed.Ticks * Speed));
|
||||
if (simulation == null || time >= simulation.TotalTime)
|
||||
var next = time + TimeSpan.FromTicks((long)(elapsed.Ticks * Speed));
|
||||
time = next > simulation.TotalTime ? simulation.TotalTime : next;
|
||||
Changed?.Invoke(this, EventArgs.Empty);
|
||||
if (time >= simulation.TotalTime)
|
||||
Pause();
|
||||
}
|
||||
|
||||
@@ -171,6 +181,8 @@ internal sealed class CutSimulationOverlay : IDisposable
|
||||
{
|
||||
if (simulation == null || simulation.Steps.Count == 0)
|
||||
return;
|
||||
if (IsPlaying)
|
||||
Advance();
|
||||
|
||||
var state = graphics.Save();
|
||||
try
|
||||
|
||||
Reference in new issue
Block a user