blockly > RenderedConnection

RenderedConnection class

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


export declare class RenderedConnection extends Connection 

Extends: Connection


Constructor Modifiers Description
(constructor)(source, type) Constructs a new instance of the RenderedConnection class


Property Modifiers Type Description
sourceBlock_ BlockSvg
targetConnection RenderedConnection | null Connection this connection connects to. Null if not connected.


Method Modifiers Description
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.
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.
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.
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.