Blockly. Gesture
Constructor
Gesture
new Gesture(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. |
Properties
isEnding_
boolean
Boolean used internally to break a cycle in disposal.
mouseDownXY_
non-null Blockly.utils.Coordinate
onMoveWrapper_
nullable Blockly.EventData
A handle to use to unbind a mouse move listener at the end of a drag. Opaque data returned from Blockly.bindEventWithChecks_.
onUpWrapper_
nullable Blockly.EventData
A handle to use to unbind a mouse up listener at the end of a drag. Opaque data returned from Blockly.bindEventWithChecks_.
startBubble_
non-null Blockly.IBubble
startWorkspace_
The workspace that the gesture started on. There may be multiple workspaces on a page; this is more accurate than using Blockly.getMainWorkspace().
startWorkspace_
non-null Blockly.WorkspaceSvg
startWorkspace_
non-null Blockly.WorkspaceSvg
startWorkspace_
non-null Blockly.WorkspaceSvg
targetBlock_
non-null Blockly.BlockSvg
Methods
inProgress
inProgress() returns boolean
Is a drag or other gesture currently in progress on any workspace?
- Returns
-
boolean
True if gesture is occurring.
bindMouseEvents
bindMouseEvents(e)
Bind gesture 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.
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 or touch start 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.
- Returns
-
non-null Array of non-null Blockly.BlockSvg
A possibly empty list of insertion marker blocks.
handleBlockStart
handleBlockStart(e, block)
Handle a mousedown/touchstart event on a block.
Parameter |
|
---|---|
e |
Event A mouse down or touch start event. Value must not be null. |
block |
The block the event hit. Value must not be null. |
handleBubbleStart
handleBubbleStart(e, bubble)
Handle a mousedown/touchstart event on a bubble.
Parameter |
|
---|---|
e |
Event A mouse down or touch start event. Value must not be null. |
bubble |
The bubble the event hit. Value must not be null. |
handleFlyoutStart
handleFlyoutStart(e, flyout)
Handle a mousedown/touchstart event on a flyout.
Parameter |
|
---|---|
e |
Event A mouse down or touch start event. Value must not be null. |
flyout |
The flyout the event hit. Value must not be null. |
handleMove
handleMove(e)
Handle a mouse move or touch move event.
Parameter |
|
---|---|
e |
Event A mouse move or touch 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 |
Event A mouse move or touch move event. Value must not be null. |
handleUp
handleUp(e)
Handle a mouse up or touch end event.
Parameter |
|
---|---|
e |
Event A mouse up or touch end event. Value must not be null. |
handleWsStart
handleWsStart(e, ws)
Handle a mousedown/touchstart event on a workspace.
Parameter |
|
---|---|
e |
Event A mouse down or touch start event. Value must not be null. |
ws |
The workspace the event hit. Value must not be null. |
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.
- Returns
-
boolean
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).
- Returns
-
boolean
True if this gesture is a drag of a workspace or block.
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. |
setStartBubble
setStartBubble(bubble)
Record the bubble that a gesture started on
Parameter |
|
---|---|
bubble |
The bubble the gesture started on. |
setStartField
setStartField(field)
Record the field that a gesture started on.
Parameter |
|
---|---|
field |
The field the gesture started on. |