Home Reference Source
public class | source

GlobalVariables

You can directly use an instance of this class. globalVariables

This class defines things which are made available to all objects which import it. It is a singlton which means that each time it is imported the same instance is made available so if it is written to in one place, it can be read somewhere else.

Constructor Summary

Public Constructor
public

The constructor creates a new instance of the Global Variables object.

Member Summary

Public Members
public

atomsSelected: array

A variable to save array to be copied

public

A list of all of the paths in this project which can be read from memory

public

An array of all of the available types of atoms which can be placed with a right click.

public

The 2D reference to the canvas object on which the atoms are drawn.

public

A function which cancels the worker processing display when called

public

The canvas object on which the atoms are drawn.

public

The size (in mm) of segments to use for circles.

public

A flag to indicate if command is pressed

public

A flag to indicate if the edges of the shape should be displayed.

public

A flag to indicate if the faces of the shape should be displayed.

public

A flag to indicate if a grid should be displayed behind the shape

public

A flag to indicate if a display value is currently being processed.

public

A flag to indicate if the display should show axis.

public

The last path displayed.

public

A flag to indicate if the project is a fork.

public

The github object which is used to interact with GitHub.

public

An evaluator for strings as mathmatical equations which is sandboxed and secure.

public

A counter used during the loading process to keep track of how many atoms are still to be loaded.

public

A flag to indicate if the program is running in run mode (ie a shared link).

public

totalAtomCount: integer

A total of the number of atoms in this project

public

A flag to indicate if the program is running with a touch interface.

Method Summary

Public Methods
public

distBetweenPoints(x1: number, x2: number, y1: number, y2: number): *

Computes the distance between two points on a plane.

public

A function to generate a unique ID value.

public

heightToPixels(width: number): *

A function to generate a pixel value for 0-1 location on screen depending on screen height

public

pixelsToHeight(width: number): *

A function to generate a 0-1 value from pixels for location on screen depending on screen height

public

pixelsToWidth(width: number): *

A function to generate a 0-1 value from pixels for location on screen depending on screen width

public

widthToPixels(width: number): *

A function to generate a pixel value for 0-1 location on screen depending on screen width

public

A function which reads from a path and displays the geometry it contains

Public Constructors

public constructor() source

The constructor creates a new instance of the Global Variables object.

Public Members

public atomsSelected: array source

A variable to save array to be copied

public availablePaths: array source

A list of all of the paths in this project which can be read from memory

public availableTypes: array source

An array of all of the available types of atoms which can be placed with a right click.

public c: object source

The 2D reference to the canvas object on which the atoms are drawn.

public cancelLastDisplayWorker: * source

A function which cancels the worker processing display when called

public canvas: object source

The canvas object on which the atoms are drawn.

public circleSegmentSize: number source

The size (in mm) of segments to use for circles.

public ctrlDown: boolean source

A flag to indicate if command is pressed

public displayAxis: boolean source

A flag to indicate if the edges of the shape should be displayed.

public displayEdges: boolean source

A flag to indicate if the faces of the shape should be displayed.

public displayGrid: boolean source

A flag to indicate if a grid should be displayed behind the shape

public displayProcessing: bool source

A flag to indicate if a display value is currently being processed.

public displayTriangles: boolean source

A flag to indicate if the display should show axis.

public displayedPath: string source

The last path displayed. Used for updating the display when the controls change.

public fork: boolean source

A flag to indicate if the project is a fork.

public gitHub: object source

The github object which is used to interact with GitHub.

public limitedEvaluate: function source

An evaluator for strings as mathmatical equations which is sandboxed and secure.

public numberOfAtomsToLoad: integer source

A counter used during the loading process to keep track of how many atoms are still to be loaded.

public runMode: boolean source

A flag to indicate if the program is running in run mode (ie a shared link).

public totalAtomCount: integer source

A total of the number of atoms in this project

public touchInterface: boolean source

A flag to indicate if the program is running with a touch interface. Set in flowDraw.js.

Public Methods

public distBetweenPoints(x1: number, x2: number, y1: number, y2: number): * source

Computes the distance between two points on a plane. This is a duplicate of the one in utils which should probably be deleted.

Params:

NameTypeAttributeDescription
x1 number

The x cordinate of the first point.

x2 number

The x cordinate of the second point.

y1 number

The y cordinate of the first point.

y2 number

The y cordinate of the second point.

Return:

*

public generateUniqueID(): * source

A function to generate a unique ID value. Currently uses random which does not gurintee that it will be unique.

Return:

*

public heightToPixels(width: number): * source

A function to generate a pixel value for 0-1 location on screen depending on screen height

Params:

NameTypeAttributeDescription
width number

0-1

Return:

*

public pixelsToHeight(width: number): * source

A function to generate a 0-1 value from pixels for location on screen depending on screen height

Params:

NameTypeAttributeDescription
width number

0-1

Return:

*

public pixelsToWidth(width: number): * source

A function to generate a 0-1 value from pixels for location on screen depending on screen width

Params:

NameTypeAttributeDescription
width number

0-1

Return:

*

public widthToPixels(width: number): * source

A function to generate a pixel value for 0-1 location on screen depending on screen width

Params:

NameTypeAttributeDescription
width number

0-1

Return:

*

public writeToDisplay(The: string) source

A function which reads from a path and displays the geometry it contains

Params:

NameTypeAttributeDescription
The string

path to read from