Improving measure tool render

This commit is contained in:
LarsBrubaker 2021-04-21 08:44:07 -07:00
parent 6eefe80286
commit c2dfccf6b0
4 changed files with 31 additions and 18 deletions

View file

@ -177,6 +177,8 @@ namespace MatterHackers.MatterControl.DesignTools
return Task.CompletedTask;
}
private double width = 200 * GuiWidget.DeviceScale;
public void DrawEditor(Object3DControlsLayer controlLayer, List<Object3DView> transparentMeshes, DrawEventArgs e)
{
var start = PositionHasBeenSet ? StartPosition : StartPosition.Transform(Matrix);
@ -194,7 +196,7 @@ namespace MatterHackers.MatterControl.DesignTools
if (markdownWidget.Markdown != descrpition)
{
markdownWidget.Markdown = descrpition;
markdownWidget.Width = 100 * GuiWidget.DeviceScale;
markdownWidget.Width = width * GuiWidget.DeviceScale;
}
var pos = screenStart;
@ -221,7 +223,6 @@ namespace MatterHackers.MatterControl.DesignTools
if (markdownWidget == null)
{
var theme = ApplicationController.Instance.MenuTheme;
var width = 200 * GuiWidget.DeviceScale;
markdownWidget = new MarkdownWidget(theme, true)
{
HAnchor = HAnchor.Absolute,

View file

@ -214,23 +214,24 @@ namespace MatterHackers.MatterControl.DesignTools
if (numberWidget == null)
{
var theme = ApplicationController.Instance.MenuTheme;
numberWidget = new TextWidget(Distance.ToString("0.##"))
numberWidget = new GuiWidget()
{
HAnchor = HAnchor.Fit,
VAnchor = VAnchor.Fit,
Padding = 5,
BackgroundColor = theme.BackgroundColor,
BackgroundRadius = new RadiusCorners(3 * GuiWidget.DeviceScale),
BorderColor = theme.PrimaryAccentColor,
BackgroundOutlineWidth = 1,
};
numberWidget.AddChild(new TextWidget(Distance.ToString("0.##"))
{
TextColor = theme.TextColor,
PointSize = 10,
Selectable = true,
AutoExpandBoundsToText = true,
HAnchor = HAnchor.Absolute,
VAnchor = VAnchor.Fit,
Width = 200,
Height = 100,
BackgroundColor = theme.BackgroundColor,
BackgroundRadius = new RadiusCorners(3 * GuiWidget.DeviceScale),
Margin = 0,
BorderColor = theme.PrimaryAccentColor,
BackgroundOutlineWidth = 1,
Padding = 5,
};
});
controlLayer.GuiSurface.AddChild(numberWidget);

View file

@ -40,7 +40,7 @@ namespace MatterHackers.MatterControl.Library
{
public GitHubLibraryItem(string name, string url)
{
this.Name = name;
this.FileName = name;
this.Url = url;
}
@ -54,7 +54,7 @@ namespace MatterHackers.MatterControl.Library
public DateTime DateModified { get; } = DateTime.Now;
public string FileName => Name;
public string FileName { get; set; }
public long FileSize { get; private set; }
@ -68,7 +68,18 @@ namespace MatterHackers.MatterControl.Library
public virtual bool LocalContentExists => File.Exists(CachePath);
public string Name { get; set; }
public string Name
{
get
{
if (Path.GetExtension(FileName).ToLower() == ".mcx")
{
return Path.GetFileNameWithoutExtension(FileName);
}
return FileName;
}
}
public string Url { get; }

@ -1 +1 @@
Subproject commit f465ec2761f1fdc2989241402d926fe56928b20c
Subproject commit c328ee1b70f60eb9beb236b536e2024e06b65690