From e010d15042eb62437d011443b5f3cc44949b058f Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Wed, 18 Apr 2018 17:40:40 -0700 Subject: [PATCH] Improved extruder help --- ApplicationView/ApplicationController.cs | 2 +- SetupWizard/HelpSystemManager.cs | 36 ++++++++++++++++++------ 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/ApplicationView/ApplicationController.cs b/ApplicationView/ApplicationController.cs index 9bc127e8f..9fec1aee5 100644 --- a/ApplicationView/ApplicationController.cs +++ b/ApplicationView/ApplicationController.cs @@ -958,7 +958,7 @@ namespace MatterHackers.MatterControl + " • " + "Select Material".Localize() + "\n" + " • " + "Set Temperature".Localize() + "\n" + " • " + "Move Print Head".Localize() + "\n" - + " • " + "Load and Unload Filament".Localize() + "\n"; + + " • " + "Load and Unload Filament".Localize(); HelpSystemManager.Instance.ShowTip(AppContext.RootSystemWindow, widgetName, extruder0TipMessage); UserSettings.Instance.set(UserSettingsKey.DisplayedTip_LoadFilament, "1"); diff --git a/SetupWizard/HelpSystemManager.cs b/SetupWizard/HelpSystemManager.cs index ccd0555ba..8dc877daa 100644 --- a/SetupWizard/HelpSystemManager.cs +++ b/SetupWizard/HelpSystemManager.cs @@ -43,6 +43,7 @@ namespace MatterHackers.MatterControl.SetupWizard private bool DoneAnimating => animationRatio >= 1; private GuiWidget target; private string message; + bool addedDescription = false; Animation showAnimation; public HelpOverlay(GuiWidget target, string message) @@ -111,18 +112,37 @@ namespace MatterHackers.MatterControl.SetupWizard graphics2D.Render(dimRegion, backgroundColor); - BorderDouble margin = new BorderDouble(5); + BorderDouble margin = new BorderDouble(10); - if (ratio >= 1) + if (ratio >= 1 + && !addedDescription) { - TypeFacePrinter stringPrinter = new TypeFacePrinter(message); - var textBounds = stringPrinter.GetBounds(); + addedDescription = true; + UiThread.RunOnIdle(() => + { + CloseAllChildren(); - var translated = new VertexSourceApplyTransform(stringPrinter, - Affine.NewTranslation(childBounds.Right - textBounds.Width - margin.Right, - childBounds.Bottom - stringPrinter.TypeFaceStyle.AscentInPixels - margin.Top));// - textBounds.Height)); + var text = new TextWidget(message) + { + HAnchor = HAnchor.Center, + VAnchor = VAnchor.Center, + TextColor = Color.White + }; - graphics2D.Render(translated, Color.White); + var child = new GuiWidget(text.Width + margin.Width, text.Height + margin.Height); + + child.AddChild(text); + + child.Position = new VectorMath.Vector2(childBounds.Right - child.Width, + childBounds.Bottom - child.Height - margin.Top); + + child.BeforeDraw += (s, e) => + { + e.Graphics2D.Render(new RoundedRect(child.LocalBounds, 5), Color.Black); + }; + + AddChild(child); + }); } base.OnDraw(graphics2D);