Creates a new ScaleGizmo object. Use Gizmo.createLayer to create its layer.
The camera component.
The layer responsible for rendering the gizmo.
Protected_The app.
Protected_The camera viewing the gizmo.
Protected_Protected_The graphics device.
Protected_The angle in degrees between the view and a shape below which it fades out.
Protected_The app event handles.
Protected_The render layer.
Protected_The mouse buttons that interact.
Protected_The readout of the drag delta.
Protected_Whether a render update is due.
Protected_The gizmo position at the start of a drag.
Protected_The gizmo rotation at the start of a drag.
Protected_The gizmo scale.
Protected_The selected axis.
Protected_Whether the selected shape is a plane.
Protected_The selected point at the start of a drag, in world space.
Protected_The gizmo shapes.
Protected_Internal theme.
Protected_Whether planes scale uniformly.
Whether to hide the shapes when dragging. Defaults to 'selected'.
Flips the planes to face the camera.
The shapes the gizmo picks.
The lower bound for scaling.
The graph nodes attached to the gizmo.
Whether to call preventDefault on pointer events.
The root gizmo entity.
Whether dragging snaps to the increments. Defaults to false.
The increment angles snap to, in degrees. Defaults to 5.
Protected_Protected
Protected_Protected
Gets whether the gizmo shows only with attached nodes. A getter, so a subclass's value applies while the base constructor runs.
Gets the axis box size.
Sets the axis box size.
Gets the axis center size.
Sets the axis center size.
Gets the angle in degrees below which an axis or plane fades out.
Sets the view angle in degrees below which an axis or plane fades out, hiding at about 8 degrees. Defaults to 25.
Gets the axis gap.
Sets the axis gap.
Gets the axis line length.
Sets the axis line length.
Gets the axis line thickness.
Sets the axis line thickness.
Gets the axis line tolerance.
Sets the axis line tolerance.
Gets the plane gap.
Sets the plane gap.
Gets the plane fill opacity.
Sets the plane fill opacity, as a factor of the theme color alpha. Defaults to 0.35.
Gets the plane outline thickness.
Sets the plane outline thickness; 0 hides the outline. Defaults to 0.01.
Gets the plane size.
Sets the plane size.
Gets the camera component to view the gizmo.
ProtectedcameraProtected
Sets the gizmo coordinate space. Defaults to 'world'.
Gets the gizmo enabled state.
Sets the gizmo enabled state.
ProtectedfacingProtected
Gets the thickness of the guide lines in CSS pixels.
Sets the thickness of the guide lines in CSS pixels. Defaults to 1.
Gets the gizmo render layer.
The mouse buttons that interact with the gizmo, by button index: 0 left, 1 middle, 2 right.
Gets whether to show the drag delta below the gizmo.
Sets whether to show the drag delta in a div.gizmo-readout below the gizmo. For a custom
UI, turn this off and listen to TransformGizmo.EVENT_TRANSFORMREADOUT. Defaults to
true.
Gets the gizmo size.
Sets the gizmo size. Defaults to 1.
Gets the increment lengths and ScaleGizmo factors snap to.
Sets the increment lengths and ScaleGizmo factors snap to. Defaults to 1.
Gets the current theme for the gizmo.
Gets whether planes scale uniformly.
Sets whether planes scale uniformly.
Protected_Protected
The axis to create the plane for.
Whether the axis is facing the camera.
Whether the axis is a line.
Protected_Protected_Protected
Protected_Protected_Protected_Protected_Protected
Gets the scale keeping geometry at a world position a constant size on screen.
The world position.
The scale.
Protected_Protected
Hides a shape when the view looks along its direction, fading it over the fade angle.
The shape.
The absolute cosine of the angle between the view and the direction.
Whether the visibility changed.
Protected_Protected
Formats a readout label in its color.
The label.
The label color.
The label markup.
Protected_Protected
Gets the normal of the plane through a line that best faces the camera, for dragging along the line.
False when the line points at the camera.
Protected_Protected
The point to project.
The axis to project to.
Protected_Protected
Formats a value for each of the axes being dragged.
The value for each axis.
Optionalfactor: boolean = false
Whether the values are factors, not deltas. Defaults to false.
The readout markup.
Protected_Protected
Formats a delta with an explicit sign, positive when it rounds to zero.
The value.
The number of digits after the decimal point.
The signed value.
Protected_Protected
Formats an axis letter in the axis color.
The axis.
The label markup.
Protected_Protected
The x coordinate.
The y coordinate.
The point (space is TransformGizmo#coordSpace).
Protected_Protected
Shows the readout centered below the visible shapes.
The readout markup.
Protected_Protected
Rounds an angle to a multiple of DragGizmo#snapAngleIncrement while snapping.
The angle in degrees.
The angle, snapped while DragGizmo#snap is on.
Protected_Protected
Rounds a length to a multiple of DragGizmo#snapIncrement while snapping, at least one increment so a size never snaps to zero.
The length.
The length, snapped while DragGizmo#snap is on.
Protected_Protected
Rounds a value to a multiple of an increment while snapping.
The value.
The increment.
The value, snapped while DragGizmo#snap is on.
Protected_Protected_Protected
Protected_Protected
Protected_Protected
Set the shape to be enabled or disabled.
The shape axis.
The enabled state of shape.
Fire an event, all additional arguments are passed on to the event listener.
Name of event to fire.
Optionalarg1: any
First argument that is passed to the event handler.
Optionalarg2: any
Second argument that is passed to the event handler.
Optionalarg3: any
Third argument that is passed to the event handler.
Optionalarg4: any
Fourth argument that is passed to the event handler.
Optionalarg5: any
Fifth argument that is passed to the event handler.
Optionalarg6: any
Sixth argument that is passed to the event handler.
Optionalarg7: any
Seventh argument that is passed to the event handler.
Optionalarg8: any
Eighth argument that is passed to the event handler.
Self for chaining.
Test if there are any handlers bound to an event name.
The name of the event to test.
True if the object has handlers bound to the specified event name.
Get the enabled state of the shape.
The shape axis.
Detach an event handler from an event. If callback is not provided then all callbacks are unbound from the event, if scope is not provided then all events with the callback will be unbound.
Use this form to remove all listeners matching a name (and optionally callback/scope). To remove a single known subscription, prefer retaining the EventHandle returned by EventHandler#on / EventHandler#once and calling its EventHandle#off: it removes exactly that subscription and is faster (no scan of the callback list).
Optionalname: string
Name of the event to unbind.
Optionalcallback: HandleEventCallback
Function to be unbound.
Optionalscope: any
Scope that was used as the this when the event is fired.
Self for chaining.
const handler = () => {};
obj.on('test', handler);
obj.off(); // Removes all events
obj.off('test'); // Removes all events called 'test'
obj.off('test', handler); // Removes all handler functions, called 'test'
obj.off('test', handler, this); // Removes all handler functions, called 'test' with scope this
Attach an event handler to an event.
Name of the event to bind the callback to.
Function that is called when event is fired. Note the callback is limited to 8 arguments.
Optionalscope: any = ...
Object to use as 'this' when the event is fired, defaults to current this.
An event handle. For later removal, prefer retaining this handle and calling its EventHandle#off over EventHandler#off with a name/callback: it removes exactly this subscription and is faster (no scan of the callback list).
Attach an event handler to an event. The handler is removed before it is called, so it runs at most once, even if it fires the same event again or throws.
Name of the event to bind the callback to.
Function that is called when event is fired. Note the callback is limited to 8 arguments.
Optionalscope: any = ...
Object to use as 'this' when the event is fired, defaults to current this.
An event handle. For removal before it fires, prefer retaining this handle and calling its EventHandle#off over EventHandler#off with a name/callback: it removes exactly this subscription and is faster (no scan of the callback list).
Sets the theme or partial theme for the gizmo.
The partial theme to set.
Optionaldisabled?: Partial<Color>The disabled color.
OptionalguideBase?: Partial<{ x: Color; y: Color; z: Color }>The guide line colors.
OptionalguideOcclusion?: numberThe guide occlusion value. Defaults to 0.8.
OptionalshapeBase?: Partial<{ f: Color; x: Color; xyz: Color; y: Color; z: Color }>The axis colors.
OptionalshapeHover?: Partial<{ f: Color; x: Color; xyz: Color; y: Color; z: Color }>The hover colors.
StaticcreateCreates a new gizmo layer and adds it to the scene.
The app.
OptionallayerName: string = 'Gizmo'
The layer name. Defaults to 'Gizmo'.
OptionallayerIndex: number = app.scene.layers.layerList.length
The layer index. Defaults to the end of the layer list.
Optionaldepth: boolean = false
Whether the layer keeps the scene depth and sorts transparent mesh instances manually, as overlay gizmos need so occluded parts draw faint. Otherwise it clears depth and draws on top, as transform gizmos need. Defaults to false.
The new layer.
StaticEVENT_Fired when graph nodes are attached.
StaticEVENT_Fired when graph nodes are detached.
StaticEVENT_Fired when the pointer is down on the gizmo.
StaticEVENT_Fired when the pointer is moving over the gizmo.
StaticEVENT_Fired when the pointer is up off the gizmo.
StaticEVENT_Fired when the gizmo's position is updated.
StaticEVENT_Fired when the gizmo render has updated.
StaticEVENT_Fired when the gizmo's rotation is updated.
StaticEVENT_Fired when the gizmo's scale is updated.
StaticEVENT_Fired when the transformation has ended.
StaticEVENT_Fired during the transformation with the dragged point and the pointer's screen position.
StaticEVENT_Fired with the readout value at the start and each step of the transformation, even with
TransformGizmo#readout off. The handler gets the axis, whether it is a plane, and the
value: a Vec3 translation or scale factor, or an angle in degrees. Copy the reused Vec3
to keep it.
StaticEVENT_Fired when the transformation has started.
Handles for scaling Entitys: box-tipped lines along the X, Y and Z axes, planes between them and a center box that scales uniformly. Works with mouse, keyboard and touch input.
Relevant Engine API examples: