Browse Source
Merge pull request #7300 from Mikolaytis/WasmCursors
[WASM] Fix cursors in macOS, fix default cursor set logic
pull/7310/head
Dan Walmsley
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
7 additions and
7 deletions
-
src/Web/Avalonia.Web.Blazor/AvaloniaView.razor.cs
-
src/Web/Avalonia.Web.Blazor/RazorViewTopLevelImpl.cs
|
|
|
@ -259,7 +259,11 @@ namespace Avalonia.Web.Blazor |
|
|
|
|
|
|
|
_inputHelper.Hide(); |
|
|
|
_canvasHelper.SetCursor("default"); |
|
|
|
_topLevelImpl.SetCssCursor = _canvasHelper.SetCursor; |
|
|
|
_topLevelImpl.SetCssCursor = x => |
|
|
|
{ |
|
|
|
_inputHelper.SetCursor(x);//macOS
|
|
|
|
_canvasHelper.SetCursor(x);//windows
|
|
|
|
}; |
|
|
|
|
|
|
|
Console.WriteLine("starting html canvas setup"); |
|
|
|
_interop = await SKHtmlCanvasInterop.ImportAsync(Js, _htmlCanvas, OnRenderFrame); |
|
|
|
|
|
|
|
@ -127,15 +127,11 @@ namespace Avalonia.Web.Blazor |
|
|
|
|
|
|
|
public void SetCursor(ICursorImpl cursor) |
|
|
|
{ |
|
|
|
var cur = cursor as CssCursor; |
|
|
|
var val = CssCursor.Default; |
|
|
|
if (cur != null && cur.Value != null) |
|
|
|
{ |
|
|
|
val = cur.Value; |
|
|
|
} |
|
|
|
var val = (cursor as CssCursor)?.Value ?? CssCursor.Default; |
|
|
|
if (_currentCursor != val) |
|
|
|
{ |
|
|
|
SetCssCursor?.Invoke(val); |
|
|
|
_currentCursor = val; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|