diff --git a/Maui.FreakyUXKit/Maui.FreakyUXKit/Coachmark/CoachmarkAnimationStyle.cs b/Maui.FreakyUXKit/Maui.FreakyUXKit/Coachmark/CoachmarkAnimationStyle.cs index 32ddf2a..ec2da82 100644 --- a/Maui.FreakyUXKit/Maui.FreakyUXKit/Coachmark/CoachmarkAnimationStyle.cs +++ b/Maui.FreakyUXKit/Maui.FreakyUXKit/Coachmark/CoachmarkAnimationStyle.cs @@ -9,4 +9,4 @@ public enum CoachmarkAnimationStyle Spotlight, Arrow, Morph -} \ No newline at end of file +} \ No newline at end of file diff --git a/Maui.FreakyUXKit/Maui.FreakyUXKit/Coachmark/FreakyPopupPage.xaml.cs b/Maui.FreakyUXKit/Maui.FreakyUXKit/Coachmark/FreakyPopupPage.xaml.cs index 16cd679..273b114 100644 --- a/Maui.FreakyUXKit/Maui.FreakyUXKit/Coachmark/FreakyPopupPage.xaml.cs +++ b/Maui.FreakyUXKit/Maui.FreakyUXKit/Coachmark/FreakyPopupPage.xaml.cs @@ -156,8 +156,8 @@ private void OnPaintSurface(object sender, SKPaintSurfaceEventArgs e) var info = e.Info; var rect = info.Rect; var highlightRect = _currentBounds; - float highX = highlightRect.Left + highlightRect.Width / 2; - float highY = highlightRect.Top + highlightRect.Height / 2; + float highX = highlightRect.Left + (highlightRect.Width / 2); + float highY = highlightRect.Top + (highlightRect.Height / 2); if (CurrentTargetView == null || OverlayView == null) return; @@ -191,7 +191,6 @@ private void OnPaintSurface(object sender, SKPaintSurfaceEventArgs e) RenderStaticHighlight(canvas, rect, highX, highY, highlightRect); break; } - } private void RenderStaticHighlight(SKCanvas canvas, SKRect rect, float highX, float highY, SKRect highlightRect) @@ -293,7 +292,7 @@ private void RenderArrowPointer(SKCanvas canvas, SKRect highlightRect, SKRect ov // Direction vector and distance from overlay center to highlight center var dx = highlightCenter.X - overlayCenter.X; var dy = highlightCenter.Y - overlayCenter.Y; - var totalDistance = MathF.Sqrt(dx * dx + dy * dy); + var totalDistance = MathF.Sqrt((dx * dx) + (dy * dy)); if (totalDistance == 0) return; @@ -303,18 +302,18 @@ private void RenderArrowPointer(SKCanvas canvas, SKRect highlightRect, SKRect ov var edgePoint = GetClosestPointOnRect(highlightRect, overlayCenter); // Distance from overlayCenter to edgePoint - var distToEdge = MathF.Sqrt((edgePoint.X - overlayCenter.X) * (edgePoint.X - overlayCenter.X) + - (edgePoint.Y - overlayCenter.Y) * (edgePoint.Y - overlayCenter.Y)); + var distToEdge = MathF.Sqrt(((edgePoint.X - overlayCenter.X) * (edgePoint.X - overlayCenter.X)) + + ((edgePoint.Y - overlayCenter.Y) * (edgePoint.Y - overlayCenter.Y))); // Calculate start point - padded 20% away from overlayCenter along direction var start = new SKPoint( - overlayCenter.X + direction.X * (totalDistance * paddingPercent), - overlayCenter.Y + direction.Y * (totalDistance * paddingPercent)); + overlayCenter.X + (direction.X * (totalDistance * paddingPercent)), + overlayCenter.Y + (direction.Y * (totalDistance * paddingPercent))); // Calculate end point - 20% *before* edgePoint along the direction vector var end = new SKPoint( - overlayCenter.X + direction.X * (distToEdge * (1 - paddingPercent)), - overlayCenter.Y + direction.Y * (distToEdge * (1 - paddingPercent))); + overlayCenter.X + (direction.X * (distToEdge * (1 - paddingPercent))), + overlayCenter.Y + (direction.Y * (distToEdge * (1 - paddingPercent)))); canvas.DrawArrow(start, end, ArrowColor.ToSKColor(), ArrowStyle, ArrowStrokeWidth); } @@ -399,16 +398,16 @@ private void DrawShapeStroke(SKCanvas canvas, HighlightShape shape, float center canvas.DrawCircle(centerX, centerY, radius, paint); break; case HighlightShape.Ellipse: - canvas.DrawOval(new SKRect(centerX - width / 2, centerY - height / 2, - centerX + width / 2, centerY + height / 2), paint); + canvas.DrawOval(new SKRect(centerX - (width / 2), centerY - (height / 2), + centerX + (width / 2), centerY + (height / 2)), paint); break; case HighlightShape.Rectangle: - canvas.DrawRect(new SKRect(centerX - width / 2, centerY - height / 2, - centerX + width / 2, centerY + height / 2), paint); + canvas.DrawRect(new SKRect(centerX - (width / 2), centerY - (height / 2), + centerX + (width / 2), centerY + (height / 2)), paint); break; default: // RoundRectangle - canvas.DrawRoundRect(new SKRoundRect(new SKRect(centerX - width / 2, centerY - height / 2, - centerX + width / 2, centerY + height / 2), CornerRadius), paint); + canvas.DrawRoundRect(new SKRoundRect(new SKRect(centerX - (width / 2), centerY - (height / 2), + centerX + (width / 2), centerY + (height / 2)), CornerRadius), paint); break; } } diff --git a/Maui.FreakyUXKit/Maui.FreakyUXKit/Hosting.cs b/Maui.FreakyUXKit/Maui.FreakyUXKit/Hosting.cs index 1b3f8c4..27936b5 100644 --- a/Maui.FreakyUXKit/Maui.FreakyUXKit/Hosting.cs +++ b/Maui.FreakyUXKit/Maui.FreakyUXKit/Hosting.cs @@ -8,7 +8,6 @@ public static class Hosting public static MauiAppBuilder UseFreakyUXKit(this MauiAppBuilder builder) { builder - .UseMauiCommunityToolkit() .UseSkiaSharp(); return builder; } diff --git a/Maui.FreakyUXKit/Maui.FreakyUXKit/IntroView/FreakyIntroStep.cs b/Maui.FreakyUXKit/Maui.FreakyUXKit/IntroView/FreakyIntroStep.cs new file mode 100644 index 0000000..f131dbc --- /dev/null +++ b/Maui.FreakyUXKit/Maui.FreakyUXKit/IntroView/FreakyIntroStep.cs @@ -0,0 +1,29 @@ +using System.Windows.Input; +using Microsoft.Maui.Controls.Shapes; +namespace Maui.FreakyUXKit; + +public class FreakyIntroStep +{ + public string TitleText { get; set; } + public FormattedString TitleFormattedText { get; set; } + public string SubTitleText { get; set; } + public FormattedString SubtitleFormattedText { get; set; } + public ImageSource ImageSource { get; set; } + public Style ImageStyle { get; set; } + public Style TitleLabelStyle { get; set; } + public Style SubtitleLabelStyle { get; set; } + public string LeftButtonText { get; set; } + public ICommand LeftButtonCommand { get; set; } + public bool IsLeftButtonVisible { get; set; } + public string CenterButtonText { get; set; } + public ICommand CenterButtonCommand { get; set; } + public bool IsCenterButtonVisible { get; set; } + public string RightButtonText { get; set; } + public ICommand RightButtonCommand { get; set; } + public bool IsRightButtonVisible { get; set; } + public Brush BottomBackground { get; set; } = Colors.Transparent; + public Brush ImageBackground { get; set; } = Colors.Transparent; + public Brush Background { get; set; } = Brush.Transparent; + public Color BackgroundAnimationColor { get; set; } = Colors.Transparent; + public IShape BottomStrokeShape { get; set; } = new RoundRectangle() { CornerRadius = new CornerRadius(30, 30, 0, 0) }; +} \ No newline at end of file diff --git a/Maui.FreakyUXKit/Maui.FreakyUXKit/IntroView/FreakyIntroView.xaml b/Maui.FreakyUXKit/Maui.FreakyUXKit/IntroView/FreakyIntroView.xaml new file mode 100644 index 0000000..261c159 --- /dev/null +++ b/Maui.FreakyUXKit/Maui.FreakyUXKit/IntroView/FreakyIntroView.xaml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + +