LineProxy

A line on the current Lucid document

Extends


Constructors

new LineProxy()

new LineProxy(id, client): LineProxy

Parameters

ParameterTypeDescription
idstringID of this item
clientEditorClient

Returns

LineProxy

Inherited from

ItemProxy.constructor


Properties

allShapeData

readonly allShapeData: MapProxy<string, SerializedFieldType | DataError>;

All shape data accessible on this element, including shape data inherited from the page or a containing group.
This collection is read-only.

Inherited from

ItemProxy.allShapeData


client

protected readonly client: EditorClient;

Inherited from

ItemProxy.client


id

readonly id: string;

ID of this item

Inherited from

ItemProxy.id


properties

readonly properties: WriteableMapProxy<string, JsonSerializable, void, JsonSerializable>;

All properties available on this element, organized by name.
Not all properties are writeable (e.g. "ClassName" on a block).
To move or resize elements, use setLocation() or setBoundingBox() or offset() instead.

Inherited from

ItemProxy.properties


referenceKeys

readonly referenceKeys: MapProxy<string | number, ReferenceKeyProxy>;

The set of reference keys, organized by their ID, which can be either a string or number.

For more information, see the Developer Guide.

Inherited from

ItemProxy.referenceKeys


shapeData

readonly shapeData: ShapeDataProxy;

The shape data set directly on this element (not including any shape data inherited from the page or a containing group).

Inherited from

ItemProxy.shapeData


textAreas

readonly textAreas: WriteableMapProxy<string, string, undefined, string>;

The plain text in each of the text areas on this item, organized by text area name.

Inherited from

ItemProxy.textAreas


textStyles

readonly textStyles: WriteableMapProxy<string, TextStyle, Promise<undefined>, Partial<TextStyle>>;

The text style in each of the text areas on this item, organized by text area name.

Inherited from

ItemProxy.textStyles


Methods

addTextArea()

addTextArea(text, position): string

Adds a new text area to this line at the given location with the given initial plain text.
The text will be styled with the document theme, if any.

Parameters

ParameterTypeDescription
textstring
positionLineTextAreaPositioning

Returns

string

The name of the text area added


applyRule()

applyRule(rule): void

Parameters

ParameterTypeDescription
ruleRuleProxyRule to apply to this item

Returns

void

Inherited from

ItemProxy.applyRule


changeZOrder()

changeZOrder(operation): void

Parameters

ParameterTypeDescription
operationZOrderOperationHow to adjust the Z order of this item relative to the other items it overlaps on the page

Returns

void

Inherited from

ItemProxy.changeZOrder


delete()

delete(): void

Delete this item from the document

Returns

void

Inherited from

ItemProxy.delete


deleteTextArea()

deleteTextArea(name): void

Deletes the given text area from the line, if it exists.

Parameters

ParameterTypeDescription
namestring

Returns

void


executeFormula()

executeFormula(formula): SerializedFieldType | DataError

Execute a formula in the context of this element

Parameters

ParameterTypeDescription
formulastringThe formula text, e.g. "@a + @b" to add together the shape data values a and b.

Returns

SerializedFieldType | DataError

The result of the formula, or an error.

Inherited from

ItemProxy.executeFormula


exists()

exists(): boolean

Returns

boolean

true if this element still exists on the document, or false otherwise

Inherited from

ItemProxy.exists


getBoundingBox()

getBoundingBox(): Box

Returns

Box

The bounding box of this item relative to its containing page. As pages may change size
to fit the content on them, note that these coordinates may be negative or very large.

If this is a rotated block, the bounding box returned here is where the block would be if it were
unrotated.

Inherited from

ItemProxy.getBoundingBox


getConnectedLines()

getConnectedLines(): LineProxy[]

Returns

LineProxy[]

A list of lines whose endpoints are connected to this line


getContainers()

getContainers(): BlockProxy[]

Returns

BlockProxy[]

An array of blocks whose bounding boxes contain this item's upper-left corner

Inherited from

ItemProxy.getContainers


getDownstreamConnection()

getDownstreamConnection(): undefined | void | BlockProxy | LineProxy

Returns

undefined | void | BlockProxy | LineProxy

The block or line connected to the second endpoint of this line, or undefined if none


getEndpoint1()

getEndpoint1(): EndpointDefinition & object

Returns

EndpointDefinition & object

