Constructor

RenderedConnection

new RenderedConnection(source, type)

Class for a connection between blocks that may be rendered on screen.

Parameter

source

Blockly.Block

The block establishing this connection.

Value must not be null.

type

number

The type of the connection.

Extends
Blockly.Connection

Properties

db_

protected

unknown

Connection database for connections of this type on the current workspace.

Inherited from
Blockly.Connection#db_

dbOpposite_

protected

unknown

Connection database for connections compatible with this type on the current workspace.

Inherited from
Blockly.Connection#dbOpposite_

hidden_

protected

unknown

Whether this connections is hidden (not tracked in a database) or not.

Inherited from
Blockly.Connection#hidden_

inDB_

protected

unknown

Has this connection been added to the connection database?

Inherited from
Blockly.Connection#inDB_

sourceBlock_

protected

unknown

Inherited from
Blockly.Connection#sourceBlock_

targetConnection

unknown

Connection this connection connects to. Null if not connected.

Inherited from
Blockly.Connection#targetConnection

type

unknown

Inherited from
Blockly.Connection#type

x_

protected

unknown

Horizontal location of this connection.

Inherited from
Blockly.Connection#x_

y_

protected

unknown

Vertical location of this connection.

Inherited from
Blockly.Connection#y_

Methods

checkType_

protected

checkType_(otherConnection) returns boolean

Is this connection compatible with another connection with respect to the value type system. E.g. square_root("Hello") is not compatible.

Parameter

otherConnection

Connection to compare against.

Value must not be null.

Inherited from
Blockly.Connection#checkType_
Returns

True if the connections share a type.

closest

closest(maxLimit, dxy) returns Object

Find the closest compatible connection to this connection. All parameters are in workspace units.

Parameter

maxLimit

number

The maximum radius to another connection.

dxy

goog.math.Coordinate

Offset between this connection's location in the database and the current location (as a result of dragging).

Value must not be null.

Returns

non-null {connection: nullable Blockly.Connection, radius: number} Contains two properties: 'connection' which is either another connection or null, and 'radius' which is the distance.

connect

connect(otherConnection)

Connect this connection to another connection.

Parameter

otherConnection

Connection to connect to.

Value must not be null.

Inherited from
Blockly.Connection#connect

disconnect

disconnect()

Disconnect this connection.

Inherited from
Blockly.Connection#disconnect

dispose

dispose()

Sever all links to this connection (not including from the source object).

Inherited from
Blockly.Connection#dispose

distanceFrom

distanceFrom(otherConnection) returns number

Returns the distance between this connection and another connection in workspace units.

Parameter

otherConnection

Blockly.Connection

The other connection to measure the distance to.

Value must not be null.

Returns

number The distance between connections, in workspace units.

getCheck

public

getCheck() returns Array

Get a connection's compatibility.

Inherited from
Blockly.Connection#getCheck
Returns

List of compatible value types. Null if all types are compatible.

getShadowDom

getShadowDom() returns Element

Return a connection's shadow block.

Inherited from
Blockly.Connection#getShadowDom
Returns

shadow DOM representation of a block or null.

getSourceBlock

getSourceBlock() returns Blockly.Block

Get the source block for this connection.

Inherited from
Blockly.Connection#getSourceBlock
Returns

The source block, or null if there is none.

hideAll

hideAll()

Hide this connection, as well as all down-stream connections on any block attached to this connection. This happens when a block is collapsed. Also hides down-stream comments.

highlight

highlight()

Add highlighting around this connection.

isConnected

isConnected() returns boolean

Is the connection connected?

Inherited from
Blockly.Connection#isConnected
Returns

True if connection is connected to another connection.

isConnectionAllowed

isConnectionAllowed(candidate, maxRadius) returns boolean

Check if the two connections can be dragged to connect to each other.

Parameter

candidate

Blockly.Connection

A nearby connection to check.

Value must not be null.

maxRadius

number

The maximum radius allowed for connections, in workspace units.

Returns

boolean True if the connection is allowed, false otherwise.

isSuperior

isSuperior() returns boolean

Does the connection belong to a superior block (higher in the source stack)?

Inherited from
Blockly.Connection#isSuperior
Returns

True if connection faces down or right.

moveBy

moveBy(dx, dy)

Change the connection's coordinates.

Parameter

dx

number

Change to x coordinate, in workspace units.

dy

number

Change to y coordinate, in workspace units.

moveTo

moveTo(x, y)

Change the connection's coordinates.

Parameter

x

number

New absolute x coordinate, in workspace coordinates.

y

number

New absolute y coordinate, in workspace coordinates.

moveToOffset

moveToOffset(blockTL)

Move this connection to the location given by its offset within the block and the location of the block's top left corner.

Parameter

blockTL

goog.math.Coordinate

The location of the top left corner of the block, in workspace coordinates.

Value must not be null.

setCheck

setCheck(check) returns Blockly.Connection

Change a connection's compatibility.

Parameter

check

Compatible value type or list of value types. Null if all types are compatible.

Inherited from
Blockly.Connection#setCheck
Returns

The connection being modified (to allow chaining).

setHidden

setHidden(hidden)

Set whether this connections is hidden (not tracked in a database) or not.

Parameter

hidden

boolean

True if connection is hidden.

setOffsetInBlock

setOffsetInBlock(x, y)

Set the offset of this connection relative to the top left of its block.

Parameter

x

number

The new relative x, in workspace units.

y

number

The new relative y, in workspace units.

setShadowDom

setShadowDom(shadow)

Change a connection's shadow block.

Parameter

shadow

DOM representation of a block or null.

Inherited from
Blockly.Connection#setShadowDom

targetBlock

targetBlock() returns Blockly.Block

Returns the block that this connection connects to.

Inherited from
Blockly.Connection#targetBlock
Returns

The connected block or null if none is connected.

toString

toString() returns string

This method returns a string describing this Connection in developer terms (English only). Intended to on be used in console logs and errors.

Inherited from
Blockly.Connection#toString
Returns

The description.

unhideAll

unhideAll() returns Array of non-null Blockly.Block

Unhide this connection, as well as all down-stream connections on any block attached to this connection. This happens when a block is expanded. Also unhides down-stream comments.

Returns

non-null Array of non-null Blockly.Block List of blocks to render.

unhighlight

unhighlight()

Remove the highlighting around this connection.