blockly > blockRendering > MarkerSvg

blockRendering.MarkerSvg 类

用于标记的类,其中包含用于以图形方式将标记渲染为 SVG 的方法。

Signature:

export declare class MarkerSvg 

构造函数

构造函数 修饰符 说明
(constructor)(workspace, 常量, 标记) 构造 MarkerSvg 类的新实例

属性

媒体资源 修饰符 类型 说明
colour_ string
constants_ protected ConstantProvider 绘制标记所需的常量。
currentMarkerSvg SVGElement | null 标记的当前 SVG 元素。
markerBlock_ protected SVGPathElement | null
markerInput_ protected SVGPathElement | null
markerSvg_ protected SVGGElement | null 包含标记的根 SVG 组。
markerSvgLine_ protected SVGRectElement | null
markerSvgRect_ protected SVGRectElement | null
svgGroup_ protected SVGGElement | null

方法

方法 修饰符 说明
applyColour_(_curNode) protected 应用标记的颜色。
createDom() 为标记创建 DOM 元素。
createDomInternal_() protected 创建标记 SVG。
dispose() 处置此标记。
draw(oldNode, curNode) 更新标记。
getBlinkProperties_() protected 获取让标记闪烁的属性。
getMarker() 获取标记。
getSvgRoot() 返回 SVG 的根节点;如果不存在,则返回 null。
hide() 隐藏标记。
isCursor() 如果应将标记绘制为光标,则为 true,否则为 false。光标绘制为一条闪烁的线条。标记绘制为实线。
positionBlock_(width, markerOffset, markerHeight) protected 定位方块的标记。在块周围显示矩形的上半部分轮廓。
positionInput_(connection) protected 为输入连接放置标记。显示已填充的拼图块。
positionLine_(x, y, width) protected 在指定坐标处移动和显示标记(以工作区单位为单位)。显示水平线。
positionOutput_(width, height, connectShape) protected 定位输出连接标记。显示谜题轮廓以及顶部和底部路径。
positionPrevious_(width, markerOffset, markerHeight, connectShape) protected 定位上一个连接的标记。显示一个顶部有凹口的半矩形,表示之前的连接。
positionRect_(x, y, width, height) protected 在指定坐标处移动和显示标记(以工作区单位为单位)。显示实心矩形。
setParent_(newParent) protected 将标记的 SVG 根附加到父级的 SVG 组。
showAtLocation_(curNode) protected 根据 curNode 类型更新标记的可见状态。
showCurrent_() protected 显示当前标记。
showWithBlock_(curNode) protected 定位并显示方块的标记。
showWithCoordinates_(curNode) protected 为工作区坐标定位和显示标记。这是一条水平线。
showWithField_(curNode) protected 确定和显示字段的标记。这是球场四周的箱子。
showWithInput_(curNode) protected 定位并显示输入的标记。这是一片拼图。
showWithNext_(curNode) protected 定位并显示用于下一次连接的标记。这是一条水平线。
showWithOutput_(curNode) protected 定位并显示输出连接的标记。
showWithPrevious_(curNode) protected 定位并显示上一个连接的标记。
showWithStack_(curNode) protected 标记和显示堆叠的标记。这是一个围绕整个代码块堆栈提供额外内边距的框。