Merge pull request #122 from irihitech/fix
Use PureRectangle in shared library.
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:shapes="clr-namespace:Ursa.Controls.Shapes;assembly=Ursa">
|
||||
xmlns:iri="https://irihi.tech/shared">
|
||||
<!-- Add Resources Here -->
|
||||
<ControlTheme TargetType="u:DisableContainer" x:Key="{x:Type u:DisableContainer}">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="u:DisableContainer">
|
||||
<Panel>
|
||||
<ContentPresenter Content="{TemplateBinding Content}"></ContentPresenter>
|
||||
<shapes:PureRectangle Background="Transparent" IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content.IsEnabled, Converter={x:Static BoolConverters.Not}}" Cursor="No" ToolTip.Tip="{TemplateBinding DisabledTip}"/>
|
||||
<iri:PureRectangle Background="Transparent" IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content.IsEnabled, Converter={x:Static BoolConverters.Not}}" Cursor="No" ToolTip.Tip="{TemplateBinding DisabledTip}"/>
|
||||
</Panel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="clr-namespace:Ursa.Themes.Semi.Converters"
|
||||
xmlns:u="clr-namespace:Ursa.Controls;assembly=Ursa"
|
||||
xmlns:shapes="clr-namespace:Ursa.Controls.Shapes;assembly=Ursa">
|
||||
xmlns:iri="https://irihi.tech/shared">
|
||||
<!-- Add Resources Here -->
|
||||
<converters:BrushToColorConverter x:Key="BrushToColorConverter" />
|
||||
<ControlTheme x:Key="{x:Type u:LoadingIcon}" TargetType="u:LoadingIcon">
|
||||
@@ -68,9 +68,10 @@
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="u:Loading">
|
||||
<Panel IsVisible="{TemplateBinding IsLoading}">
|
||||
<shapes:PureRectangle
|
||||
<iri:PureRectangle
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
IsHitTestVisible="True"
|
||||
Background="{TemplateBinding Background}" />
|
||||
<Grid
|
||||
HorizontalAlignment="Center"
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:u="https://irihi.tech/ursa">
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:iri="https://irihi.tech/shared">
|
||||
<Design.PreviewWith>
|
||||
<Border Padding="20">
|
||||
<!-- Add Controls for Previewer Here -->
|
||||
@@ -24,19 +25,19 @@
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||||
<Border
|
||||
<iri:PureRectangle
|
||||
x:Name="PART_LoadingBorder"
|
||||
Classes.Active="{Binding Path= IsActive, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
IsHitTestVisible="{TemplateBinding IsLoading}"
|
||||
Background="{DynamicResource SkeletonDefaultBackground}"
|
||||
IsVisible="{TemplateBinding IsLoading}">
|
||||
</Border>
|
||||
<Border
|
||||
</iri:PureRectangle>
|
||||
<iri:PureRectangle
|
||||
x:Name="PART_ActiveBorder"
|
||||
IsHitTestVisible="{TemplateBinding IsLoading}"
|
||||
IsVisible="{TemplateBinding IsLoading}"
|
||||
>
|
||||
</Border>
|
||||
</iri:PureRectangle>
|
||||
</Panel>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:u="https://irihi.tech/ursa">
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:iri="https://irihi.tech/shared">
|
||||
<Design.PreviewWith>
|
||||
<Border Padding="20">
|
||||
<!-- Add Controls for Previewer Here -->
|
||||
@@ -8,7 +9,7 @@
|
||||
</Design.PreviewWith>
|
||||
|
||||
<!-- Add Styles Here -->
|
||||
<Style Selector="u|Skeleton[IsActive=True][IsLoading=True] /template/ Border#PART_ActiveBorder">
|
||||
<Style Selector="u|Skeleton[IsActive=True][IsLoading=True] /template/ iri|PureRectangle#PART_ActiveBorder">
|
||||
<Style.Animations>
|
||||
<Animation
|
||||
FillMode="None"
|
||||
@@ -17,10 +18,10 @@
|
||||
PlaybackDirection="Alternate"
|
||||
Duration="0:0:1.4">
|
||||
<KeyFrame Cue="0%">
|
||||
<Setter Property="Border.Background" Value="{DynamicResource SkeletonStartAnimationBackground}" />
|
||||
<Setter Property="Background" Value="{DynamicResource SkeletonStartAnimationBackground}" />
|
||||
</KeyFrame>
|
||||
<KeyFrame Cue="100%">
|
||||
<Setter Property="Border.Background" Value="{DynamicResource SkeletonEndAnimationBackground}" />
|
||||
<Setter Property="Background" Value="{DynamicResource SkeletonEndAnimationBackground}" />
|
||||
</KeyFrame>
|
||||
</Animation>
|
||||
</Style.Animations>
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
|
||||
<PackageReference Include="Irihi.Avalonia.Shared" Version="0.1.4" />
|
||||
<PackageReference Include="Irihi.Avalonia.Shared" Version="0.1.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user