feat: implement for overlaypopup. change name.

This commit is contained in:
rabbitism
2024-12-24 18:06:40 +08:00
parent f891e05e4c
commit f71e2630bb
4 changed files with 19 additions and 17 deletions

View File

@@ -7,7 +7,7 @@
<!-- You can still reference in old way. --> <!-- You can still reference in old way. -->
<!-- <StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" /> --> <!-- <StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" /> -->
<semi:SemiTheme Locale="zh-cn" /> <semi:SemiTheme Locale="zh-cn" />
<semi:PopupAnimations/> <semi:SemiPopupAnimations/>
<StyleInclude Source="avares://Semi.Avalonia.DataGrid/Index.axaml" /> <StyleInclude Source="avares://Semi.Avalonia.DataGrid/Index.axaml" />
<StyleInclude Source="avares://Semi.Avalonia.ColorPicker/Index.axaml" /> <StyleInclude Source="avares://Semi.Avalonia.ColorPicker/Index.axaml" />
</Application.Styles> </Application.Styles>

View File

@@ -1,5 +1,5 @@
<Styles xmlns="https://github.com/avaloniaui" <Styles xmlns="https://github.com/avaloniaui"
x:Class="Semi.Avalonia.PopupAnimations" x:Class="Semi.Avalonia.SemiPopupAnimations"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Semi.Avalonia.Converters"> xmlns:converters="clr-namespace:Semi.Avalonia.Converters">
<Design.PreviewWith> <Design.PreviewWith>
@@ -18,10 +18,10 @@
<Style Selector="Popup[IsOpen=True] LayoutTransformControl#PART_LayoutTransform"> <Style Selector="Popup[IsOpen=True] LayoutTransformControl#PART_LayoutTransform">
<Style.Animations> <Style.Animations>
<Animation Duration="0:0:0.2" FillMode="Forward"> <Animation Duration="0:0:0.3" FillMode="Forward" Easing="CubicEaseIn">
<KeyFrame Cue="0.0"> <KeyFrame Cue="0.0">
<Setter Property="ScaleTransform.ScaleX" Value="0.95"/> <Setter Property="ScaleTransform.ScaleX" Value="0.98"/>
<Setter Property="ScaleTransform.ScaleY" Value="0.95"/> <Setter Property="ScaleTransform.ScaleY" Value="0.98"/>
</KeyFrame> </KeyFrame>
<KeyFrame Cue="1.0"> <KeyFrame Cue="1.0">
<Setter Property="ScaleTransform.ScaleX" Value="1.0"/> <Setter Property="ScaleTransform.ScaleX" Value="1.0"/>
@@ -32,15 +32,15 @@
</Style> </Style>
<Style Selector="Popup[IsOpen=False] LayoutTransformControl#PART_LayoutTransform"> <Style Selector="Popup[IsOpen=False] LayoutTransformControl#PART_LayoutTransform">
<Style.Animations> <Style.Animations>
<Animation Duration="0:0:0.2" FillMode="Forward"> <Animation Duration="0:0:0.3" FillMode="Forward" Easing="CubicEaseOut">
<KeyFrame Cue="0.0"> <KeyFrame Cue="0.0">
<Setter Property="ScaleTransform.ScaleX" Value="0.95"/>
<Setter Property="ScaleTransform.ScaleY" Value="0.95"/>
</KeyFrame>
<KeyFrame Cue="1.0">
<Setter Property="ScaleTransform.ScaleX" Value="1.0"/> <Setter Property="ScaleTransform.ScaleX" Value="1.0"/>
<Setter Property="ScaleTransform.ScaleY" Value="1.0"/> <Setter Property="ScaleTransform.ScaleY" Value="1.0"/>
</KeyFrame> </KeyFrame>
<KeyFrame Cue="1.0">
<Setter Property="ScaleTransform.ScaleX" Value="0.98"/>
<Setter Property="ScaleTransform.ScaleY" Value="0.98"/>
</KeyFrame>
</Animation> </Animation>
</Style.Animations> </Style.Animations>
</Style> </Style>

View File

@@ -2,7 +2,7 @@ using Avalonia.Styling;
namespace Semi.Avalonia; namespace Semi.Avalonia;
public class PopupAnimations: Styles public class SemiPopupAnimations: Styles
{ {
} }

View File

@@ -31,12 +31,14 @@
<ControlTemplate> <ControlTemplate>
<LayoutTransformControl LayoutTransform="{TemplateBinding Transform}"> <LayoutTransformControl LayoutTransform="{TemplateBinding Transform}">
<VisualLayerManager IsPopup="True"> <VisualLayerManager IsPopup="True">
<ContentPresenter <LayoutTransformControl Name="PART_LayoutTransform">
Name="PART_ContentPresenter" <ContentPresenter
Padding="{TemplateBinding Padding}" Name="PART_ContentPresenter"
Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"
Content="{TemplateBinding Content}" Background="{TemplateBinding Background}"
ContentTemplate="{TemplateBinding ContentTemplate}" /> Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</LayoutTransformControl>
</VisualLayerManager> </VisualLayerManager>
</LayoutTransformControl> </LayoutTransformControl>
</ControlTemplate> </ControlTemplate>