CrossX

ceramic.Entityceramic.Visualelements.CrossX (Class)

A visual component that renders an X-shaped cross icon.

Creates a cross (×) shape using two rotated quads positioned at 45-degree angles. Commonly used for close buttons, delete actions, or cancel indicators in UI.

The cross automatically scales to fit within the visual's bounds while maintaining proper proportions. Both the line thickness and overall scale can be customized.

Example usage:

var closeButton = new CrossX();
closeButton.size(24, 24);
closeButton.color = Color.RED;
closeButton.thickness = 3;
See: elements.Window For usage in window close buttons

Instance Members

elements
thickness: Float

The thickness of the cross lines in pixels. Default value is 2. Marked with @content to trigger recomputation when changed.


elements
internalScale: Float

Scale factor applied to the cross shape within its bounds. Default value is 1 (no scaling). Values < 1 make the cross smaller within its container. Marked with @content to trigger recomputation when changed.


elements
color: ceramic.Color

The color of the cross. Applies to both diagonal lines. Default is Color.WHITE.


elements
computeContent(): Void

Computes the content layout of the cross. Positions and sizes the two diagonal quads based on current dimensions, thickness, and internal scale settings.

The quads are sized to 70% of the container width to create proper visual balance and ensure the cross fits nicely within its bounds.


elements
new(): Void

Creates a new CrossX visual component. Initializes with a 16x16 size and white color.

Private Members

elements
quad0: ceramic.Quad

First quad component forming one diagonal line of the cross.


elements
quad1: ceramic.Quad

Second quad component forming the other diagonal line of the cross.

Metadata

Name Parameters
:build tracker.macros.EventsMacro.build()
:autoBuild tracker.macros.EventsMacro.build()
:build ceramic.macros.EntityMacro.buildForCompletion()
:autoBuild ceramic.macros.EntityMacro.buildForCompletion()