Constructor

CursorSvg

new CursorSvg(workspace, opt_marker)

Class for a cursor.

Parameter

workspace

Blockly.WorkspaceSvg

The workspace the cursor belongs to.

Value must not be null.

opt_marker

Optional

boolean

True if the cursor is a marker. A marker is used to save a location and is an immovable cursor. False or undefined if the cursor is not a marker.

Properties

BLOCK_PADDING

constant   static

number

Padding around a block.

CURSOR_CLASS

constant   static

string

The name of the CSS class for a cursor.

CURSOR_COLOR

constant   static

string

Cursor color.

CURSOR_HEIGHT

constant   static

number

Height of the horizontal cursor.

CURSOR_WIDTH

constant   static

number

Width of the horizontal cursor.

HEIGHT_MULTIPLIER

constant   static

number

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

MARKER_CLASS

constant   static

string

The name of the CSS class for a marker.

MARKER_COLOR

constant   static

string

Immovable marker color.

NOTCH_START_LENGTH

constant   static

number

The start length of the notch.

STACK_PADDING

constant   static

number

Padding around a stack.

VERTICAL_PADDING

constant   static

number

Padding around the input.

currentCursorSvg

Element

The current SVG element for the cursor.

Methods

createDom

package

createDom() returns SVGElement

Create the DOM element for the cursor.

Returns

non-null SVGElement The cursor controls SVG group.

dispose

package

dispose()

Dispose of this cursor.

draw

package

draw(curNode)

Update the cursor.

Parameter

curNode

Blockly.ASTNode

The node that we want to draw the cursor for.

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 cursor.

positionBlock_

positionBlock_(width, cursorOffset, cursorHeight)

Position the cursor for a block. Displays an outline of the top half of a rectangle around a block.

Parameter

width

number

The width of the block.

cursorOffset

number

The extra padding for around the block.

cursorHeight

number

The height of the cursor.