Round re-slice button

This commit is contained in:
LarsBrubaker 2021-02-25 07:16:15 -08:00
parent daa407bf83
commit 9ff23ae662
2 changed files with 20 additions and 13 deletions

View file

@ -155,22 +155,23 @@ namespace MatterHackers.MatterControl.CustomWidgets
public override void OnDrawBackground(Graphics2D graphics2D)
{
var bounds = this.LocalBounds;
bounds -= BackgroundInset;
var rect = new RoundedRect(bounds.Left, bounds.Bottom, bounds.Right, bounds.Top, RoundRadius);
if (BackgroundColor.Alpha0To255 > 0)
{
var bounds = this.LocalBounds;
bounds -= BackgroundInset;
var rect = new RoundedRect(bounds.Left, bounds.Bottom, bounds.Right, bounds.Top, RoundRadius);
graphics2D.Render(rect, BackgroundColor);
}
if (RenderOutline)
{
var stroke = 1 * GuiWidget.DeviceScale;
var expand = stroke / 2;
rect = new RoundedRect(bounds.Left + expand, bounds.Bottom + expand, bounds.Right - expand, bounds.Top - expand, RoundRadius);
var rectOutline = new Stroke(rect, stroke);
if (BorderColor.Alpha0To255 > 0 && RenderOutline)
{
var stroke = 1 * GuiWidget.DeviceScale;
var expand = stroke / 2;
rect = new RoundedRect(bounds.Left + expand, bounds.Bottom + expand, bounds.Right - expand, bounds.Top - expand, RoundRadius);
var rectOutline = new Stroke(rect, stroke);
graphics2D.Render(rectOutline, BorderColor);
}
graphics2D.Render(rectOutline, BorderColor);
}
}

View file

@ -761,12 +761,18 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
var resliceButton = new TextButton("Re-Slice", theme)
{
HAnchor = HAnchor.Right,
VAnchor = VAnchor.Center,
Margin = new BorderDouble(0, 0, 7, 0),
Padding = new BorderDouble(7, 5),
VAnchor = VAnchor.Fit | VAnchor.Center,
HAnchor = HAnchor.Fit | HAnchor.Right,
// BackgroundColor = new Color(theme.AccentMimimalOverlay, 50),
HoverColor = theme.AccentMimimalOverlay,
BorderColor = theme.TextColor,
RenderOutline = true,
Name = "Re-Slice Button",
ToolTipText = "Apply changes to this print".Localize() + "\n\n*" + "Plating and settings changes can be applied".Localize() + "*"
};
((TextButton)resliceButton).RoundRadius = resliceButton.Height / 2;
bool activelySlicing = false;
resliceButton.Click += (s, e) =>
{