Vixen
02b45cc4
csharp
public static class PlatformInput

Turns what a window reports into what a document understands.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The assembly this was always going to live in. Vixen.Ui is a Core/ assembly and Vixen.Platform is not, so the framework cannot depend on the thing that produces these events — the layering doc 00 makes non-negotiable, and the reason a UI framework stays usable with no backend at all. Samples/02-HelloUi and Vixen.Editor.App each carried a copy of this file and each copy said the same thing: that a Vixen.Platform.Ui is where it goes once there is a second consumer.

The key conversion is a cast, by construction. Vixen.Platform.Key and Vixen.Input.InputKey are both the USB HID usage table and InputKeyMatchesPlatformKeyTests asserts it member by member — so there is no translation table here and there must never be one, because a table is a thing that can drift.

⚠ Every pointer event names the surface it happened in. A document can be shown in several windows, and two windows do not share a coordinate space: an event delivered to the wrong one lands at the right numbers in the wrong place, which looks like a hit-test bug and is a routing one. The window id an event carries is what decides, and TryResolve is what turns it into a surface.

Fields and properties (1)

  • public const float WheelLineHeight

    How far one notch of the wheel scrolls, in device-independent pixels.

Methods (2)

  • public static bool Dispatch(UiDocument document, in PlatformEvent platformEvent)

    Sends one platform event to a document's primary surface.

  • public static bool Dispatch(UiDocument document, UiSurface surface, in PlatformEvent platformEvent, float wheelLineHeight = 48)

    Sends one platform event to the surface the window it names is showing.

Used by (2)

  • UiHostHelloUi
  • EditorHostVixen.Editor.Host