Refactor and optimize overlay dialog handling and resizing logic

- Remove unused `_moveDragging` variable in `OverlayFeedbackElement.cs`
- Rename private static animations to follow PascalCase in `OverlayDialogHost.Shared.cs`
- Simplify and streamline `ClickMaskToCloseDialog`, `OnPointerMoved`, `OnPointerPressed`, and `OnPointerReleased` methods in `OverlayDialogHost.Dialog.cs`
- Remove redundant null checks and streamline method calls in various files
- Optimize `_moveDragging` logic and pointer event handling in `DialogControlBase.cs`

This commit enhances readability, maintains consistency in naming conventions, and optimizes the code for better performance and clarity.
This commit is contained in:
rabbitism
2024-09-18 02:37:17 +08:00
parent 5799646488
commit dccb3c029c
5 changed files with 102 additions and 155 deletions

View File

@@ -42,7 +42,7 @@ public partial class OverlayDialogHost
}
else
{
await Task.WhenAll(animation.RunAsync(control), _maskAppearAnimation.RunAsync(mask));
await Task.WhenAll(animation.RunAsync(control), MaskAppearAnimation.RunAsync(mask));
}
}
}
@@ -67,7 +67,7 @@ public partial class OverlayDialogHost
}
else
{
await Task.WhenAll(animation.RunAsync(control), _maskAppearAnimation.RunAsync(mask));
await Task.WhenAll(animation.RunAsync(control), MaskAppearAnimation.RunAsync(mask));
}
var element = control.GetVisualDescendants().OfType<InputElement>().FirstOrDefault(a => a.Focusable);
element?.Focus();
@@ -174,7 +174,7 @@ public partial class OverlayDialogHost
if (!IsAnimationDisabled)
{
var disappearAnimation = CreateAnimation(control.Bounds.Size, control.Position, false);
await Task.WhenAll(disappearAnimation.RunAsync(control), _maskDisappearAnimation.RunAsync(layer.Mask));
await Task.WhenAll(disappearAnimation.RunAsync(control), MaskDisappearAnimation.RunAsync(layer.Mask));
}
Children.Remove(layer.Mask);
}