JXG.Composition

Class

A composition is a simple container that manages none or more JXG.GeometryElements.

Methods

Own

add(what, element) → {Boolean}

Adds an element to the composition container.

Parameters

Name Type Description
what String

Descriptive name for the element, e.g. startpoint or area. This is used to access the element later on. There are some reserved names: elements, add, remove, update, prepareUpdate, updateRenderer, highlight, noHighlight, and all names that would form invalid object property names in JavaScript.

element JXG.GeometryElement | JXG.Composition

A reference to the element that is to be added. This can be another composition, too.

Returns

True, if the element was added successfully. Reasons why adding the element failed include using a reserved name and providing an invalid element.

Type
Boolean

Details

Source
base/composition.js, line 192

fullUpdate()

Invokes fullUpdate for every stored element with a fullUpdate method and hands over the given arguments. See JXG.GeometryElement#fullUpdate for further description, valid parameters and return values.

Details

Source
base/composition.js, line 104

highlight()

Invokes highlight for every stored element with a highlight method and hands over the given arguments. See JXG.GeometryElement#highlight for further description, valid parameters and return values.

Details

Source
base/composition.js, line 113

noHighlight()

Invokes noHighlight for every stored element with a noHighlight method and hands over the given arguments. See JXG.GeometryElement#noHighlight for further description, valid parameters and return values.

Details

Source
base/composition.js, line 122

prepareUpdate()

Invokes prepareUpdate for every stored element with a prepareUpdate method and hands over the given arguments. See JXG.GeometryElement#prepareUpdate for further description, valid parameters and return values.

Details

Source
base/composition.js, line 77

remove(what) → {Boolean}

Remove an element from the composition container.

Parameters

Name Type Description
what String

The name used to access the element.

Returns

True, if the element has been removed successfully.

Type
Boolean

Details

Source
base/composition.js, line 221

setAttribute()

Invokes setAttribute for every stored element with a setAttribute method and hands over the given arguments. See JXG.GeometryElement#setAttribute for further description, valid parameters and return values.

Details

Source
base/composition.js, line 59

setParents()

Invokes setParents for every stored element with a setParents method and hands over the given arguments. See JXG.GeometryElement#setParents for further description, valid parameters and return values.

Details

Source
base/composition.js, line 68

update()

Invokes update for every stored element with a update method and hands over the given arguments. See JXG.GeometryElement#update for further description, valid parameters and return values.

Details

Source
base/composition.js, line 95

updateRenderer()

Invokes updateRenderer for every stored element with a updateRenderer method and hands over the given arguments. See JXG.GeometryElement#updateRenderer for further description, valid parameters and return values.

Details

Source
base/composition.js, line 86

Inherited

none

Example

var p1 = board.create('point', [1, 2]),
    p2 = board.create('point', [2, 3]),
    c = new JXG.Composition({
        start: p1,
        end: p2
    });

// moves p1 to [3, 3]
c.start.moveTo([3, 3]);

Parameters

Name Type Description
elements Object

A list of elements with a descriptive name for the element as the key and a reference to the element as the value of every list entry. The name is used to access the element later on.

Details

Source
base/composition.js, line 38