Class: MarkerSvg

Constructor

MarkerSvg

new MarkerSvg(workspace, constants, marker)

Class for a marker.

Parameter

workspace

Blockly.WorkspaceSvg

The workspace the marker belongs to.

Value must not be null.

constants

Blockly.blockRendering.ConstantProvider

The constants for the renderer.

Value must not be null.

marker

Blockly.Marker

The marker to draw.

Value must not be null.

Properties

CURSOR_CLASS

constant   static

string

The name of the CSS class for a cursor.

HEIGHT_MULTIPLIER

constant   static

number

What we multiply the height by to get the height of the marker. Only used for the block and block connections.

MARKER_CLASS

constant   static

string

The name of the CSS class for a marker.

colour_

string

The colour of the marker.

constants_

protected

Blockly.blockRendering.ConstantProvider

The constants necessary to draw the marker.

currentMarkerSvg

Element

The current SVG element for the marker.

Methods

applyColour_

protected

applyColour_()

Apply the marker's colour.

createDom

package

createDom() returns SVGElement

Create the DOM element for the marker.

Returns

non-null SVGElement The marker controls SVG group.

createDomInternal_

protected

createDomInternal_() returns Element

Create the marker SVG.

Returns

Element The SVG node created.

dispose

package

dispose()

Dispose of this marker.

draw

package

draw(oldNode, curNode)

Update the marker.

Parameter

oldNode

Blockly.ASTNode

The previous node the marker was on or null.

curNode

Blockly.ASTNode

The node that we want to draw the marker for.

getBlinkProperties_

protected

getBlinkProperties_() returns Object

Get the properties to make a marker blink.

Returns

non-null Object The object holding attributes to make the marker blink.

getSvgRoot

getSvgRoot() returns SVGElement

Return the root node of the SVG or null if none exists.

Returns

SVGElement The root SVG node.

hide

package

hide()

Hide the marker.

isCursor

isCursor() returns boolean

True if the marker should be drawn as a cursor, false otherwise. A cursor is drawn as a flashing line. A marker is drawn as a solid line.

Returns

boolean True if the marker is a cursor, false otherwise.

positionLine_

protected

positionLine_(x, y, width)

Move and show the marker at the specified coordinate in workspace units. Displays a horizontal line.

Parameter

x

number

The new x, in workspace units.

y

number

The new y, in workspace units.

width

number

The new width, in workspace units.

positionRect_

protected

positionRect_(x, y, width, height)

Move and show the marker at the specified coordinate in workspace units. Displays a filled in rectangle.

Parameter

x

number

The new x, in workspace units.

y

number

The new y, in workspace units.

width

number

The new width, in workspace units.

height

number

The new height, in workspace units.

setParent_

protected

setParent_(newParent)

Attaches the SVG root of the marker to the SVG group of the parent.

Parameter

newParent

(non-null Blockly.WorkspaceSvg, non-null Blockly.Field, or non-null Blockly.BlockSvg)

The workspace, field, or block that the marker SVG element should be attached to.

showAtLocation_

protected

showAtLocation_(curNode)

Update the marker's visible state based on the type of curNode..

Parameter

curNode

Blockly.ASTNode

The node that we want to draw the marker for.

showCurrent_

protected

showCurrent_()

Show the current marker.

showWithBlockPrevOutput_

protected

showWithBlockPrevOutput_(block)

Show the marker as a combination of the previous connection and block, the output connection and block, or just the block.

Parameter

block

Blockly.BlockSvg

The block the marker is currently on.

showWithCoordinates_

protected

showWithCoordinates_(curNode)

Show the visual representation of a workspace coordinate. This is a horizontal line.

Parameter

curNode

Blockly.ASTNode

The node that we want to draw the marker for.

Value must not be null.

showWithField_

protected

showWithField_(curNode)

Show the visual representation of a field. This is a box around the field.

Parameter

curNode

Blockly.ASTNode

The node that we want to draw the marker for.

Value must not be null.

showWithInput_

protected

showWithInput_(curNode)

Show the visual representation of an input. This is a puzzle piece.

Parameter

curNode

Blockly.ASTNode

The node that we want to draw the marker for.

Value must not be null.

showWithNext_

protected

showWithNext_(curNode)

Show the visual representation of a next connection. This is a horizontal line.

Parameter

curNode

Blockly.ASTNode

The node that we want to draw the marker for.

Value must not be null.

showWithStack_

protected

showWithStack_(curNode)

Show the visual representation of a stack. This is a box with extra padding around the entire stack of blocks.

Parameter

curNode

Blockly.ASTNode

The node that we want to draw the marker for.

Value must not be null.