Namespace: browserEvents

Methods

bind

static

bind(node, name, thisObject, func) returns Data

Bind an event handler that should be called regardless of whether it is part of the active touch stream. Use this for events that are not part of a multi-part gesture (e.g. mouseover for tooltips).

Parameter

node

EventTarget

Node upon which to listen.

Value must not be null.

name

string

Event name to listen to (e.g. 'mousedown').

thisObject

Object

The value of 'this' in the function.

Value may be null.

func

function()

Function to call when event is triggered.

Value must not be null.

Returns

non-null Data Opaque data that can be passed to unbindEvent_.

conditionalBind

static

conditionalBind(node, name, thisObject, func, opt_noCaptureIdentifier, opt_noPreventDefault) returns Data

Bind an event handler that can be ignored if it is not part of the active touch stream. Use this for events that either start or continue a multi-part gesture (e.g. mousedown or mousemove, which may be part of a drag or click).

Parameter

node

EventTarget

Node upon which to listen.

Value must not be null.

name

string

Event name to listen to (e.g. 'mousedown').

thisObject

Object

The value of 'this' in the function.

Value may be null.

func

function()

Function to call when event is triggered.

Value must not be null.

opt_noCaptureIdentifier

Optional

boolean

True if triggering on this event should not block execution of other event handlers on this touch or other simultaneous touches. False by default.

opt_noPreventDefault

Optional

boolean

True if triggering on this event should prevent the default handler. False by default. If opt_noPreventDefault is provided, opt_noCaptureIdentifier must also be provided.

Returns

non-null Data Opaque data that can be passed to unbindEvent_.

getScrollDeltaPixels

static

getScrollDeltaPixels(e) returns Object

Returns the scroll delta of a mouse event in pixel units.

Parameter

e

Event

Mouse event.

Value must not be null.

Returns

{x: number, y: number} Scroll delta object with .x and .y properties.

isRightButton

static

isRightButton(e) returns boolean

Returns true this event is a right-click.

Parameter

e

Event

Mouse event.

Value must not be null.

Returns

boolean True if right-click.

isTargetInput

static

isTargetInput(e) returns boolean

Returns true if this event is targeting a text input widget?

Parameter

e

Event

An event.

Value must not be null.

Returns

boolean True if text input.

mouseToSvg

static

mouseToSvg(e, svg, matrix) returns SVGPoint

Returns the converted coordinates of the given mouse event. The origin (0,0) is the top-left corner of the Blockly SVG.

Parameter

e

Event

Mouse event.

Value must not be null.

svg

Element

SVG element.

Value must not be null.

matrix

SVGMatrix

Inverted screen CTM to use.

Value may be null.

Returns

non-null SVGPoint Object with .x and .y properties.

unbind

static

unbind(bindData) returns function()

Unbind one or more events event from a function call.

Parameter

bindData

Data

Opaque data from bindEvent_. This list is emptied during the course of calling this function.

Value must not be null.

Returns

non-null function() The function call.

Abstract type

Data

static

non-null Array of non-null Array

Blockly opaque event data used to unbind events when using bind and conditionalBind.