Browse Source

Fix crash on Cursor.Parse in DevTools

pull/11086/head
Max Katz 3 years ago
parent
commit
bf06f075cb
  1. 13
      src/Avalonia.Base/Input/Cursor.cs

13
src/Avalonia.Base/Input/Cursor.cs

@ -42,19 +42,21 @@ namespace Avalonia.Input
public class Cursor : IDisposable
{
public static readonly Cursor Default = new Cursor(StandardCursorType.Arrow);
private string _name;
internal Cursor(ICursorImpl platformImpl)
private Cursor(ICursorImpl platformImpl, string name)
{
PlatformImpl = platformImpl;
_name = name;
}
public Cursor(StandardCursorType cursorType)
: this(GetCursorFactory().GetCursor(cursorType))
: this(GetCursorFactory().GetCursor(cursorType), cursorType.ToString())
{
}
public Cursor(IBitmap cursor, PixelPoint hotSpot)
: this(GetCursorFactory().CreateCursor(cursor.PlatformImpl.Item, hotSpot))
: this(GetCursorFactory().CreateCursor(cursor.PlatformImpl.Item, hotSpot), "BitmapCursor")
{
}
@ -73,5 +75,10 @@ namespace Avalonia.Input
{
return AvaloniaLocator.Current.GetRequiredService<ICursorFactory>();
}
public override string ToString()
{
return _name;
}
}
}

Loading…
Cancel
Save