Center bed in parent
This commit is contained in:
parent
06dd6a9fcb
commit
1e8d2f8252
1 changed files with 17 additions and 0 deletions
|
|
@ -31,6 +31,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Transform;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Agg.VertexSource;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
|
|
@ -98,6 +99,20 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
|
||||
public override void OnDraw(Graphics2D graphics2D)
|
||||
{
|
||||
var offset = Vector2.Zero;
|
||||
|
||||
if (this.Width > this.Height)
|
||||
{
|
||||
offset.X = (this.Width / 2) - (scaledBedRect.Width / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
offset.Y = (this.Height / 2) - (scaledBedRect.Height / 2);
|
||||
}
|
||||
|
||||
graphics2D.PushTransform();
|
||||
graphics2D.SetTransform(graphics2D.GetTransform() * Affine.NewTranslation(offset));
|
||||
|
||||
graphics2D.FillRectangle(scaledBedRect, theme.SlightShade);
|
||||
graphics2D.Rectangle(scaledBedRect, lightColor);
|
||||
|
||||
|
|
@ -174,6 +189,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
}
|
||||
}
|
||||
|
||||
graphics2D.PopTransform();
|
||||
|
||||
base.OnDraw(graphics2D);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue