Merge branch 'irihitech:main' into Fix-TimeBox

This commit is contained in:
N1vla
2024-05-18 00:04:50 +08:00
committed by GitHub
5 changed files with 34 additions and 0 deletions

View File

@@ -22,6 +22,8 @@ public partial class OverlayDialogHost
SetTop(control, 0);
return;
}
control.MaxWidth = newSize.Width;
control.MaxHeight = newSize.Height;
var width = newSize.Width - control.Bounds.Width;
var height = newSize.Height - control.Bounds.Height;
var newLeft = width * control.HorizontalOffsetRatio??0;
@@ -97,6 +99,8 @@ public partial class OverlayDialogHost
control.Width = Bounds.Width;
control.Height = Bounds.Height;
}
control.MaxWidth = Bounds.Width;
control.MaxHeight = Bounds.Height;
control.Measure(this.Bounds.Size);
control.Arrange(new Rect(control.DesiredSize));
SetToPosition(control);
@@ -154,6 +158,8 @@ public partial class OverlayDialogHost
control.Width = Bounds.Width;
control.Height = Bounds.Height;
}
control.MaxWidth = Bounds.Width;
control.MaxHeight = Bounds.Height;
control.Measure(this.Bounds.Size);
control.Arrange(new Rect(control.DesiredSize));
SetToPosition(control);

View File

@@ -7,6 +7,7 @@ using Avalonia.Controls.Primitives;
using Avalonia.Controls.Selection;
using Avalonia.Controls.Templates;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Rendering.Composition;
using Avalonia.Rendering.Composition.Animations;
using Irihi.Avalonia.Shared.Helpers;
@@ -95,6 +96,18 @@ public class SelectionList: SelectingItemsControl
EnsureIndicatorAnimation();
}
protected override void OnLoaded(RoutedEventArgs e)
{
base.OnLoaded(e);
if(_indicator is not null && SelectedItem is not null)
{
var container = ContainerFromItem(SelectedItem);
if (container is null) return;
_indicator.Opacity = 1;
_indicator.Arrange(container.Bounds);
}
}
private void EnsureIndicatorAnimation()
{
if (_indicator is not null)