Class: TouchGesture

Constructor

TouchGesture

new TouchGesture(e, creatorWorkspace)

Class for one gesture.

Parameter

e

Event

The event that kicked off this gesture.

Value must not be null.

creatorWorkspace

Blockly.WorkspaceSvg

The workspace that created this gesture and has a reference to it.

Value must not be null.

Extends
Blockly.Gesture

Properties

ZOOM_IN_MULTIPLIER

constant   static

A multiplier used to convert the gesture scale to a zoom in delta.

ZOOM_OUT_MULTIPLIER

constant   static

A multiplier used to convert the gesture scale to a zoom out delta.

cachedPoints_[undefined]

non-null Blockly.utils.Coordinate

cachedPoints_[undefined]

non-null Blockly.utils.Coordinate

cachedPoints_[undefined]

non-null Blockly.utils.Coordinate

cachedPoints_[undefined]

non-null Blockly.utils.Coordinate

isEnding_

protected

unknown

Boolean used internally to break a cycle in disposal.

Inherited from
Blockly.Gesture#isEnding_

onMoveWrapper_

protected

unknown

A handle to use to unbind a mouse move listener at the end of a drag. Opaque data returned from Blockly.bindEventWithChecks_.

Inherited from
Blockly.Gesture#onMoveWrapper_

onUpWrapper_

protected

unknown

A handle to use to unbind a mouse up listener at the end of a drag. Opaque data returned from Blockly.bindEventWithChecks_.

Inherited from
Blockly.Gesture#onUpWrapper_

startWorkspace_

protected

unknown

The workspace that the gesture started on. There may be multiple workspaces on a page; this is more accurate than using Blockly.getMainWorkspace().

Inherited from
Blockly.Gesture#startWorkspace_

Methods

bindMouseEvents

package

bindMouseEvents(e)

Bind gesture events. Overriding the gesture definition of this function, binding the same functions for onMoveWrapper_ and onUpWrapper_ but passing opt_noCaptureIdentifier. In addition, binding a second mouse down event to detect multi-touch events.

Parameter

e

Event

A mouse down or touch start event.

Value must not be null.

cancel

package

cancel()

Cancel an in-progress gesture. If a workspace or block drag is in progress, end the drag at the most recent location.

Inherited from
Blockly.Gesture#cancel

dispose

package

dispose()

Sever all links from this object.

doStart

package

doStart(e)

Start a gesture: update the workspace to indicate that a gesture is in progress and bind mousemove and mouseup handlers.

Parameter

e

Event

A mouse down, touch start or pointer down event.

Value must not be null.

getCurrentDragger

getCurrentDragger() returns (Blockly.WorkspaceDragger, Blockly.BubbleDragger, Blockly.IBlockDragger, or null)

Gets the current dragger if an item is being dragged. Null if nothing is being dragged.

Inherited from
Blockly.Gesture#getCurrentDragger
Returns

The dragger that is currently in use or null if no drag is in progress.

getInsertionMarkers

package

getInsertionMarkers() returns Array of non-null Blockly.BlockSvg

Get a list of the insertion markers that currently exist. Block drags have 0, 1, or 2 insertion markers.

Inherited from
Blockly.Gesture#getInsertionMarkers
Returns

A possibly empty list of insertion marker blocks.

getTouchPoint

package

getTouchPoint(e) returns Blockly.utils.Coordinate

Helper function returning the current touch point coordinate.

Parameter

e

Event

A touch or pointer event.

Value must not be null.

Returns

nullable Blockly.utils.Coordinate The current touch point coordinate

handleBlockStart

package

handleBlockStart(e, block)

Handle a mousedown/touchstart event on a block.

Parameter

e

A mouse down or touch start event.

Value must not be null.

block

The block the event hit.

Value must not be null.

Inherited from
Blockly.Gesture#handleBlockStart

handleBubbleStart

package

handleBubbleStart(e, bubble)

Handle a mousedown/touchstart event on a bubble.

Parameter

e

A mouse down or touch start event.

Value must not be null.

bubble

The bubble the event hit.

Value must not be null.

Inherited from
Blockly.Gesture#handleBubbleStart

handleFlyoutStart

package

handleFlyoutStart(e, flyout)

Handle a mousedown/touchstart event on a flyout.

Parameter

e

A mouse down or touch start event.

Value must not be null.

flyout

The flyout the event hit.

Value must not be null.

Inherited from
Blockly.Gesture#handleFlyoutStart

handleMove

package

handleMove(e)

Handle a mouse move, touch move, or pointer move event.

Parameter

e

Event

A mouse move, touch move, or pointer move event.

Value must not be null.

handleRightClick

package

handleRightClick(e)

Handle a real or faked right-click event by showing a context menu.

Parameter

e

A mouse move or touch move event.

Value must not be null.

Inherited from
Blockly.Gesture#handleRightClick

handleStart

package

handleStart(e)

Handle a mouse down, touch start, or pointer down event.

Parameter

e

Event

A mouse down, touch start, or pointer down event.

Value must not be null.

handleTouchEnd

package

handleTouchEnd(e)

Handle a touch end or pointer end event and end the gesture.

Parameter

e

Event

A touch end, or pointer end event.

Value must not be null.

handleTouchMove

package

handleTouchMove(e)

Handle a touch move or pointer move event and zoom in/out if two pointers are on the screen.

Parameter

e

Event

A touch move, or pointer move event.

Value must not be null.

handleTouchStart

package

handleTouchStart(e)

Handle a touch start or pointer down event and keep track of current pointers.

Parameter

e

Event

A touch start, or pointer down event.

Value must not be null.

handleUp

package

handleUp(e)

Handle a mouse up, touch end, or pointer up event.

Parameter

e

Event

A mouse up, touch end, or pointer up event.

Value must not be null.

handleWsStart

package

handleWsStart(e, ws)

Handle a mousedown/touchstart event on a workspace.

Parameter

e

A mouse down or touch start event.

Value must not be null.

ws

The workspace the event hit.

Value must not be null.

Inherited from
Blockly.Gesture#handleWsStart

hasStarted

package

hasStarted() returns boolean

Whether this gesture has already been started. In theory every mouse down has a corresponding mouse up, but in reality it is possible to lose a mouse up, leaving an in-process gesture hanging.

Inherited from
Blockly.Gesture#hasStarted
Returns

Whether this gesture was a click on a workspace.

isDragging

package

isDragging() returns boolean

Whether this gesture is a drag of either a workspace or block. This function is called externally to block actions that cannot be taken mid-drag (e.g. using the keyboard to delete the selected blocks).

Inherited from
Blockly.Gesture#isDragging
Returns

True if this gesture is a drag of a workspace or block.

isMultiTouch

package

isMultiTouch() returns boolean

Whether this gesture is part of a multi-touch gesture.

Returns

boolean Whether this gesture is part of a multi-touch gesture.

setStartBlock

package

setStartBlock(block)

Record the block that a gesture started on, and set the target block appropriately.

Parameter

block

The block the gesture started on.

Inherited from
Blockly.Gesture#setStartBlock

setStartBubble

package

setStartBubble(bubble)

Record the bubble that a gesture started on

Parameter

bubble

The bubble the gesture started on.

Inherited from
Blockly.Gesture#setStartBubble

setStartField

package

setStartField(field)

Record the field that a gesture started on.

Parameter

field

The field the gesture started on.

Inherited from
Blockly.Gesture#setStartField