Home Reference Source Test Repository
public class | source

Tool

Abstract superclass for all tool classes.

Constructor Summary

Public Constructor
public

Constructs a Tool instance.

Member Summary

Public Members
public

Method Summary

Public Methods
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 Constructors

public constructor source

Constructs a Tool instance. Should not be called directly.

Public Members

public currentMode: * source

Public Methods

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

Handler for aborted selections.

Params:

NameTypeAttributeDescription
event Event

Event object from event listener.

graph Graph

The current graph object.

x number

Mouse x-coordinate (in canvas coordinates).

y number

Mouse y-coordinate (in canvas coordinates).

public activate() source

Called when changing to this tool (if necessary).

public cancel() source

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

public changeMode(mode: string) source

Called when the mode is changed.

Params:

NameTypeAttributeDescription
mode string

Name of the new mode.

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

Handler for dragging mouse on empty space.

Params:

NameTypeAttributeDescription
event Event

Event object from event listener.

graph Graph

The current graph object.

x number

Mouse x-coordinate (in canvas coordinates).

y number

Mouse y-coordinate (in canvas coordinates).

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

Handler for object dragging.

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).

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

Handler for dragging mouse over an object.

Params:

NameTypeAttributeDescription
event Event

Event object from event listener.

graph Graph

The current graph object.

obj Node | Edge | Label

The object that the mouse is dragged over.

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.

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.

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 hasInputs(): boolean source

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

Return:

boolean

Whether or not the tool has inputs.

public hasModeInputs(): boolean source

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

Return:

boolean

Whether or not the tool has mode-specific inputs.

public hasModes(): boolean source

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

Return:

boolean

Whether or not the tool has modes.

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

Called before the dragNone() handler.

Params:

NameTypeAttributeDescription
event Event

Event object from event listener.

graph Graph

The current graph object.

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.

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 preSelectNone(event: Event, graph: Graph, x: number, y: number) source

Called before the selectNone() handler.

Params:

NameTypeAttributeDescription
event Event

Event object from event listener.

graph Graph

The current graph object.

x number

Mouse x-coordinate (in canvas coordinates).

y number

Mouse y-coordinate (in canvas coordinates).

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

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

Params:

NameTypeAttributeDescription
event Event

Event object from event listener.

graph Graph

The current graph object.

obj Node | Edge | Label

Selected 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 selection.

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

Handler for clicking empty space.

Params:

NameTypeAttributeDescription
event Event

Event object from event listener.

graph Graph

The current graph object.

x number

Mouse x-coordinate (in canvas coordinates).

y number

Mouse y-coordinate (in canvas coordinates).

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

Handler for object selection.

Params:

NameTypeAttributeDescription
event Event

Event object from event listener.

graph Graph

The current graph object.

obj Node | Edge | Label

Selected graph component.

x number

Mouse x-coordinate (in canvas coordinates).

y number

Mouse y-coordinate (in canvas coordinates).