blockly > RenderedConnection

RenderedConnection 类

用于连接可能在屏幕上呈现的块的类。

Signature:

export declare class RenderedConnection extends Connection implements IContextMenu, IFocusableNode 

扩展连接

实现IContextMenuIFocusableNode

构造函数

构造函数 修饰符 说明
(constructor)(source, type) 构造 RenderedConnection 类的新实例

属性

属性 修饰符 类型 说明
sourceBlock_ BlockSvg
targetConnection RenderedConnection | null 此连接连接到的连接。如果未连接,则为 null。

方法

方法 修饰符 说明
canBeFocused() 请参阅 IFocusableNode.canBeFocused。
closest(maxLimit, dxy) 找到与此连接最兼容的连接。所有参数均采用 Workspace 单位。
connect_(childConnection) protected 将两个连接连接在一起。这是上层块上的连接。根据需要重新渲染块。
disconnectInternal(setParent) 断开通过此连接连接的两个块。
distanceFrom(otherConnection) 返回此连接与另一个连接之间的距离(以工作区单位为单位)。
getFocusableElement() 请参阅 IFocusableNode.getFocusableElement。
getFocusableTree() 请参阅 IFocusableNode.getFocusableTree。
getOffsetInBlock() 获取此连接相对于其所在分块左上角的偏移量。
getSourceBlock() 获取此连接的来源块。
highlight() 在该连接周围添加突出显示效果。
isHighlighted() 如果此连接处于突出显示状态,则返回 true,否则返回 false。
moveBy(dx, dy) 更改连接的坐标。
moveTo(x, y) 更改连接的坐标。
moveToOffset(blockTL) 将此连接移至其在分块中的偏移量和分块左上角位置所指定的位置。
onCheckChanged_() protected 当此连接的兼容类型发生变化时要调用的函数。
onNodeBlur() 请参阅 IFocusableNode.onNodeBlur。
onNodeFocus() 请参阅 IFocusableNode.onNodeFocus。
respawnShadow_() protected 如果有阴影块连接到此连接,则重新生成该阴影块。根据需要渲染/重新渲染块。
setCheck(check) 更改连接的兼容性。根据需要重新渲染块。
setOffsetInBlock(x, y) 设置此连接相对于其所在的块的左上角的偏移量。
showContextMenu(e) 处理在连接上打开上下文菜单时显示上下文菜单。请注意,通常无法使用鼠标在连接上打开上下文菜单,因为您无法选择连接。不过,键盘用户可以使用键盘快捷键打开上下文菜单。
startTrackingAll() 开始跟踪此连接以及连接到此连接的任何分块上的所有下游连接。当某个代码块展开时,就会发生这种情况。
targetBlock() 返回此连接连接到的块。
unhighlight() 移除此连接周围的突出显示。