Atom
Direct Subclass:
Indirect Subclass:
This class is the prototype for all atoms.
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.value |
|
public |
A warning message displayed next to the atom. |
|
public |
A function which can be called to cancel the processing being done for this atom. |
|
public |
This atom's current color |
|
public |
This atom's default color (ie when not selected or processing) |
|
public |
A description of this atom |
|
public |
inputs: array An array of all of the input attachment points connected to this atom |
|
public |
A flag to indicate if this atom is currently being dragged on the screen. |
|
public |
This atom's name |
|
public |
This atom's output attachment point if it has one |
|
public |
This atom's parent, usually the molecule which contains this atom |
|
public |
The path which contains the geometry represented by this atom |
|
public |
A flag to indicate if the atom is currently computing a new output. |
|
public |
This atom's radius as displayed on the screen is 1/72 width |
|
public |
A flag to indicate if this atom is currently selected |
|
public |
This atom's color when selected |
|
public |
A flag to indicate if we are hovering over this atom. |
|
public |
The color currently used for strokes |
|
public |
This atom's unique ID. Often overwritten later when loading |
|
public |
This atom's value...Is can this be done away with? Are we basically storing the value in the output now? |
|
public |
The X cordinate of this atom |
|
public |
The Y cordinate of this atom |
Method Summary
Public Methods | ||
public |
Adds a new attachment point to this atom |
|
public |
basicThreadValueProcessing(toAsk: *) Calls a worker thread to compute the atom's value. |
|
public |
Starts propagation placeholder. |
|
public |
Returns an array of length two indicating that this is one atom and if it is waiting to be computed |
|
public |
Clears the alert message attached to this atom. |
|
public |
Set the atom's response to a mouse click. This usually means selecting the atom and displaying it's contents in 3D |
|
public |
Set the atom's response to a mouse click and drag. Moves the atom around the screen. |
|
public |
Set the atom's response to a mouse click up. If the atom is moving this makes it stop moving. |
|
public |
createButton(list: object, parent: object, buttonText: string, functionToCall: object) Creates button. |
|
public |
createCheckbox(list: object, buttonText: string, -: boolean, functionToCall: object) Creates button. |
|
public |
createDropDown(list: object, parent: object, options: array, selectedOption: number, description: string, Callback: object) Creates dropdown with multiple options to select. |
|
public |
createEditableValueListItem(list: object, object: object, key: string, label: string, resultShouldBeNumber: boolean, callBack: object) Creates an editable HTML item to set the value of an object element. |
|
public |
createFileUpload(list: object, parent: object, buttonText: string, functionToCall: object) Creates file upload button. |
|
public |
createMarkdownListItem(list: object, texxt: string) Creates a html representation of the passed text. |
|
public |
createNonEditableValueListItem(list: object, object: object, key: string, label: string) Creates an non-editable HTML item to set the value of an object element. |
|
public |
Set's the output value and shows the atom output on the 3D view. |
|
public |
deleteNode(backgroundClickAfter: boolean, deletePath: boolean, silent: boolean) Delete this atom. |
|
public |
Displays the atom in 3D and sets the output. |
|
public |
doubleClick(x: number, y: number): * Set the atom's response to a mouse double click. By default this isn't to do anything other than mark the double click as handled. |
|
public |
draw(drawType: *) Draws the atom on the screen |
|
public |
findIOValue(ioName: string): * Find the value of an input for with a given name. |
|
public |
Generates the path for this atom from it's location in the graph |
|
public |
initializeSideBar(): * Initialized the sidebar with a title and create the HTML object. |
|
public |
Set the atom's response to a key press. Is used to delete the atom if it is selected. |
|
public |
loadTree(): * Sets all the input and output values to match their associated atoms. |
|
public |
Removes an attachment point from an atom. |
|
public |
requestReadme(): *[] Return any contribution from this atom to the README file |
|
public |
selectBox(x: *, y: *, xEnd: *, yEnd: *) Delineates bounds for selection box. |
|
public |
Send the value of this atom to the 3D display. |
|
public |
Create an object containing the information about this atom that we want to save. |
|
public |
Set an alert to display next to the atom. |
|
public |
Applies each of the passed values to this as this.x |
|
public |
update() Runs with each frame to draw the atom. |
|
public |
updateSidebar(): * Updates the side bar to display information about the atom. |
|
public |
Token update value function to give each atom one by default |
|
public |
Sets the atom to wait on coming information. |
|
public |
walkBackForConstants(callback: *) Used to walk back out the tree generating a list of constants...used for evolve |
Public Constructors
Public Members
public alertMessage: string source
A warning message displayed next to the atom. Put text in here to have a warning automatically show up. Cleared each time the output is regenerated.
public cancelProcessing: function source
A function which can be called to cancel the processing being done for this atom.
public isMoving: boolean source
A flag to indicate if this atom is currently being dragged on the screen.
public parentMolecule: object source
This atom's parent, usually the molecule which contains this atom
public processing: boolean source
A flag to indicate if the atom is currently computing a new output. Turns the molecule blue.
Public Methods
public addIO(type: boolean, name: string, target: object, valueType: string, defaultValue: object) source
Adds a new attachment point to this atom
Params:
Name | Type | Attribute | Description |
type | boolean | The type of the IO (input or output) |
|
name | string | The name of the new attachment point |
|
target | object | The atom to attach the new attachment point to. Should we force this to always be this one? |
|
valueType | string | Describes the type of value the input is expecting options are number, geometry, array |
|
defaultValue | object | The default value to be used when the value is not yet set |
public basicThreadValueProcessing(toAsk: *) source
Calls a worker thread to compute the atom's value.
Params:
Name | Type | Attribute | Description |
toAsk | * |
public beginPropagation() source
Starts propagation placeholder. Most atom types do not begin propagation.
public census(): number[] source
Returns an array of length two indicating that this is one atom and if it is waiting to be computed
public clickDown(x: number, y: number, clickProcessed: boolean): * source
Set the atom's response to a mouse click. This usually means selecting the atom and displaying it's contents in 3D
Return:
* |
public clickMove(x: number, y: number) source
Set the atom's response to a mouse click and drag. Moves the atom around the screen.
public clickUp(x: number, y: number) source
Set the atom's response to a mouse click up. If the atom is moving this makes it stop moving.
public createButton(list: object, parent: object, buttonText: string, functionToCall: object) source
Creates button. Used in the sidebar.
Params:
Name | Type | Attribute | Description |
list | object | The HTML object to attach the new item to. |
|
parent | object | The parent which has the function to call on the change...this should really be done with a callback function. |
|
buttonText | string | The text on the button. |
|
functionToCall | object | The function to call when the button is pressed. |
public createCheckbox(list: object, buttonText: string, -: boolean, functionToCall: object) source
Creates button. Used in the sidebar.
public createDropDown(list: object, parent: object, options: array, selectedOption: number, description: string, Callback: object) source
Creates dropdown with multiple options to select. Used in the sidebar.
Params:
Name | Type | Attribute | Description |
list | object | The HTML object to attach the new item to. |
|
parent | object | The parent which has the function to call on the change...this should really be done with a callback function. |
|
options | array | A list of options to display in the drop down. |
|
selectedOption | number | The zero referenced index of the selected option. |
|
description | string | A description of what the dropdown does. |
|
Callback | object | function |
public createEditableValueListItem(list: object, object: object, key: string, label: string, resultShouldBeNumber: boolean, callBack: object) source
Creates an editable HTML item to set the value of an object element. Used in the sidebar.
Params:
Name | Type | Attribute | Description |
list | object | The HTML object to attach the new item to. |
|
object | object | The object with the element we are editing. |
|
key | string | The key of the element to edit. |
|
label | string | The label to display next to the editable value. |
|
resultShouldBeNumber | boolean | A flag to indicate if the input should be converted to a number. |
|
callBack | object | Optional. A function to call with the new value when the value changes. |
public createFileUpload(list: object, parent: object, buttonText: string, functionToCall: object) source
Creates file upload button. Used in the sidebar.
Params:
Name | Type | Attribute | Description |
list | object | The HTML object to attach the new item to. |
|
parent | object | The parent which has the function to call on the change...this should really be done with a callback function. |
|
buttonText | string | The text on the button. |
|
functionToCall | object | The function to call when the button is pressed. |
public createMarkdownListItem(list: object, texxt: string) source
Creates a html representation of the passed text. Used in the sidebar.
public createNonEditableValueListItem(list: object, object: object, key: string, label: string) source
Creates an non-editable HTML item to set the value of an object element. Used in the sidebar.
public decreaseToProcessCountByOne() source
Set's the output value and shows the atom output on the 3D view.
public deleteNode(backgroundClickAfter: boolean, deletePath: boolean, silent: boolean) source
Delete this atom. Silent prevents it from telling its neighbors
public doubleClick(x: number, y: number): * source
Set the atom's response to a mouse double click. By default this isn't to do anything other than mark the double click as handled.
Return:
* |
public draw(drawType: *) source
Draws the atom on the screen
Params:
Name | Type | Attribute | Description |
drawType | * |
public findIOValue(ioName: string): * source
Find the value of an input for with a given name.
Params:
Name | Type | Attribute | Description |
ioName | string | The name of the target attachment point. |
Return:
* |
public initializeSideBar(): * source
Initialized the sidebar with a title and create the HTML object.
Return:
* |
public keyPress(key: string) source
Set the atom's response to a key press. Is used to delete the atom if it is selected.
Params:
Name | Type | Attribute | Description |
key | string | The key which has been pressed. |
public loadTree(): * source
Sets all the input and output values to match their associated atoms.
Return:
* |
public removeIO(type: boolean, name: string, target: object, silent: object) source
Removes an attachment point from an atom.
public requestReadme(): *[] source
Return any contribution from this atom to the README file
Return:
*[] |
public selectBox(x: *, y: *, xEnd: *, yEnd: *) source
Delineates bounds for selection box.
Params:
Name | Type | Attribute | Description |
x | * | ||
y | * | ||
xEnd | * | ||
yEnd | * |
public serialize(offset: {"x": number, "y": number}): * source
Create an object containing the information about this atom that we want to save.
Return:
* |
public setAlert(message: string) source
Set an alert to display next to the atom.
Params:
Name | Type | Attribute | Description |
message | string | The message to display. |
public setValues(values: object) source
Applies each of the passed values to this as this.x
Params:
Name | Type | Attribute | Description |
values | object | A list of values to set |
public updateSidebar(): * source
Updates the side bar to display information about the atom. By default this is just add a title and to let you edit any unconnected inputs.
Return:
* |
public waitOnComingInformation() source
Sets the atom to wait on coming information. Basically a pass through, but used for molecules
public walkBackForConstants(callback: *) source
Used to walk back out the tree generating a list of constants...used for evolve
Params:
Name | Type | Attribute | Description |
callback | * |