mirror of
https://github.com/AtomUI/AtomUI.git
synced 2026-10-28 14:20:47 +08:00
fix popup motion bug for linux
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
<ResourceInclude Source="Expander/Themes/ExpanderTheme.axaml" />
|
||||
<ResourceInclude Source="Flyouts/Themes/FlyoutThemes.axaml" />
|
||||
<ResourceInclude Source="GroupBox/Themes/GroupBoxTheme.axaml" />
|
||||
<ResourceInclude Source="HeaderedContentControl/Themes/HeaderedContentControlTheme.axaml" />
|
||||
<ResourceInclude Source="Input/Themes/InputThemes.axaml" />
|
||||
<ResourceInclude Source="ItemsControl/Themes/ItemsControlTheme.axaml" />
|
||||
<ResourceInclude Source="ListBox/Themes/ListBoxThemes.axaml" />
|
||||
@@ -47,9 +48,11 @@
|
||||
<ResourceInclude Source="TabControl/Themes/TabControlThemes.axaml" />
|
||||
<ResourceInclude Source="Tag/Themes/TagTheme.axaml" />
|
||||
<ResourceInclude Source="TextBlock/Themes/HyperLinkTextBlockTheme.axaml" />
|
||||
<ResourceInclude Source="TextSelectionHandle/Themes/TextSelectionHandleTheme.axaml" />
|
||||
<ResourceInclude Source="Timeline/Themes/TimelineThemes.axaml" />
|
||||
<ResourceInclude Source="TimePicker/Themes/TimePickerThemes.axaml" />
|
||||
<ResourceInclude Source="Tooltip/Themes/ToolTipTheme.axaml" />
|
||||
<ResourceInclude Source="TransitioningContentControl/Themes/TransitioningContentControlTheme.axaml" />
|
||||
<ResourceInclude Source="TreeView/Themes/TreeViewThemes.axaml" />
|
||||
<ResourceInclude Source="Window/Themes/WindowThemes.axaml" />
|
||||
</atom:ControlThemesProvider.ControlThemes>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:atom="https://atomui.net"
|
||||
x:ClassModifier="internal">
|
||||
<ControlTheme x:Key="{x:Type HeaderedContentControl}" TargetType="HeaderedContentControl">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
Background="{TemplateBinding Background}"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<Grid RowDefinitions="auto *">
|
||||
<ContentPresenter Name="{x:Static atom:HeaderedContentControlThemeConstants.HeaderPresenterPart}"
|
||||
Content="{TemplateBinding Header}"
|
||||
RecognizesAccessKey="True"
|
||||
ContentTemplate="{TemplateBinding HeaderTemplate}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Grid.Row="0" />
|
||||
<ContentPresenter Name="{x:Static atom:HeaderedContentControlThemeConstants.ContentPresenterPart}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
Content="{TemplateBinding Content}"
|
||||
RecognizesAccessKey="True"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
Grid.Row="1" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
namespace AtomUI.Controls.Themes;
|
||||
|
||||
internal static class HeaderedContentControlThemeConstants
|
||||
{
|
||||
public const string HeaderPresenterPart = "PART_HeaderPresenter";
|
||||
public const string ContentPresenterPart = "PART_ContentPresenter";
|
||||
}
|
||||
@@ -502,7 +502,6 @@ public class Popup : AvaloniaPopup,
|
||||
|
||||
public void MotionAwareOpen(Action? opened = null)
|
||||
{
|
||||
|
||||
// AbstractPopup is currently open
|
||||
if (IsOpen || _openAnimating || _closeAnimating)
|
||||
{
|
||||
@@ -566,18 +565,18 @@ public class Popup : AvaloniaPopup,
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (_openAnimating)
|
||||
{
|
||||
RequestCloseWhereAnimationCompleted = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!IsOpen)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!IsMotionEnabled)
|
||||
{
|
||||
_buddyLayer?.Detach();
|
||||
@@ -586,7 +585,7 @@ public class Popup : AvaloniaPopup,
|
||||
closed?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
_closeAnimating = true;
|
||||
var popupRoot = Host as PopupRoot;
|
||||
Debug.Assert(popupRoot != null);
|
||||
|
||||
@@ -184,7 +184,7 @@ internal class PopupBuddyLayer : SceneLayer, IPopupBuddyLayer, IShadowAwareLayer
|
||||
}
|
||||
|
||||
SetupPopupHost();
|
||||
// _buddyDecorator.HideDecoratorContent();
|
||||
_buddyDecorator.HideDecoratorContent();
|
||||
}
|
||||
|
||||
public void Detach()
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:ClassModifier="internal">
|
||||
<x:Double x:Key="TextSelectHandleSize">32</x:Double>
|
||||
<GeometryGroup x:Key="TextSelectionHandlePath" FillRule="NonZero">
|
||||
<RectangleGeometry Rect="0,0,16,16"/>
|
||||
<EllipseGeometry Center="16,16"
|
||||
RadiusX="16"
|
||||
RadiusY="16"/>
|
||||
</GeometryGroup>
|
||||
<GeometryGroup x:Key="TextCaretHandlePath" FillRule="NonZero">
|
||||
<RectangleGeometry Rect="0,0,16,16">
|
||||
<RectangleGeometry.Transform>
|
||||
<TransformGroup >
|
||||
<RotateTransform CenterX="16"
|
||||
Angle="-45"/>
|
||||
</TransformGroup>
|
||||
</RectangleGeometry.Transform>
|
||||
</RectangleGeometry>
|
||||
<EllipseGeometry Center="16,22.7"
|
||||
RadiusX="16"
|
||||
RadiusY="16"/>
|
||||
</GeometryGroup>
|
||||
<ControlTheme x:Key="{x:Type TextSelectionHandle}"
|
||||
TargetType="TextSelectionHandle">
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource TextControlSelectionHighlightColor}" />
|
||||
<Setter Property="HorizontalAlignment"
|
||||
Value="Center" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Grid>
|
||||
<PathIcon
|
||||
Cursor="Arrow"
|
||||
Name="PART_HandlePathIcon"
|
||||
HorizontalAlignment="Stretch"
|
||||
Height="{DynamicResource TextSelectHandleSize}"
|
||||
Foreground="{TemplateBinding Background}"
|
||||
Data="{DynamicResource TextSelectionHandlePath}"
|
||||
/>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style Selector="^.caret /template/ PathIcon#PART_HandlePathIcon">
|
||||
<Setter Property="Data" Value="{DynamicResource TextCaretHandlePath}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:atom="https://atomui.net"
|
||||
x:ClassModifier="internal">
|
||||
<ControlTheme x:Key="{x:Type TransitioningContentControl}" TargetType="TransitioningContentControl">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Panel>
|
||||
<ContentPresenter Name="{x:Static atom:TransitioningContentControlThemeConstants.ContentPresenterPart}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" />
|
||||
<ContentPresenter Name="{x:Static atom:TransitioningContentControlThemeConstants.ContentPresenter2Part}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" />
|
||||
</Panel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
namespace AtomUI.Controls.Themes;
|
||||
|
||||
public static class TransitioningContentControlThemeConstants
|
||||
{
|
||||
public const string ContentPresenterPart = "PART_ContentPresenter";
|
||||
public const string ContentPresenter2Part = "PART_ContentPresenter2";
|
||||
}
|
||||
Reference in New Issue
Block a user