Home Reference Source
public class | source

Connector

The connector class defines how an output can be connected to an input. It appears on the screen as a black line extending from an output to an input.

Constructor Summary

Public Constructor
public

constructor(values: object)

The constructor function.

Member Summary

Public Members
public

[key]: *

Assign each of the values in values as this.key

public

The type of this connector

public

The first attachment point this connector is connected to (an ouput)

public

The second attachment point this connector is connected to (an input)

public

The connectors current color

public

endX: *

The s cordinate of the end of the connector.

public

endY: *

The y cordinate of the end of the connector.

public

True if the connector is currently being created and is in the process of extending

public

True if this connector has been selected

public

The starting X cordinate for the connector.

public

The starting Y cordinate for the connector.

Method Summary

Public Methods
public

clickMove runs while the connector is being created.

public

clickUp checks to see if the mouse button has been released over an input attachment point.

public

deleteSelf(silent: boolean)

Deletes the connector by calling its attachmentPoints to tell them to delete their references to this connector.

public

draw()

Draw the connector as a bezier curve on the screen

public

Called when any key is pressed.

public

loadTree(): *

Sets all the input and output values to match their associated atoms.

public

Pass the value of the attached output to the attached input

public

serialize(): *

Generates an object used to save the connector.

public

update()

Computes the connectors position and draw it to the screen.

public

Passes a lock call to the connected input.

public

walkBackForConstants(callback: *)

Used to walk back out the tree generating a list of constants...used for evolve

Public Constructors

public constructor(values: object) source

The constructor function.

Params:

NameTypeAttributeDescription
values object

An array of values passed in which will be assigned to the class as this.x

Public Members

public [key]: * source

Assign each of the values in values as this.key

public atomType: string source

The type of this connector

public attachmentPoint1: object source

The first attachment point this connector is connected to (an ouput)

public attachmentPoint2: object source

The second attachment point this connector is connected to (an input)

public color: string source

The connectors current color

public endX: * source

The s cordinate of the end of the connector.

public endY: * source

The y cordinate of the end of the connector.

public isMoving: boolean source

True if the connector is currently being created and is in the process of extending

public selected: boolean source

True if this connector has been selected

public startX: number source

The starting X cordinate for the connector. Should really be referenced to attachmentPoint1.

public startY: number source

The starting Y cordinate for the connector. Should really be referenced to attachmentPoint1.

Public Methods

public clickMove(x: number, y: number) source

clickMove runs while the connector is being created. As long as the mouse is pressed down, the end of the connector stays attached to the mouse.

Params:

NameTypeAttributeDescription
x number

The x cordinate of the click

y number

The y cordinate of the click

public clickUp(x: number, y: number) source

clickUp checks to see if the mouse button has been released over an input attachment point. If it has then the connector is created there. If not, then the connector is deleted.

Params:

NameTypeAttributeDescription
x number

The x cordinate of the click

y number

The y cordinate of the click

public deleteSelf(silent: boolean) source

Deletes the connector by calling its attachmentPoints to tell them to delete their references to this connector.

Params:

NameTypeAttributeDescription
silent boolean
  • optional
  • default: false

public draw() source

Draw the connector as a bezier curve on the screen

public keyPress(key: string) source

Called when any key is pressed. If the key is delete or backspace and the connector is selected then the connector is deleted.

Params:

NameTypeAttributeDescription
key string

The key which was pressed

public loadTree(): * source

Sets all the input and output values to match their associated atoms.

Return:

*

public propogate() source

Pass the value of the attached output to the attached input

public serialize(): * source

Generates an object used to save the connector.

Return:

*

public update() source

Computes the connectors position and draw it to the screen.

public waitOnComingInformation() source

Passes a lock call to the connected input.

public walkBackForConstants(callback: *) source

Used to walk back out the tree generating a list of constants...used for evolve

Params:

NameTypeAttributeDescription
callback *