Incomplete functionality fixes: - SkiaEditor: Wire up Completed event to fire on focus lost - X11InputMethodService: Remove unused _commitCallback field - SkiaWebView: Set _isProperlyReparented when reparenting succeeds, use _lastMainX/_lastMainY to track main window position, add _isEmbedded guard to prevent double embedding Nullable reference fixes: - Easing: Reorder BounceOut before BounceIn (static init order) - GestureManager: Use local command variable instead of re-accessing - SkiaShell: Handle null Title with ?? operator - GLibNative: Use null! for closure pattern - LinuxProgramHost: Default title if null - SkiaWebView.LoadHtml: Add null/empty check for html - SystemThemeService: Initialize Colors with default values - DeviceDisplayService/AppInfoService: Use var for nullable env vars - EmailService: Add null check for message parameter Async fixes: - SkiaImage: Use _ = for fire-and-forget async calls - SystemTrayService: Convert async method without await to sync Task Reduces warnings from 156 to 133 (remaining are P/Invoke structs and obsolete MAUI API usage) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
54 lines
1.8 KiB
C#
54 lines
1.8 KiB
C#
// Licensed to the .NET Foundation under one or more agreements.
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
|
|
namespace Microsoft.Maui.Platform.Linux;
|
|
|
|
public class Easing
|
|
{
|
|
private readonly Func<double, double> _easingFunc;
|
|
|
|
public static readonly Easing Linear = new(v => v);
|
|
|
|
public static readonly Easing SinIn = new(v => 1.0 - Math.Cos(v * Math.PI / 2.0));
|
|
|
|
public static readonly Easing SinOut = new(v => Math.Sin(v * Math.PI / 2.0));
|
|
|
|
public static readonly Easing SinInOut = new(v => -(Math.Cos(Math.PI * v) - 1.0) / 2.0);
|
|
|
|
public static readonly Easing CubicIn = new(v => v * v * v);
|
|
|
|
public static readonly Easing CubicOut = new(v => 1.0 - Math.Pow(1.0 - v, 3.0));
|
|
|
|
public static readonly Easing CubicInOut = new(v =>
|
|
v < 0.5 ? 4.0 * v * v * v : 1.0 - Math.Pow(-2.0 * v + 2.0, 3.0) / 2.0);
|
|
|
|
// BounceOut must be declared before BounceIn since BounceIn references it
|
|
public static readonly Easing BounceOut = new(v =>
|
|
{
|
|
const double n1 = 7.5625;
|
|
const double d1 = 2.75;
|
|
|
|
if (v < 1 / d1)
|
|
return n1 * v * v;
|
|
if (v < 2 / d1)
|
|
return n1 * (v -= 1.5 / d1) * v + 0.75;
|
|
if (v < 2.5 / d1)
|
|
return n1 * (v -= 2.25 / d1) * v + 0.9375;
|
|
return n1 * (v -= 2.625 / d1) * v + 0.984375;
|
|
});
|
|
|
|
public static readonly Easing BounceIn = new(v => 1.0 - BounceOut.Ease(1.0 - v));
|
|
|
|
public static readonly Easing SpringIn = new(v => v * v * (2.70158 * v - 1.70158));
|
|
|
|
public static readonly Easing SpringOut = new(v =>
|
|
(v - 1.0) * (v - 1.0) * (2.70158 * (v - 1.0) + 1.70158) + 1.0);
|
|
|
|
public Easing(Func<double, double> easingFunc)
|
|
{
|
|
_easingFunc = easingFunc;
|
|
}
|
|
|
|
public double Ease(double v) => _easingFunc(v);
|
|
}
|