The definition of the first endpoint of this line


getEndpoint2()

getEndpoint2(): EndpointDefinition & object

Returns

EndpointDefinition & object

The definition of the second endpoint of this line


getLocation()

getLocation(): object

Returns

object

The x/y location of this item

x
x: number = bb.x;
y
y: number = bb.y;

Inherited from

ItemProxy.getLocation


getPage()

getPage(): PageProxy

Returns

PageProxy

The page containing this item

Inherited from

ItemProxy.getPage


getPageId()

getPageId(): string

Returns

string

The ID of the page containing this item

Inherited from

ItemProxy.getPageId


getRelativePosition()

getRelativePosition(relative): Point

Parameters

ParameterTypeDescription
relativenumberA distance, between 0 and 1, between the first and second endpoint of this line

Returns

Point

The coordinate of that relative position, relative to the containing page


getShape()

getShape(): LineShape

Returns

LineShape


getTextAreaPosition()

getTextAreaPosition(name): undefined | LineTextAreaPositioning

Parameters

ParameterTypeDescription
namestring

Returns

undefined | LineTextAreaPositioning

The position of the given text area on this line, if it exists, or undefined if it does not exist.


getUpstreamConnection()

getUpstreamConnection(): undefined | void | BlockProxy | LineProxy

Returns

undefined | void | BlockProxy | LineProxy

The block or line connected to the first endpoint of this line, or undefined if none


measureText()

measureText(name, maxWidth): MeasureTextResult

Measure the amount of space necessary to render the text in the given text area, given a
width to measure that text within.

Parameters

ParameterTypeDescription
namestringName of the text area whose content we should measure
maxWidthnumberWidth of the area in which to measure this text. The result will usually be no wider than this, but if a single word is long enough to go beyond this maxWidth, the width of that word will be returned.

Returns

MeasureTextResult

The size of rectangle necessary to render this text area's content.

Inherited from

ItemProxy.measureText


offset()

offset(type, offset): void

Offset this item in the given direction by the given amount.

Parameters

ParameterTypeDescription
typeLinearOffsetTypeThe type of offset to apply to this item
offsetPointThe amount to offset

Returns

void

Inherited from

ItemProxy.offset


removeReferenceKey()

removeReferenceKey(key): void

Remove the specified reference key from this element.

Parameters

ParameterTypeDescription
keystring | number

Returns

void

Inherited from

ItemProxy.removeReferenceKey


setBoundingBox()

setBoundingBox(bb): void

Attempts to move and resize this item to fit into the given bounding box. If this item (or another
item it contains) has size or aspect ratio restrictions, it may not be possible to fit the requested
location exactly.

This is done by moving this item to the requested location, then attempting to resize it from the
bottom-right corner to the requested size.

Parameters

ParameterTypeDescription
bbBoxThe bounding box to attempt to make this item fill

Returns

void

Inherited from

ItemProxy.setBoundingBox


setEndpoint1()

setEndpoint1(endpoint): void

Update the first endpoint of this line

Parameters

ParameterTypeDescription
endpointEndpointDefinitionLine endpoint definition

Returns

void


setEndpoint2()

setEndpoint2(endpoint): void

Update the second endpoint of this line

Parameters

ParameterTypeDescription
endpointEndpointDefinitionLine endpoint definition

Returns

void


setLocation()

setLocation(location): void

Moves this item so that its upper-left corner is positioned at the given location (prior to any rotation)

Parameters

ParameterTypeDescription
locationPointThe target location

Returns

void

Inherited from

ItemProxy.setLocation


setReferenceKey()

setReferenceKey(key, settings): void

Set a reference key on this element, replacing any existing reference at the specified key.

Parameters

ParameterTypeDescription
keystring | number
settingsReferenceKeyDefinition

Returns

void

Inherited from

ItemProxy.setReferenceKey


setShape()

setShape(shape): void

Parameters

ParameterType
shapeLineShape

Returns

void


setTextAreaPosition()

setTextAreaPosition(name, position): void

Updates the position of the given text area, if it exists. If not, an error is thrown.

Parameters

ParameterTypeDescription
namestring
positionLineTextAreaPositioning

Returns

void


unapplyRule()

unapplyRule(rule): void

Parameters

ParameterTypeDescription
ruleRuleProxyRule to remove from this item

Returns

void

Inherited from

ItemProxy.unapplyRule