Color legend plain property method event
A move, rotate and scale gizmo over a target: arms with a square between each pair, or rings, at the target’s pivot, the same size on screen at any distance, picked and dragged with the pointer.
A sealed class, IDisposable. The quick start guide shows it in context, with code.
Names are colored by what they are: a property, a method or an event; values and fields keep the plain color.
Properties
AxisXColor →
Color · The color of the X arm, ring or scale box, and of the YZ plane square. (220, 70, 70), a red, by default. A hovered handle is drawn halfway toward white.
AxisYColor →
Color · The color of the Y arm, ring or scale box, and of the XZ plane square. (90, 210, 90), a green, by default.
AxisZColor →
Color · The color of the Z arm, ring or scale box, and of the XY plane square. (80, 140, 230), a blue, by default.
CenterColor →
Color · The color of the pivot square. (210, 210, 210), a light gray, by default.
IsDragging →
bool · Read-only. Whether a drag is running: from a TryBeginDrag that returned true until Update sees the button up or a null target, or EndDrag is called.
IsHovering →
bool · Read-only. Whether a handle is under the pointer, as of the last Update or TryBeginDrag. true during a drag, for the handle grabbed.
Mode →
GizmoMode · Which handles are up. Translate for a new gizmo. Kept on a mode the target offers: Update, TryBeginDrag and Draw move it to the first offered mode in translate, rotate, scale order when the target doesn’t offer it. Setting it during a drag does nothing.
Space →
GizmoSpace · The preferred frame of move and rotate. Global for a new gizmo. A mode the target offers in one frame only stays in it, and scale is always local. Setting it during a drag does nothing.
Methods
TransformGizmo() →
TransformGizmo(GraphicsDevice graphicsDevice) · A gizmo in Translate mode with the Global frame. Creates the BasicEffect it draws with. Throws ArgumentNullException for a null device.
| Parameter | Type | Description |
|---|---|---|
graphicsDevice |
GraphicsDevice |
The device to draw with. Picking projects into its current viewport. |
CycleMode() →
CycleMode(ITransformGizmoTarget target) · Steps Mode to the next mode the target offers, in translate, rotate, scale order, wrapping round; a lone mode stays. Does nothing for a null target or during a drag.
| Parameter | Type | Description |
|---|---|---|
target |
ITransformGizmoTarget |
The selection, whose capabilities decide the modes offered. |
Dispose() →
Dispose() · Disposes the gizmo’s BasicEffect. Call it when the graphics device goes.
Draw() →
Draw(Camera camera, ITransformGizmoTarget target) · Draws the gizmo at the target’s pivot, over everything: depth testing off, alpha blending on and no culling, with the three states put back after. Draws nothing for a null target or one that offers no mode. Throws ArgumentNullException for a null camera.
| Parameter | Type | Description |
|---|---|---|
camera |
Camera |
The camera the scene is drawn with: its pose, projection and floating-origin offset. |
target |
ITransformGizmoTarget |
The selection, or null when nothing is selected. |
EndDrag() →
EndDrag() · Ends the drag, if one is running, and leaves the pose as the drag left it. Writes nothing and raises nothing: to cancel a drag, put back the pose taken when it began.
ToggleSpace() →
ToggleSpace() · Swaps Space between Global and Local. Does nothing during a drag.
TryBeginDrag() →
TryBeginDrag(Camera camera, ITransformGizmoTarget target, Point mousePixel, Ray mouseRay) · Starts a drag on the handle under the pointer and returns true, capturing the handle, its axis or plane, and the pose it edits. Writes nothing to the target. Returns false and changes nothing when no handle is under the pointer, the target is null or offers no mode, or a drag is running already. Throws ArgumentNullException for a null camera.
| Parameter | Type | Description |
|---|---|---|
camera |
Camera |
The camera the scene is drawn with: its pose, projection and floating-origin offset. |
target |
ITransformGizmoTarget |
The selection, or null when nothing is selected. |
mousePixel |
Point |
The pointer in window pixels, from the top left corner, as the mouse gives it. |
mouseRay |
Ray |
The ray through that pixel, in world coordinates, from ScreenPointToRay. |
Update() →
Update(Camera camera, ITransformGizmoTarget target, Point mousePixel, bool leftButtonDown, Ray mouseRay) · With no drag running, picks the handle under the pointer for the hover highlight. During a drag, once the pointer is past the 4-pixel dead zone, writes the dragged pose to the target and raises TransformMutated; ends the drag when the button is up or the target is null. Throws ArgumentNullException for a null camera.
| Parameter | Type | Description |
|---|---|---|
camera |
Camera |
The camera the scene is drawn with: its pose, projection and floating-origin offset. |
target |
ITransformGizmoTarget |
The selection, or null when nothing is selected. During a drag, the target the drag was grabbed on. |
mousePixel |
Point |
The pointer in window pixels, from the top left corner, as the mouse gives it. |
leftButtonDown |
bool |
Whether the button that drags is held, the frame it went down included. |
mouseRay |
Ray |
The ray through that pixel, in world coordinates, from ScreenPointToRay. |
Events
TransformMutated →
(ITransformGizmoTarget target) · An Action<ITransformGizmoTarget>, raised by Update each frame a drag writes a pose: every frame of a drag past the dead zone, whether the pointer moved or not, but for a rotate frame with no usable angle or a square move frame with no usable point. A click that never leaves the dead zone raises nothing.
| Parameter | Type | Description |
|---|---|---|
target |
ITransformGizmoTarget |
The target the pose was written to. |