From c2dfccf6b05c3136092cdfe7d71fd43e643e0a05 Mon Sep 17 00:00:00 2001 From: LarsBrubaker Date: Wed, 21 Apr 2021 08:44:07 -0700 Subject: [PATCH] Improving measure tool render --- .../Primitives/DescriptionObject3D.cs | 5 ++-- .../Primitives/MeasureToolObject3D.cs | 25 ++++++++++--------- .../Providers/GitHub/GitHubLibraryItem.cs | 17 ++++++++++--- Submodules/MatterSlice | 2 +- 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/MatterControlLib/DesignTools/Primitives/DescriptionObject3D.cs b/MatterControlLib/DesignTools/Primitives/DescriptionObject3D.cs index 282e06c24..bd70ee1b3 100644 --- a/MatterControlLib/DesignTools/Primitives/DescriptionObject3D.cs +++ b/MatterControlLib/DesignTools/Primitives/DescriptionObject3D.cs @@ -177,6 +177,8 @@ namespace MatterHackers.MatterControl.DesignTools return Task.CompletedTask; } + private double width = 200 * GuiWidget.DeviceScale; + public void DrawEditor(Object3DControlsLayer controlLayer, List 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, diff --git a/MatterControlLib/DesignTools/Primitives/MeasureToolObject3D.cs b/MatterControlLib/DesignTools/Primitives/MeasureToolObject3D.cs index d42452202..aa8b94ad1 100644 --- a/MatterControlLib/DesignTools/Primitives/MeasureToolObject3D.cs +++ b/MatterControlLib/DesignTools/Primitives/MeasureToolObject3D.cs @@ -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); diff --git a/MatterControlLib/Library/Providers/GitHub/GitHubLibraryItem.cs b/MatterControlLib/Library/Providers/GitHub/GitHubLibraryItem.cs index 7907d300a..2a882ab6f 100644 --- a/MatterControlLib/Library/Providers/GitHub/GitHubLibraryItem.cs +++ b/MatterControlLib/Library/Providers/GitHub/GitHubLibraryItem.cs @@ -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; } diff --git a/Submodules/MatterSlice b/Submodules/MatterSlice index f465ec276..c328ee1b7 160000 --- a/Submodules/MatterSlice +++ b/Submodules/MatterSlice @@ -1 +1 @@ -Subproject commit f465ec2761f1fdc2989241402d926fe56928b20c +Subproject commit c328ee1b70f60eb9beb236b536e2024e06b65690