diff --git a/src/DynamoCoreWpf/UI/Converters.cs b/src/DynamoCoreWpf/UI/Converters.cs index 1f2403ad91c..00f6644861b 100644 --- a/src/DynamoCoreWpf/UI/Converters.cs +++ b/src/DynamoCoreWpf/UI/Converters.cs @@ -3294,4 +3294,48 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu throw new NotImplementedException(); } } + + /// + /// Converts a PointColletion to a Geometry so the points can be drawn using a Path + /// + [ValueConversion(typeof(PointCollection), typeof(Geometry))] + public class PointsToPathConverter : IValueConverter + { + #region IValueConverter Members + + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + if (value == null) + return null; + + if (value.GetType() != typeof(PointCollection)) + return null; + + PointCollection points = (value as PointCollection); + if (points.Count > 0) + { + Point start = points[0]; + List segments = new List(); + for (int i = 1; i < points.Count; i++) + { + segments.Add(new LineSegment(points[i], true)); + } + PathFigure figure = new PathFigure(start, segments, false); + PathGeometry geometry = new PathGeometry(); + geometry.Figures.Add(figure); + return geometry; + } + else + { + return null; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotSupportedException(); + } + + #endregion + } } \ No newline at end of file diff --git a/src/DynamoCoreWpf/UI/GuidedTour/Step.cs b/src/DynamoCoreWpf/UI/GuidedTour/Step.cs index dd686055f6f..80b169abb1b 100644 --- a/src/DynamoCoreWpf/UI/GuidedTour/Step.cs +++ b/src/DynamoCoreWpf/UI/GuidedTour/Step.cs @@ -132,6 +132,11 @@ public enum PointerDirection { TOP_RIGHT, TOP_LEFT, BOTTOM_RIGHT, BOTTOM_LEFT, B /// public PointCollection TooltipPointerPoints { get; set; } + /// + /// This will contains the shadow direction in degrees that will be shown in the pointer + /// + public double ShadowTooltipDirection { get; set; } + /// /// This property holds the DynamoViewModel that will be used when executing PreValidation functions /// diff --git a/src/DynamoCoreWpf/UI/GuidedTour/Tooltip.cs b/src/DynamoCoreWpf/UI/GuidedTour/Tooltip.cs index 7430718347d..7ffd4e56427 100644 --- a/src/DynamoCoreWpf/UI/GuidedTour/Tooltip.cs +++ b/src/DynamoCoreWpf/UI/GuidedTour/Tooltip.cs @@ -17,6 +17,7 @@ public class Tooltip : Step double PointerTooltipOverlap = 5; double PointerVerticalOffset; double PointerHorizontalOffset; + enum SHADOW_DIRECTION { LEFT = 180, RIGHT = 0, BOTTOM = 270, TOP = 90}; /// /// The Tooltip constructor @@ -71,6 +72,8 @@ private void DrawPointerDirection(PointerDirection direction) pointX3 = 0; pointY3 = PointerHeight / 2 + PointerVerticalOffset; + //Left Shadow + ShadowTooltipDirection = (double)SHADOW_DIRECTION.LEFT; } else if (direction == PointerDirection.BOTTOM_LEFT) @@ -83,6 +86,8 @@ private void DrawPointerDirection(PointerDirection direction) pointX3 = 0; pointY3 = Height - PointerHeight / 2 - PointerVerticalOffset; + //Left Shadow + ShadowTooltipDirection = (double)SHADOW_DIRECTION.LEFT; } else if (direction == PointerDirection.TOP_RIGHT) { @@ -94,6 +99,8 @@ private void DrawPointerDirection(PointerDirection direction) pointX3 = realWidth; pointY3 = PointerHeight / 2 + PointerVerticalOffset; + //Right Shadow + ShadowTooltipDirection = (double)SHADOW_DIRECTION.RIGHT; } else if (direction == PointerDirection.BOTTOM_RIGHT) @@ -106,6 +113,8 @@ private void DrawPointerDirection(PointerDirection direction) pointX3 = realWidth; pointY3 = Height - PointerHeight / 2 - PointerVerticalOffset; + //Right Shadow + ShadowTooltipDirection = (double)SHADOW_DIRECTION.RIGHT; } else if (direction == PointerDirection.BOTTOM_DOWN) { @@ -117,6 +126,8 @@ private void DrawPointerDirection(PointerDirection direction) pointX3 = PointerDownWidth / 2 + PointerHorizontalOffset; pointY3 = realHeight - PointerHeight; + //Bottom Shadow + ShadowTooltipDirection = (double)SHADOW_DIRECTION.BOTTOM; } TooltipPointerPoints = new PointCollection(new[] { new Point(pointX1, pointY1), diff --git a/src/DynamoCoreWpf/UI/Themes/Modern/DynamoModern.xaml b/src/DynamoCoreWpf/UI/Themes/Modern/DynamoModern.xaml index ea63a460cf8..ac78b09740a 100644 --- a/src/DynamoCoreWpf/UI/Themes/Modern/DynamoModern.xaml +++ b/src/DynamoCoreWpf/UI/Themes/Modern/DynamoModern.xaml @@ -4075,7 +4075,7 @@ - diff --git a/src/DynamoCoreWpf/ViewModels/GuidedTour/PopupWindowViewModel.cs b/src/DynamoCoreWpf/ViewModels/GuidedTour/PopupWindowViewModel.cs index a44b1cb5664..0f938b306df 100644 --- a/src/DynamoCoreWpf/ViewModels/GuidedTour/PopupWindowViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/GuidedTour/PopupWindowViewModel.cs @@ -41,6 +41,21 @@ public PointCollection TooltipPointerPoints } } + /// + /// This will contains the shadow direction in degrees that will be shown in the pointer + /// + public double ShadowTooltipDirection + { + get + { + return Step.ShadowTooltipDirection; + } + set + { + Step.ShadowTooltipDirection = value; + } + } + /// /// Due that some popups doesn't need the pointer then this property hides or show the pointer /// diff --git a/src/DynamoCoreWpf/Views/GuidedTour/PopupWindow.xaml b/src/DynamoCoreWpf/Views/GuidedTour/PopupWindow.xaml index 7b2d87f2b4c..6584bec2b4b 100644 --- a/src/DynamoCoreWpf/Views/GuidedTour/PopupWindow.xaml +++ b/src/DynamoCoreWpf/Views/GuidedTour/PopupWindow.xaml @@ -6,6 +6,8 @@ xmlns:local="clr-namespace:Dynamo.Wpf.Views.GuidedTour" xmlns:localui="clr-namespace:Dynamo.Wpf.UI.GuidedTour" xmlns:ui="clr-namespace:Dynamo.UI" + xmlns:p="clr-namespace:Dynamo.Wpf.Properties;assembly=DynamoCoreWpf" + xmlns:controls="clr-namespace:Dynamo.Controls" mc:Ignorable="d" PopupAnimation="Fade" AllowsTransparency="True" @@ -22,6 +24,7 @@ + @@ -60,19 +63,19 @@ - - - - - - - + + + + + +