public sealed class UiSurfaceOne rectangle a document is laid out into, drawn onto and clicked in.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
A document is a tree; a surface is a place to show part of one. Until this existed the two were the same thing — one root, one size, one draw list — and a second window therefore meant a second document. It cannot: a panel dragged from the main window into a torn-off one has to keep its scroll offset, its selection and whatever the user has half-typed, and the only operation that preserves those is Reparent, which is within a document by construction. Making a window a surface rather than a document turns "move a panel to another window" into the reparent the docking host already performs.
⚠ Every surface after the first is an ordinary element under Root, and that is deliberate. It keeps one style tree, so a torn-off panel inherits the theme, matches the same stylesheets and resolves rem against the same root — and it keeps one focus, one pointer capture and one gesture recogniser, which is what lets a drag that starts in one window finish in another. What the surface root does not do is take part in its parent's flex layout: it is removed from the layout tree's child list and laid out on its own, against its own size.
⚠ DpiScale is per surface, because two windows are routinely on two displays. It is not a scale the document applies to anything — lengths stay in logical points everywhere above the renderer — it is the grid the finished layout is snapped to, so that a one-pixel border on a 2× display is one physical pixel rather than one and a half.
Fields and properties (10)
public int IdWhat tells the surfaces of one document apart.
public UiDocument DocumentThe document it shows part of.
public UiElement RootThe element it is laid out from.
public bool IsPrimaryWhether this is the surface the document was created with.
public float WidthIts width in device-independent pixels.
public float HeightIts height.
public float DpiScaleHow many physical pixels one device-independent one is here.
public DrawList DrawingThe commands the last draw produced for it.
public bool IsRemovedWhether it has been taken out of the document.
public LengthContext MetricsThe lengths vw, vh and rem measure against here.
Used by (15)
- AdvancedFixtureVixen.Ui.Controls.Advanced.Tests
- DockingHostVixen.Ui.Controls.Advanced
- FakeWindowVixen.Ui.Controls.Advanced.Tests
- FakeWindowsVixen.Ui.Controls.Advanced.Tests
- IUiWindowVixen.Ui
- IUiWindowHostVixen.Ui
- PlatformInputVixen.Platform.Ui
- PlatformUiWindowVixen.Platform.Ui
- PlatformWindowHostVixen.Platform.Ui
- PlatformWindowHostTestsVixen.Platform.Ui.Tests
- SurfaceTestsVixen.Ui.Tests
- UiDocumentVixen.Ui
- UiElementVixen.Ui
- EditorHostVixen.Editor.Host
- EditorPaneVixen.Editor.Host