Home Reference Source Test Repository
public class | source

MoveTool

Extends:

Tool → MoveTool

Tool for moving graph objects. No longer used directly.

Member Summary

Public Members
public
public
public

startX: *

public

startY: *

Method Summary

Public Methods
public

dragObject(event: Event, graph: Graph, obj: Node | Edge | Label, x: number, y: number)

Handler for object dragging.

public

dropOnNone(event: Event, graph: Graph, droppedObj: Node | Edge | Label, x: number, y: number)

Handler for dropping object on empty space.

public

dropOnObject(event: Event, graph: Graph, droppedObj: Node | Edge | Label, destObj: Node | Edge | Label, x: number, y: number)

Handler for object dropping on another object.

public

preDragObject(event: Event, graph: Graph, srcObj: Node | Edge | Label, x: number, y: number): boolean

Returns a boolean indicating whether or not the tool should be able to handle dragging.

public

Resets the dragged objects position.

Inherited Summary

From class Tool
public
public

abortSelect(event: Event, graph: Graph, x: number, y: number)

Handler for aborted selections.

public

Called when changing to this tool (if necessary).

public

cancel()

Called when switching to a different tool to cancel any incomplete actions.

public

Called when the mode is changed.

public

dragNone(event: Event, graph: Graph, x: number, y: number)

Handler for dragging mouse on empty space.

public

dragObject(event: Event, graph: Graph, srcObj: Node | Edge | Label, x: number, y: number)

Handler for object dragging.

public

dragOverObject(event: Event, graph: Graph, obj: Node | Edge | Label, x: number, y: number)

Handler for dragging mouse over an object.

public

dropOnNone(event: Event, graph: Graph, droppedObj: Node | Edge | Label, x: number, y: number)

Handler for dropping object on empty space.

public

dropOnObject(event: Event, graph: Graph, droppedObj: Node | Edge | Label, destObj: Node | Edge | Label, x: number, y: number)

Handler for object dropping on another object.

public

Returns a boolean indicating whether or not the tool has inputs.

public

Returns a boolean indicating whether or not the tool has mode-specific inputs.

public

Returns a boolean indicating whether or not the tool has modes.

public

preDragNone(event: Event, graph: Graph, x: number, y: number)

Called before the dragNone() handler.

public

preDragObject(event: Event, graph: Graph, srcObj: Node | Edge | Label, x: number, y: number): boolean

Returns a boolean indicating whether or not the tool should be able to handle dragging.

public

preSelectNone(event: Event, graph: Graph, x: number, y: number)

Called before the selectNone() handler.

public

preSelectObject(event: Event, graph: Graph, obj: Node | Edge | Label, x: number, y: number): boolean

Returns a boolean indicating whether or not the tool should be able to handle selection.

public

selectNone(event: Event, graph: Graph, x: number, y: number)

Handler for clicking empty space.

public

selectObject(event: Event, graph: Graph, obj: Node | Edge | Label, x: number, y: number)

Handler for object selection.

Public Members

public objStartX: * source

public objStartY: * source

public startX: * source

public startY: * source

Public Methods

public dragObject(event: Event, graph: Graph, obj: Node | Edge | Label, x: number, y: number) source

Handler for object dragging. Updates the object's position to the mouse's current position.

Override:

Tool#dragObject

Params:

NameTypeAttributeDescription
event Event

Event object from event listener.

graph Graph

The current graph object.

obj Node | Edge | Label

Dragged graph component.

x number

Mouse x-coordinate (in canvas coordinates).

y number

Mouse y-coordinate (in canvas coordinates).

public dropOnNone(event: Event, graph: Graph, droppedObj: Node | Edge | Label, x: number, y: number) source

Handler for dropping object on empty space. Attempts to drop the dragged object at the mouse's position. If the drop is not allowed, the dragged object is reset to its original position.

Override:

Tool#dropOnNone

Params:

NameTypeAttributeDescription
event Event

Event object from event listener.

graph Graph

The current graph object.

droppedObj Node | Edge | Label

Dropped graph component.

x number

Mouse x-coordinate (in canvas coordinates).

y number

Mouse y-coordinate (in canvas coordinates).

public dropOnObject(event: Event, graph: Graph, droppedObj: Node | Edge | Label, destObj: Node | Edge | Label, x: number, y: number) source

Handler for object dropping on another object. Attempts to drop the dragged object on the object at the mouse's position. If the drop is not allowed, the dragged object is reset to its original position.

Override:

Tool#dropOnObject

Params:

NameTypeAttributeDescription
event Event

Event object from event listener.

graph Graph

The current graph object.

droppedObj Node | Edge | Label

Dropped graph component.

destObj Node | Edge | Label

Graph component that the object was dropped onto.

x number

Mouse x-coordinate (in canvas coordinates).

y number

Mouse y-coordinate (in canvas coordinates).

public preDragObject(event: Event, graph: Graph, srcObj: Node | Edge | Label, x: number, y: number): boolean source

Returns a boolean indicating whether or not the tool should be able to handle dragging. Stores the dragged object location and mouse location.

Override:

Tool#preDragObject

Params:

NameTypeAttributeDescription
event Event

Event object from event listener.

graph Graph

The current graph object.

srcObj Node | Edge | Label

Dragged graph component.

x number

Mouse x-coordinate (in canvas coordinates).

y number

Mouse y-coordinate (in canvas coordinates).

Return:

boolean

Whether or not the tool should handle dragging.

public resetObjectPosition(object: Node | Edge | Label) source

Resets the dragged objects position. This is called when the object cannot be dropped at the current position.

Params:

NameTypeAttributeDescription
object Node | Edge | Label

The object that was dropped.