Skip to main content

Module gizmo

Module gizmo 

Source
Expand description

Gizmo: moving, turning and scaling something in the viewport by dragging a manipulator drawn at it — the one way every operation offers a drag in three dimensions.

An operation asks for a gizmo at a point, with the modes it allows and, if what it stands on has an orientation of its own, its axes (see super::Form::gizmo). The editor draws it, tests the pointer against it, follows a drag of one of its parts and snaps it, and sends the operation what the drag did as a GizmoDrag: a translation, a turn about one of its axes, or a scale along them — always measured from where the drag started, and applied by the operation to its arguments as they were then (see crate::step_editor).

It is laid out in the pointer’s reaches (see super::Reach), so it keeps its size on screen however far away or zoomed in the view is: a ball at its centre to drag freely in the plane facing the eye, an arrow along each axis and a square in each plane of two of them, a ring about each axis, a cube beyond each arrow to stretch along it and one on the diagonal to scale evenly. The viewer draws it by the same sizes, from GizmoView.

Modules§

size
How the gizmo is laid out, in reaches of the pointer at its centre.

Structs§

Gizmo
A gizmo an operation asks for (see super::Form::gizmo): at at, doing what modes allow — oriented along the world’s axes, or axes, what it stands on’s own, orthonormal and right-handed, if it has an orientation of its own: then the user chooses which.
GizmoDrag
What a drag of a gizmo did, from where it started: a Change about centre, where the gizmo stood when the drag started.
GizmoGrab
A drag of a gizmo under way: the gizmo as it was when the part was pressed — what every event of the drag is measured against — the part, how large a reach was there, and how far a turn has gone, to follow it past half a turn.
GizmoView
A gizmo as the viewer draws it: where, along which axes, what it lets the user do, which part the pointer is over and which is dragged, and what a drag under way has done so far, in words.
Modes
What a gizmo lets the user do.

Enums§

Axis
One of a gizmo’s three axes, which picks its own from any three things given per axis. Sent as its index, 0 for x.
Change
What a drag of a gizmo did, from where it started.
GizmoPart
A part of a gizmo, to hover and drag: by its axis.
Orientation
Which way a gizmo is turned: along the world’s axes, or its own.

Constants§

ANGLE_SNAP
What a turn snaps to, in degrees.
GRID
The finest spacing of the grid the viewer draws on a plane worked in, in reaches (20 pixels, a reach being 9): what a translation snaps to is the round step — 1, 2 or 5 times a power of ten — at least this far on screen.
SCALE_SNAP
What a scale factor snaps to.

Functions§

grid_step
The step a translation snaps to, a reach being reach: 1, 2 or 5 times a power of ten, at least GRID reaches.