Skip to main content

blockly > RenderedConnection

RenderedConnection class

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

Signature:

export declare class RenderedConnection extends Connection implements IContextMenu, IFocusableNode 

Extends: Connection

Implements: IContextMenu, IFocusableNode

Constructors

Constructor

Modifiers

Description

(constructor)(source, type)

Constructs a new instance of the RenderedConnection class

Properties

Property

Modifiers

Type

Description

sourceBlock_

BlockSvg

targetConnection

RenderedConnection | null

Connection this connection connects to. Null if not connected.

Methods

Method

Modifiers

Description

canBeFocused()

See IFocusableNode.canBeFocused.

closest(maxLimit, dxy)

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

connect_(childConnection)

protected

Connect two connections together. This is the connection on the superior block. Rerender blocks as needed.

disconnectInternal(setParent)

Disconnect two blocks that are connected by this connection.

distanceFrom(otherConnection)

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

getFocusableElement()

See IFocusableNode.getFocusableElement.

getFocusableTree()

See IFocusableNode.getFocusableTree.

getOffsetInBlock()

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

getSourceBlock()

Get the source block for this connection.

highlight()

Add highlighting around this connection.

isHighlighted()

Returns true if this connection is highlighted, false otherwise.

moveBy(dx, dy)

Change the connection's coordinates.

moveTo(x, y)

Change the connection's coordinates.

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.

onCheckChanged_()

protected

Function to be called when this connection's compatible types have changed.

onNodeBlur()

See IFocusableNode.onNodeBlur.

onNodeFocus()

See IFocusableNode.onNodeFocus.

respawnShadow_()

protected

Respawn the shadow block if there was one connected to the this connection. Render/rerender blocks as needed.

setCheck(check)

Change a connection's compatibility. Rerender blocks as needed.

setOffsetInBlock(x, y)

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

showContextMenu(e)

Handles showing the context menu when it is opened on a connection. Note that typically the context menu can't be opened with the mouse on a connection, because you can't select a connection. But keyboard users may open the context menu with a keyboard shortcut.

startTrackingAll()

Start tracking this connection, as well as all down-stream connections on any block attached to this connection. This happens when a block is expanded.

targetBlock()

Returns the block that this connection connects to.

unhighlight()

Remove the highlighting around this connection.