Class: RenderedConnection

Constructor

RenderedConnection

new RenderedConnection(source, type)

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

Parameter

source

Blockly.BlockSvg

The block establishing this connection.

Value must not be null.

type

number

The type of the connection.

Extends
Blockly.Connection

Properties

disposed

package

unknown

Has this connection been disposed of?

Inherited from
Blockly.Connection#disposed

sourceBlock_

non-null Blockly.BlockSvg

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

Blockly.utils.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

package

dispose()

Dispose of this connection. Deal with connected blocks and remove this connection from the database.

Inherited from
Blockly.RenderedConnection#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.

getOffsetInBlock

package

getOffsetInBlock() returns Blockly.utils.Coordinate

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

Returns

non-null Blockly.utils.Coordinate The offset of the connection.

getParentInput

package

getParentInput() returns Blockly.Input

Get the parent input of a connection.

Inherited from
Blockly.Connection#getParentInput
Returns

The input that the connection belongs to or null if no parent exists.

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

Optional

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

Blockly.utils.Coordinate

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

Value must not be null.

onFailedConnect

package

onFailedConnect(otherConnection)

Behavior after a connection attempt fails.

Parameter

otherConnection

Blockly.Connection

Connection that this connection failed to connect to.

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.