Skip to content

Commit

Permalink
Update pen tap settings (#17780)
Browse files Browse the repository at this point in the history
* Apply touch TapSize settings for Pen too

* Windows: use GetSystemMetrics only for Mouse pointer type, and call base implementation for rest
  • Loading branch information
maxkatz6 committed Dec 19, 2024
1 parent 5cc111c commit 04231a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Avalonia.Base/Platform/DefaultPlatformSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public virtual Size GetTapSize(PointerType type)
{
return type switch
{
PointerType.Touch => new(10, 10),
PointerType.Touch or PointerType.Pen => new(10, 10),
_ => new(4, 4),
};
}
Expand All @@ -27,7 +27,7 @@ public virtual Size GetDoubleTapSize(PointerType type)
{
return type switch
{
PointerType.Touch => new(16, 16),
PointerType.Touch or PointerType.Pen => new(16, 16),
_ => new(4, 4),
};
}
Expand Down
8 changes: 4 additions & 4 deletions src/Windows/Avalonia.Win32/Win32PlatformSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ public override Size GetTapSize(PointerType type)
{
return type switch
{
PointerType.Touch => new(10, 10),
_ => new(GetSystemMetrics(SystemMetric.SM_CXDRAG), GetSystemMetrics(SystemMetric.SM_CYDRAG)),
PointerType.Mouse => new(GetSystemMetrics(SystemMetric.SM_CXDRAG), GetSystemMetrics(SystemMetric.SM_CYDRAG)),
_ => base.GetTapSize(type)
};
}

public override Size GetDoubleTapSize(PointerType type)
{
return type switch
{
PointerType.Touch => new(16, 16),
_ => new(GetSystemMetrics(SystemMetric.SM_CXDOUBLECLK), GetSystemMetrics(SystemMetric.SM_CYDOUBLECLK)),
PointerType.Mouse => new(GetSystemMetrics(SystemMetric.SM_CXDOUBLECLK), GetSystemMetrics(SystemMetric.SM_CYDOUBLECLK)),
_ => base.GetDoubleTapSize(type)
};
}

Expand Down

0 comments on commit 04231a4

Please sign in to comment.