Vixen
dd8b0a81
csharp
public static class PlatformCursor

Turns what the cascade says the pointer should look like into what the window shows.

Read the guide page for this →

Remarks

The other half of PlatformInput, and it was missing. UiDocument.Cursor resolved cursor: pointer correctly from the day it was written and nothing ever read it — so every cursor-* utility class in every theme scored works against a probe that asked the document, and changed nothing a user could see. cursor-pointer was in exactly the same position as cursor-help.

⚠ Not gated on Cursor, deliberately. The flag says the pointer can be hidden, confined or put into relative mode; drawing a stock cursor is CursorShape, which every window implements and which the platforms with no pointer at all — iOS, Android — implement as a setter that does nothing and a getter that answers Arrow. Gating would also make this untestable, because the only platform a test can open a window on is the headless one and it advertises MultiWindow and nothing else — a wire whose one gate is a flag no test can set is a wire nobody would ever find out had stopped working.

⚠ CursorMode is touched only to hide and unhide, and only from Normal. cursor: none has to be able to do something or it is another silent no-op, and hiding is the only way to say it. But a game that put the window into Relative for mouse-look has an interface drawn over the top of it, and a stylesheet that dragged the pointer back out of relative mode between frames would be a camera that stops turning.

Methods (2)

  • public static CursorShape ToShape(UiCursor cursor)

    What a stylesheet's answer looks like as a stock cursor.

  • public static IWindow? Apply(PlatformWindowHost host)

    Tells the window under the pointer what the cascade says the pointer looks like.

Used by (3)

  • PlatformCursorTestsVixen.Platform.Ui.Tests
  • UiApplicationVixen.Ui.Desktop
  • EditorHostVixen.Editor.Host