Namespace Serenity.Ui.Infrastructure.Editor.Preview
Classes
CompositePreviewBuilder
Builds a composite view into the preview canvas by flex-solving its child regions (reusing the runtime FlexboxSolver + LayoutConfig) and recursing — nested composites recurse, hosted menus are built by MenuPreviewBuilder. SWITCHER containers show their resolved active child. Guards depth and reference cycles like the original wireframe.
MenuPreviewBuilder
Builds a real, themed menu into a preview canvas using the chosen theme's actual prefab templates
(background, title, per-interaction option rows), positioned with a layout pass that mirrors the runtime
UnityMenuLayoutBuilder — direction, gaps, alignment, the horizontal width modes and the
scroll clamp — without needing any runtime services. The components' own scripts do not run in edit mode
(no [ExecuteAlways]), so only their serialized visuals (Image/TMP/Slider state) are rendered.
MenuPreviewResult
What MenuPreviewBuilder reports back about a built menu so the window can overlay info chips, the selected highlight and the scroll affordance, and hit-test clicks to option rows.
PreviewGestureController
Tracks one in-progress move, scale, deform or rotate gesture on the preview: what started it, and the Undo group it should collapse into on release.
PreviewGestureCoordinator
Everything the mouse does over a direct-manipulation preview: hit-testing the pointer against the rendered elements, click-to-select, and running a move/scale/rotate gesture against the selected one.
PreviewGestureHelpPopup
The preview toolbar's "?" popup: a fixed cheat-sheet of the direct-manipulation gestures and their modifier keys, mirroring the "Editing in the preview" section of the HUD cookbook.
PreviewHitTesting
Turns a preview element's live UnityEngine.RectTransform into a rotation-safe PreviewQuad, and resolves mouse points against it: which element is under the pointer, and which handle of the selected one.
PreviewLocalization
Best-effort, edit-mode translation of localization keys for the View Preview, so the preview shows the same text the game would instead of raw keys (which are much longer and overflow the screen).
PreviewOptionTargets
The transition target id an UiOption resolves to for preview navigation: only a TRANSITION
option carries one, every other option previews as non-navigable. Shared by
MenuPreviewBuilder (the live-render OptionTargets) and
SerenityUiWireframePainter (TransitionTarget)
so both preview modes agree on which options navigate. Public (not internal): the Menu module's own
NavigationNodeRowSetBuilder reuses this exact rule too, to derive an editable row's live outbound
edges from a draft's authored options — the same concern, a different assembly.
PreviewOverlayGui
Draws the preview's interaction chrome: hover and selection outlines, the selected element's transform handles, id and readout chips, and the per-handle cursor.
PreviewOverlayPainter
Everything drawn over the rendered frame in response to the mouse: hover and selection chrome, the transform/rotate handles, the live gesture readout, and the cursor the pointer shows over each of them.
PreviewRenderContext
Everything an IViewPreviewRenderer needs to build one live-render frame: the definition to render, the theme supplying visuals, the canvas root to build under (already sized to ReferenceResolution), the selected option, and how to resolve a SWITCHER's active child — the one piece of window-owned interaction state (a wireframe tab click) a composite renderer must agree with the wireframe path on.
PreviewRenderResult
What an IViewPreviewRenderer reports back from Render(PreviewRenderContext) so
the host window can overlay the selection highlight and scroll affordance, hit-test/navigate clicks, and
paint the info-chip strip — without knowing which view kind produced it. Replaces the menu-only
MenuPreviewResult as what the window itself consumes; a menu renderer still builds through
MenuPreviewBuilder and maps its MenuPreviewResult onto this type.
PreviewResolutionPresets
Shared reference-resolution presets and letterboxing math for the editor preview tools (the Composite View Builder wireframe and the View Preview live render). Keeping it in one place means both tools offer the same screen list and scale fixed-px content the same way.
PreviewSceneRenderer
Off-screen render rig for the View Preview tool: a hidden WorldSpace UnityEngine.Canvas sized to the chosen reference resolution, captured by an orthographic UnityEngine.Camera into a UnityEngine.RenderTexture. The caller populates the canvas with real (themed) UI prefabs each frame; the rig renders them and returns the texture for the editor window to blit.
PreviewToolbarAssetCache
The View Preview toolbar's definition/theme dropdown lists, rebuilt only when the project changes —
OnInspectorUpdate repaints continuously, so loading every definition and theme on every frame
would hammer the AssetDatabase (and re-trigger any pending script-reference fix those loads surface,
reload after reload). Extracted from SerenityUiPreviewWindow to keep that file under its
own size ratchet; owns its own UnityEditor.EditorApplication.projectChanged subscription so the window
only has to construct one on open and Dispose() it on close.
PreviewWireframeContext
Everything an IViewPreviewRenderer needs to draw one structural-wireframe frame: the definition, the canvas area to draw into, and the shared SerenityUiWireframePainter — the window's single wireframe drawing collaborator, which already dispatches by definition type and owns the switcher tab-click state a live-render composite renderer resolves its active child through too.
ViewPreviewRendererRegistry
The catalogue of IViewPreviewRenderers an author's definition can be previewed with,
discovered across every currently-compiled editor assembly rather than hardcoded here — mirrors
CutscenePreviewProviderRegistry's role as the cross-assembly registration point a module-owning
assembly cannot be referenced back from. A thin façade over Serenity.Global.Infrastructure.Editor.EditorTypeRegistry`1, shared
with ViewAuthoringToolOpenerRegistry, which discovers every implementation through
Serenity.Global.Infrastructure.Editor.EditorTypeDiscovery instead of requiring each module to push its own registration on
domain reload.
Structs
PreviewElementHandle
One built preview element: which authored element it is, and the container to hit-test it by.
PreviewElementPlacement
One element's placement, as the manipulation stack sees it: everything IHudPlacedElement declares, plus scale, stretch and the parented flag a gesture also has to read.
PreviewInfoChip
One label + accent-color chip the host window paints along the top of the preview band — a view kind's own facts (menu direction, scroll window, "no preview for this kind") reported through InfoChips instead of the window switching on the definition's type.
PreviewInteraction
One interaction raised by a preview window's own static Interacted event, so a listening wizard can
follow what happens in the preview without the preview knowing anything about the wizard.
PreviewOptionHit
One option row an IViewPreviewRenderer built for the live-render preview: the option's own instantiated UnityEngine.RectTransform plus its TRANSITION target (if any), so the host window can overlay the selection highlight and hit-test/navigate clicks without knowing which view kind built it. The live-render counterpart of WireframeOptionHit.
PreviewQuad
One HUD element's footprint, projected into the preview frame: a rotated rectangle rather than an axis-aligned one, since an element can carry rotation.
WireframeOptionHit
One option row SerenityUiWireframePainter painted on its
most recent Draw call, in the same window GUI-space coordinates the window already hit-tests
against in live-render mode. The wireframe-mode counterpart of MenuPreviewResult's
per-option OptionRects/OptionTargets pair, so the window can navigate a TRANSITION option
the same way in both preview modes. Public: it is also the return type of
DrawWireframe(PreviewWireframeContext), crossing the host/renderer boundary.
Interfaces
IPreviewPlacementTarget
What PreviewGestureCoordinator and PreviewOverlayPainter need from whatever they are previewing: reading and writing one element's placement by index, and the identity to raise an interaction with. A HUD element and a leaderboard view element in the designer are both screen-anchored with HUD-style offsets, so either can satisfy this without the manipulation stack knowing which one it is.
IViewPreviewRenderer
One view kind's own live-render and wireframe drawing, so SerenityUiPreviewWindow (the
preview HOST) dispatches to whichever renderer claims the definition in focus instead of switching on
its concrete type. A view kind whose own editor assembly cannot be referenced back by the Ui editor
assembly (Leaderboard, Achievements, …) registers its renderer by simply declaring a public,
parameterless-constructible implementation — ViewPreviewRendererRegistry discovers it
across assemblies via Serenity.Global.Infrastructure.Editor.EditorTypeDiscovery, the same
way SignalFlowScanner discovers [AutoRegisterEventAction] reactions and
AchievementConditionTypeMenu discovers condition node types.
Enums
PreviewGestureKind
What a preview gesture is doing to the element it grabbed.
PreviewHandle
Which part of the selected element's gizmo a gesture grabbed.
PreviewInteractionKind
What kind of interaction happened in the preview.
Delegates
PreviewTransitionResolver
Resolves a menu-transition target id to the UnityViewDefinition the View Preview should navigate to. This is the seam a wizard injects (see ShowFor(UnityViewDefinition, UnityUiThemeDefinition, PreviewTransitionResolver) and UpdateOpenWindow(UnityViewDefinition, PreviewTransitionResolver)) so a transition that targets one of the wizard's own unsaved sibling drafts resolves to that scratch instance instead of failing to find a saved asset carrying the same id.