Skip to main content

LensStudio:Ui.Size

Class

Represents width and height dimensions.

Index

Properties

Example

// Size represents a 2D dimension (width x height) in pixels.
// Commonly used to configure the default and minimum size of a panel
// via the PanelPlugin Descriptor.
export class MyPanel extends PanelPlugin {
static descriptor() {
const d = new Descriptor();
d.id = 'com.docs.MyPanel';
d.name = 'My Panel';
d.defaultDockState = DockState.Detached;
// Panel opens at 400x300 and cannot be resized below 200x150.
d.defaultSize = new Size(400, 300);
d.minimumSize = new Size(200, 150);
return d;
}
createWidget(parent: Widget): Widget {
const root = new Widget(parent);
const layout = new BoxLayout();
layout.setDirection(Direction.TopToBottom);
root.layout = layout;
return root;
}
}

Constructors

Constructor

new Size(width, height): Size

Constructs a new Size object representing a two-dimensional size value with width and height.

Parameters

ParameterType
widthnumber
heightnumber

Returns

Size

Properties

height

height: number

Height component of the size.


width

width: number

Width component of the size.