Browse Source
Merge pull request #8251 from Oxc3/bug/wasm-keyboard-event-failing-android
RazorViewTopLevel will now test keys first on Code, then Key as a backup
pull/8252/head
Max Katz
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
11 additions and
4 deletions
-
src/Web/Avalonia.Web.Blazor/AvaloniaView.razor.cs
-
src/Web/Avalonia.Web.Blazor/RazorViewTopLevelImpl.cs
|
|
|
@ -233,12 +233,12 @@ namespace Avalonia.Web.Blazor |
|
|
|
|
|
|
|
private void OnKeyDown(KeyboardEventArgs e) |
|
|
|
{ |
|
|
|
_topLevelImpl.RawKeyboardEvent(RawKeyEventType.KeyDown, e.Code, GetModifiers(e)); |
|
|
|
_topLevelImpl.RawKeyboardEvent(RawKeyEventType.KeyDown, e.Code, e.Key, GetModifiers(e)); |
|
|
|
} |
|
|
|
|
|
|
|
private void OnKeyUp(KeyboardEventArgs e) |
|
|
|
{ |
|
|
|
_topLevelImpl.RawKeyboardEvent(RawKeyEventType.KeyUp, e.Code, GetModifiers(e)); |
|
|
|
_topLevelImpl.RawKeyboardEvent(RawKeyEventType.KeyUp, e.Code, e.Key, GetModifiers(e)); |
|
|
|
} |
|
|
|
|
|
|
|
private void OnInput(ChangeEventArgs e) |
|
|
|
|
|
|
|
@ -91,9 +91,16 @@ namespace Avalonia.Web.Blazor |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void RawKeyboardEvent(RawKeyEventType type, string key, RawInputModifiers modifiers) |
|
|
|
public void RawKeyboardEvent(RawKeyEventType type, string code, string key, RawInputModifiers modifiers) |
|
|
|
{ |
|
|
|
if (Keycodes.KeyCodes.TryGetValue(key, out var avkey)) |
|
|
|
if (Keycodes.KeyCodes.TryGetValue(code, out var avkey)) |
|
|
|
{ |
|
|
|
if (_inputRoot is { }) |
|
|
|
{ |
|
|
|
Input?.Invoke(new RawKeyEventArgs(KeyboardDevice, Timestamp, _inputRoot, type, avkey, modifiers)); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (Keycodes.KeyCodes.TryGetValue(key, out avkey)) |
|
|
|
{ |
|
|
|
if (_inputRoot is { }) |
|
|
|
{ |
|
|
|
|