Don't redraw on auto rotation if we have not done a draw since last invalidate.
This commit is contained in:
parent
5a3c8ffcc9
commit
caa660fc22
1 changed files with 5 additions and 1 deletions
|
|
@ -224,6 +224,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||||
|
|
||||||
public override void OnDraw(Graphics2D graphics2D)
|
public override void OnDraw(Graphics2D graphics2D)
|
||||||
{
|
{
|
||||||
|
hasDrawn = true;
|
||||||
base.OnDraw(graphics2D);
|
base.OnDraw(graphics2D);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -439,6 +440,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||||
UiThread.RunOnIdle(AutoSpin);
|
UiThread.RunOnIdle(AutoSpin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasDrawn = false;
|
||||||
Stopwatch timeSinceLastSpin = new Stopwatch();
|
Stopwatch timeSinceLastSpin = new Stopwatch();
|
||||||
void AutoSpin(object state)
|
void AutoSpin(object state)
|
||||||
{
|
{
|
||||||
|
|
@ -447,8 +449,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||||
// add it back in to keep it running.
|
// add it back in to keep it running.
|
||||||
UiThread.RunOnIdle(AutoSpin);
|
UiThread.RunOnIdle(AutoSpin);
|
||||||
|
|
||||||
if (!timeSinceLastSpin.IsRunning || timeSinceLastSpin.ElapsedMilliseconds > 50)
|
if ((!timeSinceLastSpin.IsRunning || timeSinceLastSpin.ElapsedMilliseconds > 50)
|
||||||
|
&& hasDrawn)
|
||||||
{
|
{
|
||||||
|
hasDrawn = false;
|
||||||
timeSinceLastSpin.Restart();
|
timeSinceLastSpin.Restart();
|
||||||
|
|
||||||
Quaternion currentRotation = meshViewerWidget.TrackballTumbleWidget.TrackBallController.CurrentRotation.GetRotation();
|
Quaternion currentRotation = meshViewerWidget.TrackballTumbleWidget.TrackBallController.CurrentRotation.GetRotation();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue