TX Text Control .NET Server

Javascript: LineCollection.getItemAtLocation Method

Method|Introduced in 28.0

Description

Gets the line at a certain geometrical position.

Syntax

<void> LineCollection.getItemAtLocation(<number> x, <number> y, <RequestLineCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
x

Specifies the line's horizontal location in pixels with an origin at the top left corner of the corner.

y

Specifies the line's vertical location in pixels with an origin at the top left corner of the corner.

callback

Receives the line at a certain geometrical position.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example demonstrates LineCollection.getItemAtLocation in a practical document-editing workflow. It gets the line at a certain geometrical position.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

function inspectItemAtLocation(lines) {
    lines.getItemAtLocation(
        1,
        1,
        function(result) {
            if (!result) {
                console.warn("No line was returned.");
                return;
            }
            
            console.log("get item at location result:", result);
        },
        onTxError
    );
}