feat: replace pure rectangle in several places. use pure rectangle in public repo.
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Data;
|
||||
using Avalonia.Data.Converters;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Media;
|
||||
using Ursa.Controls.Shapes;
|
||||
using Irihi.Avalonia.Shared.Shapes;
|
||||
|
||||
namespace Ursa.Controls;
|
||||
|
||||
@@ -33,7 +31,7 @@ public class DisabledAdorner
|
||||
{
|
||||
if (arg2.NewValue.Value)
|
||||
{
|
||||
var pureRectangle = new Border()
|
||||
var pureRectangle = new PureRectangle()
|
||||
{
|
||||
Background = Brushes.Transparent,
|
||||
IsHitTestVisible = true,
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Animation;
|
||||
using Avalonia.Animation.Easings;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Controls.Templates;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Styling;
|
||||
using Avalonia.Utilities;
|
||||
using Irihi.Avalonia.Shared.Shapes;
|
||||
using Ursa.Controls.OverlayShared;
|
||||
using Ursa.Controls.Shapes;
|
||||
using Ursa.EventArgs;
|
||||
|
||||
namespace Ursa.Controls;
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ using Avalonia.Animation;
|
||||
using Avalonia.Animation.Easings;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Styling;
|
||||
using Irihi.Avalonia.Shared.Shapes;
|
||||
using Ursa.Common;
|
||||
using Ursa.Controls.OverlayShared;
|
||||
using Ursa.Controls.Shapes;
|
||||
using Ursa.EventArgs;
|
||||
|
||||
namespace Ursa.Controls;
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Animation;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Shapes;
|
||||
using Avalonia.Controls.Templates;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Media;
|
||||
using Ursa.Controls.OverlayShared;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Media.Immutable;
|
||||
using Avalonia.Styling;
|
||||
using Ursa.Controls.Shapes;
|
||||
using Irihi.Avalonia.Shared.Shapes;
|
||||
|
||||
namespace Ursa.Controls;
|
||||
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace Ursa.Controls.Shapes;
|
||||
|
||||
public class PureCircle: Control
|
||||
{
|
||||
public static readonly StyledProperty<IBrush?> BackgroundProperty =
|
||||
TemplatedControl.BackgroundProperty.AddOwner<PureCircle>();
|
||||
|
||||
public IBrush? Background
|
||||
{
|
||||
get => GetValue(BackgroundProperty);
|
||||
set => SetValue(BackgroundProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<double> DiameterProperty = AvaloniaProperty.Register<PureCircle, double>(
|
||||
nameof(Diameter));
|
||||
|
||||
public double Diameter
|
||||
{
|
||||
get => GetValue(DiameterProperty);
|
||||
set => SetValue(DiameterProperty, value);
|
||||
}
|
||||
|
||||
static PureCircle()
|
||||
{
|
||||
FocusableProperty.OverrideDefaultValue<PureCircle>(false);
|
||||
AffectsMeasure<PureCircle>(DiameterProperty);
|
||||
AffectsRender<PureCircle>(DiameterProperty, BackgroundProperty);
|
||||
}
|
||||
|
||||
protected override Size MeasureOverride(Size availableSize)
|
||||
{
|
||||
return new Size(Diameter, Diameter);
|
||||
}
|
||||
|
||||
public override void Render(DrawingContext context)
|
||||
{
|
||||
double value = Diameter / 2;
|
||||
context.DrawEllipse(Background, null, new(value, value), value, value);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Controls.Shapes;
|
||||
using Avalonia.Markup.Xaml.Templates;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace Ursa.Controls.Shapes;
|
||||
|
||||
/// <summary>
|
||||
/// A rectangle, with no corner radius.
|
||||
/// </summary>
|
||||
public class PureRectangle: Control
|
||||
{
|
||||
public static readonly StyledProperty<IBrush?> BackgroundProperty =
|
||||
TemplatedControl.BackgroundProperty.AddOwner<PureRectangle>();
|
||||
|
||||
public IBrush? Background
|
||||
{
|
||||
get => GetValue(BackgroundProperty);
|
||||
set => SetValue(BackgroundProperty, value);
|
||||
}
|
||||
static PureRectangle()
|
||||
{
|
||||
FocusableProperty.OverrideDefaultValue<PureRectangle>(false);
|
||||
AffectsRender<PureRectangle>(BackgroundProperty);
|
||||
}
|
||||
|
||||
public override void Render(DrawingContext context)
|
||||
{
|
||||
context.DrawRectangle(Background, null, new Rect(Bounds.Size));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user