position([x_or_position], [y], [right], [bottom])

Class: DocumentEditor. Method inherited from UIComponent.

Description:

Sets or gets the position of the component relative to its parent component's top-let corner (or to the screen's top-left corner when component is Window).

Parameters:

Name Type Description

[x_or_position]

number | Point

X position. Alternatively, provide a single Point object parameter to specify the position.

[y]

number

Y position.

[right]

number

Resizes the component so that its right edge is this many pixels from the right edge of the parent component or screen.

[bottom]

number

Resizes the component so that its bottom edge is this many pixels from the bottom edge of the parent component or screen.

Returns:

If no arguments are provided, returns a {x: number, y: number} position object. Otherwise, returns this component.

Type: Point | this

Examples:

panel.size(50, 100); // sets position
panel.size({x: 50, y: 100}); // sets position
panel.size(50, 100, 20); // sets position of left, top and right sides relative to sides of parent component.
const window = new Window("New Window").size(50, 100, 20, 20); // sets position of each side relative to sides of screen.

Also See: