Browse Source
And refactor that interface while we're at it. Also add a `DefaultPlatformSettings` implementation instead of implementing it in each backend with slightly different values.pull/9360/head
19 changed files with 112 additions and 110 deletions
@ -0,0 +1,30 @@ |
|||
using System; |
|||
using Avalonia.Input; |
|||
|
|||
namespace Avalonia.Platform |
|||
{ |
|||
/// <summary>
|
|||
/// A default implementation of <see cref="IPlatformSettings"/> for platforms which don't have
|
|||
/// an OS-specific implementation.
|
|||
/// </summary>
|
|||
public class DefaultPlatformSettings : IPlatformSettings |
|||
{ |
|||
public Size GetTapSize(PointerType type) |
|||
{ |
|||
return type switch |
|||
{ |
|||
PointerType.Touch => new(10, 10), |
|||
_ => new(4, 4), |
|||
}; |
|||
} |
|||
public Size GetDoubleTapSize(PointerType type) |
|||
{ |
|||
return type switch |
|||
{ |
|||
PointerType.Touch => new(16, 16), |
|||
_ => new(4, 4), |
|||
}; |
|||
} |
|||
public TimeSpan GetDoubleTapTime(PointerType type) => TimeSpan.FromMilliseconds(500); |
|||
} |
|||
} |
|||
@ -1,17 +0,0 @@ |
|||
using System; |
|||
using Avalonia.Platform; |
|||
|
|||
namespace Avalonia.X11 |
|||
{ |
|||
class PlatformSettingsStub : IPlatformSettings |
|||
{ |
|||
public Size DoubleClickSize { get; } = new Size(2, 2); |
|||
public TimeSpan DoubleClickTime { get; } = TimeSpan.FromMilliseconds(500); |
|||
|
|||
/// <inheritdoc cref="IPlatformSettings.TouchDoubleClickSize"/>
|
|||
public Size TouchDoubleClickSize => new Size(16, 16); |
|||
|
|||
/// <inheritdoc cref="IPlatformSettings.TouchDoubleClickTime"/>
|
|||
public TimeSpan TouchDoubleClickTime => DoubleClickTime; |
|||
} |
|||
} |
|||
Loading…
Reference in new issue