Class: GeometryScene

algeobra~GeometryScene()

Manages definitions of objects, properties, dependencies and correct updates

Constructor

new GeometryScene()

Source:

Members

validateLoopFree

Get the toggle for whether loops should be validated
Source:

validateLoopFree

Set the toggle for whether loops should be validated
Source:

Methods

add(def, createInfo, properties) → {Number}

Add a new definition
Parameters:
Name Type Default Description
def Object The definition
createInfo CreateInfo null The creation info. Dependencies specified here must use indices obtained via the GeometryScene class to refer to other objects
properties Object Properties to associate with this definition
Source:
Returns:
The id of the created object Ids are unique, while in use, but may be reused after removal
Type
Number

get(index) → {Object|null}

Get the information about the specified object
Parameters:
Name Type Description
index Number The index of the registered object
Source:
Returns:
Information stored for the object or null, if it doesn't exist
Type
Object | null

registerCallback(name, cb) → {Number}

Register a callback. Event names are given as the static fields EVENT_UPDATE, EVENT_PROPERTY, EVENT_REMOVE
Parameters:
Name Type Description
name String The name of the callback
cb function The callback function
Source:
Returns:
The id of the registered callback
Type
Number

remove(index)

Remove an object
Parameters:
Name Type Description
index Number The index of the object
Source:

removeCallback(name, id)

Remove a callback. Event names are given as the static fields EVENT_UPDATE, EVENT_PROPERTY, EVENT_REMOVE
Parameters:
Name Type Description
name String The name of the callback
id Number The id of the callback to be removed
Source:

set(index, def, createInfoopt, propertiesopt) → {Number}

Sets the definition for an index. This should generally not be called directly. Instead call add and use update to change the definitions. Set will remove previous entries and compute dependency preserving update orders, which takes time, so it generally should only be done once to set up the structure. Afterwards, only the definition and property should be updated, if possible.
Parameters:
Name Type Attributes Default Description
index Number The index of the object
def Object The definition
createInfo CreateInfo <optional>
null The creation info Dependencies specified here must use indices obtained via the GeometryScene class to refer to other objects
properties Object <optional>
The properties
Source:
Returns:
The index
Type
Number

setProperties(index, properties)

Sets the properties of an object. Replaces existing properties
Parameters:
Name Type Description
index Number The index of the object
properties Object The properties to set
Source:

update(index, def)

Update an object. This is the preferred method over set, as it does not change the dependency relashionships and is thus a lot faster.
Parameters:
Name Type Description
index Number The index of the object
def Object The new definition
Source:

updateProperties(index, properties)

This will assign the propertes specified into the object's existing properties
Parameters:
Name Type Description
index Number The index of the object
properties Object Property values to update
Source:

view(params, skipInvalidValuesopt) → {Symbol.iterator}

Creates an iterable view of the scene
Parameters:
Name Type Attributes Description
params Object
skipInvalidValues Boolean <optional>
If true, invalid values will be skipped, otherwise not
Source:
Returns:
An iterator for this scne
Type
Symbol.iterator