Blockly. 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 |
The workspace that created this gesture and has a reference to it. Value must not be null. |
- Extends
- Blockly.Gesture
Properties
ZOOM_IN_MULTIPLIER
A multiplier used to convert the gesture scale to a zoom in delta.
ZOOM_OUT_MULTIPLIER
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_
unknown
Boolean used internally to break a cycle in disposal.
- Inherited from
- Blockly.Gesture#isEnding_
onMoveWrapper_
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_
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_
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
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
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
dispose()
Sever all links from this object.
doStart
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. |
getInsertionMarkers
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
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
-
Blockly.utils.Coordinate
The current touch point coordinate
handleBlockStart
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
setStartBubble(bubble)
Record the bubble that a gesture started on
Parameter |
|
---|---|
bubble |
The bubble the gesture started on. |
- Inherited from
- Blockly.Gesture#setStartBubble
setStartField
setStartField(field)
Record the field that a gesture started on.
Parameter |
|
---|---|
field |
The field the gesture started on. |
- Inherited from
- Blockly.Gesture#setStartField