significantly reduce uniformstaggeredlayout resize lag

This commit is contained in:
DismissedLight
2024-03-15 20:24:32 +08:00
parent be30362b52
commit eee84a338e
5 changed files with 5 additions and 20 deletions

View File

@@ -81,13 +81,6 @@ internal sealed partial class UniformStaggeredLayout : VirtualizingLayout
(int numberOfColumns, double columnWidth) = GetNumberOfColumnsAndWidth(availableWidth, MinItemWidth, MinColumnSpacing);
if (columnWidth != state.ColumnWidth)
{
// Remeasure items later
// Rearrange items later
state.Clear();
}
state.ColumnWidth = columnWidth;
double totalWidth = ((state.ColumnWidth + MinColumnSpacing) * numberOfColumns) - MinColumnSpacing;
@@ -103,15 +96,11 @@ internal sealed partial class UniformStaggeredLayout : VirtualizingLayout
if (numberOfColumns != state.NumberOfColumns)
{
// Remeasure items later
// Rearrange items later
state.Clear();
state.ClearColumns();
}
if (MinRowSpacing != state.RowSpacing)
{
// Rearrange items later
// If the RowSpacing changes the height of the rows will be different.
// The columns stores the height so we'll want to clear them out to
// get the proper height
@@ -209,7 +198,7 @@ internal sealed partial class UniformStaggeredLayout : VirtualizingLayout
double bottom = item.Top + item.Height;
if (bottom < context.RealizationRect.Top)
{
// element is above the realization bounds
// Element is above the realization bounds
continue;
}

View File

@@ -1,7 +1,6 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using System.Runtime.InteropServices;

View File

@@ -9,7 +9,7 @@ internal sealed class LaunchExecutionBetterGenshinImpactAutomationHandlder : ILa
{
public async ValueTask OnExecutionAsync(LaunchExecutionContext context, LaunchExecutionDelegate next)
{
if (context.Options.UseBetterGenshinImpactAutomation)
if (!context.Process.HasExited && context.Options.UseBetterGenshinImpactAutomation)
{
context.Logger.LogInformation("Using BetterGI to automate gameplay");
await LaunchBetterGenshinImpactAsync(context).ConfigureAwait(false);

View File

@@ -9,7 +9,7 @@ internal sealed class LaunchExecutionStarwardPlayTimeStatisticsHandler : ILaunch
{
public async ValueTask OnExecutionAsync(LaunchExecutionContext context, LaunchExecutionDelegate next)
{
if (context.Options.UseStarwardPlayTimeStatistics)
if (!context.Process.HasExited && context.Options.UseStarwardPlayTimeStatistics)
{
context.Logger.LogInformation("Using Starward to count game time");
await LaunchStarwardForPlayTimeStatisticsAsync(context).ConfigureAwait(false);

View File

@@ -41,9 +41,6 @@ internal sealed class LaunchExecutionUnlockFpsHandler : ILaunchExecutionDelegate
}
}
if (context.Result.Kind is LaunchExecutionResultKind.Ok)
{
await next().ConfigureAwait(false);
}
await next().ConfigureAwait(false);
}
}