Property

DIV

static

Element

The HTML container. Set once by Blockly.WidgetDiv.createDom.

Methods

createDom

static

createDom()

Create the widget div and inject it onto the page.

hide

static

hide()

Destroy the widget and hide the div.

hideIfOwner

static

hideIfOwner(oldOwner)

Destroy the widget and hide the div if it is being used by the specified object.

Parameter

oldOwner

Object

The object that was using this container.

Value must not be null.

isVisible

static

isVisible() returns boolean

Is the container visible?

Returns

boolean True if visible.

position

static

position(anchorX, anchorY, windowSize, scrollOffset, rtl)

Position the widget at a given location. Prevent the widget from going offscreen top or left (right in RTL).

Parameter

anchorX

number

Horizontal location (window coordinates, not body).

anchorY

number

Vertical location (window coordinates, not body).

windowSize

goog.math.Size

Height/width of window.

Value must not be null.

scrollOffset

goog.math.Coordinate

X/y of window scrollbars.

Value must not be null.

rtl

boolean

True if RTL, false if LTR.

positionWithAnchor

static

positionWithAnchor(viewportBBox, anchorBBox, widgetSize, rtl)

Position the widget div based on an anchor rectangle. The widget should be placed adjacent to but not overlapping the anchor rectangle. The preferred position is directly below and aligned to the left (ltr) or right (rtl) side of the anchor.

Parameter

viewportBBox

Object

The bounding rectangle of the current viewport, in window coordinates.

Value must not be null.

anchorBBox

Object

The bounding rectangle of the anchor, in window coordinates.

Value must not be null.

widgetSize

goog.math.Size

The size of the widget that is inside the widget div, in window coordinates.

Value must not be null.

rtl

boolean

Whether the workspace is in RTL mode. This determines horizontal alignment.

show

static

show(newOwner, rtl, dispose)

Initialize and display the widget div. Close the old one if needed.

Parameter

newOwner

Object

The object that will be using this container.

Value must not be null.

rtl

boolean

Right-to-left (true) or left-to-right (false).

dispose

function()

Optional cleanup function to be run when the widget is closed.