diff --git a/Directory.Build.props b/Directory.Build.props
index c61df258..5c03ebf1 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -12,6 +12,6 @@
AVA3001
- 11.0.9
+ 11.2.1
\ No newline at end of file
diff --git a/src/Consolonia.Core/Consolonia.Core.csproj b/src/Consolonia.Core/Consolonia.Core.csproj
index dec1d7b4..0f7f503b 100644
--- a/src/Consolonia.Core/Consolonia.Core.csproj
+++ b/src/Consolonia.Core/Consolonia.Core.csproj
@@ -9,9 +9,7 @@
-
-
-
+
diff --git a/src/Consolonia.Core/Controls/MessageBox.axaml.cs b/src/Consolonia.Core/Controls/MessageBox.axaml.cs
index 63bd743a..6de944f8 100644
--- a/src/Consolonia.Core/Controls/MessageBox.axaml.cs
+++ b/src/Consolonia.Core/Controls/MessageBox.axaml.cs
@@ -43,19 +43,7 @@ public MessageBox()
InitializeComponent();
- AttachedToVisualTree += (_, _) =>
- {
- // we don't hook this up until the dialog is shown as the visible state is driven off of the DataContext
- // which is set at ShowDialogAsync() time.
- if (OkButton.IsVisible)
- OkButton.AttachedToVisualTree += (_, _) => OkButton.Focus();
- else if (YesButton.IsVisible)
- YesButton.AttachedToVisualTree += (_, _) => YesButton.Focus();
- else if (CancelButton.IsVisible)
- CancelButton.AttachedToVisualTree += (_, _) => CancelButton.Focus();
- else if (NoButton.IsVisible)
- NoButton.AttachedToVisualTree += (_, _) => NoButton.Focus();
- };
+ AttachedToVisualTree += OnShowDialog;
}
public Mode Mode
@@ -88,6 +76,28 @@ public object No
set => SetAndRaise(NoProperty, ref _no, value);
}
+ private void OnShowDialog(object sender, VisualTreeAttachmentEventArgs e)
+ {
+ // we don't hook this up until the dialog is shown as the visible state is driven off of the DataContext
+ // which is set at ShowDialogAsync() time.
+ AttachedToVisualTree -= OnShowDialog;
+ if (OkButton.IsVisible)
+ OkButton.AttachedToVisualTree += ButtonAttached;
+ else if (YesButton.IsVisible)
+ YesButton.AttachedToVisualTree += ButtonAttached;
+ else if (CancelButton.IsVisible)
+ CancelButton.AttachedToVisualTree += ButtonAttached;
+ else if (NoButton.IsVisible)
+ NoButton.AttachedToVisualTree += ButtonAttached;
+ }
+
+ private void ButtonAttached(object sender, VisualTreeAttachmentEventArgs e)
+ {
+ var button = (Button)sender;
+ button.AttachedToVisualTree -= ButtonAttached;
+ button.Focus();
+ }
+
public async Task ShowDialogAsync(Control parent, string text, string title = null)
{
DataContext = new MessageBoxViewModel(Mode, Ok, Cancel, Yes, No, text, title ?? Title);
diff --git a/src/Consolonia.Core/Drawing/ConsoleBrush.cs b/src/Consolonia.Core/Drawing/ConsoleBrush.cs
index ce4e7b02..a2d3bc88 100644
--- a/src/Consolonia.Core/Drawing/ConsoleBrush.cs
+++ b/src/Consolonia.Core/Drawing/ConsoleBrush.cs
@@ -126,10 +126,16 @@ public static ConsoleBrush FromPosition(IBrush brush, int x, int y, int width, i
// Calculate the distance from the center
double dx = x - centerX;
double dy = y - centerY;
- double distance = Math.Sqrt(dx * dx + dy * dy);
- // Normalize the distance based on the brush radius
- double normalizedDistance = distance / (Math.Min(width, height) * radialBrush.Radius);
+ // Calculate the distance based on separate X and Y radii
+ double distanceX = dx / (width * radialBrush.RadiusX.Scalar);
+ double distanceY = dy / (height * radialBrush.RadiusY.Scalar);
+ double distance = Math.Sqrt(distanceX * distanceX + distanceY * distanceY);
+
+ // Normalize the distance
+ double normalizedDistance = distance /
+ Math.Sqrt(radialBrush.RadiusX.Scalar * radialBrush.RadiusX.Scalar +
+ radialBrush.RadiusY.Scalar * radialBrush.RadiusY.Scalar);
// Clamp the normalized distance to [0, 1]
normalizedDistance = Math.Min(Math.Max(normalizedDistance, 0), 1);
diff --git a/src/Consolonia.Core/Drawing/ConsoloniaPlatformRenderInterfaceContext.cs b/src/Consolonia.Core/Drawing/ConsoloniaPlatformRenderInterfaceContext.cs
index 3ecd180f..af9a867f 100644
--- a/src/Consolonia.Core/Drawing/ConsoloniaPlatformRenderInterfaceContext.cs
+++ b/src/Consolonia.Core/Drawing/ConsoloniaPlatformRenderInterfaceContext.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using Avalonia;
using Avalonia.Platform;
namespace Consolonia.Core.Drawing
@@ -20,6 +21,13 @@ public IRenderTarget CreateRenderTarget(IEnumerable