Vixen
feb85697
csharp
public sealed class DiagnosticsOverlay

A picture over a document of what DiagnosticsPanel says in rows.

Read the guide page for this →

Remarks

The drawn half of doc 13's UI-debug view. The panel reports the element under the pointer as four rectangles of numbers and the last pass's invalidations as a count; this draws them where they are — four nested outlines round the element, in the CSS colours every browser's inspector uses for the same four boxes, and a translucent wash over every region the last pass invalidated. A number is exact and a picture is legible, and "which element is this" is a question a picture answers first.

⚠ It lives in the document it describes, and that is the only arrangement in which its coordinates mean anything. The boxes are in the subject's space, so an overlay in another document would draw them somewhere else. That is the opposite of the panel's advice — the panel is exact when it is not in the document it counts — and the two are separate controls for exactly this reason: the numbers go in a tools window and the picture goes over the thing. Placed over the whole surface with pointer-events: none, by the theme rule, so that it is never the element under the pointer itself.

⚠ It draws and never writes. OnDraw runs in the middle of a walk emitting commands in painting order, so everything here is a read of the aggregator — the hovered element, its boxes from the layout results, the regions the previous pass recorded — and a stroke or a fill for each. Nothing is styled, added or invalidated, which is what keeps a debug overlay from being part of the churn it shows. A region wash is the previous pass's answer, for the same reason the panel's numbers are a frame old: the regions this pass records are turned at its exit.

The colours are theme tokens — --diagnostics-margin and its siblings — so a dark palette can lift them, with the inspector's conventional values as the fallback a theme that says nothing gets. The wash is deliberately faint: it is drawn over live controls and its job is to say where rather than to hide what.

Fields and properties (7)

  • protected override string TagName

    The element name this type answers to when a caller does not choose one.

  • protected override bool AcceptsFocus

    Whether the focus can rest on this kind of control at all.

  • public UiDocument? Subject

    The document whose element and regions are drawn. Its own, unless another is named.

  • public Vector2? Probe

    A point to describe instead of the pointer, in the subject's coordinates.

  • public bool ShowsRegions

    Whether the last pass's invalidated regions are washed. On by default.

  • public int Outlines

    How many outlines the last draw stroked: four for an element, none for nothing.

  • public int Regions

    How many regions the last draw washed.

Methods (2)

  • protected override void OnCreated()

    Builds whatever this element is made of, once, as it joins a document.

  • protected override void OnDraw(DrawContext context)

    Draws whatever this element is, beyond what a stylesheet can describe.

Used by (5)

  • ShellHelloUi
  • DiagnosticsOverlayTestsVixen.Ui.Controls.Tests
  • DiagnosticsPanelVixen.Ui.Controls
  • DiagnosticsModuleVixen.Editor.Diagnostics
  • UiDiagnosticsPanelTestsVixen.Editor.App.Tests