Class JXG.Group
↳ JXG.Group
In this class all group management is done.
Defined in: group.js.
Constructor Attributes | Constructor Name and Description |
---|---|
JXG.Group(board, id, name, objects, attributes)
Creates a new instance of Group.
|
Field Attributes | Field Name and Description |
---|---|
<private> |
Cache coordinates of points.
|
Method Attributes | Method Name and Description |
---|---|
<private> |
_addActionPoint(action, point)
|
<private> |
_removeActionPoint(action, point)
|
<private> |
_setActionPoints(action, objects)
|
<private> |
_update_apply_transformation(drag, t)
|
<private> | |
<private> | |
<private> |
Update the cached coordinates of a group element.
|
addGroup(group)
Adds all points in a group to this group.
|
|
addParents(parents)
Adds ids of elements to the array this.parents.
|
|
addPoint(object)
Adds an Point to this group.
|
|
addPoints(objects)
Adds multiple points to this group.
|
|
addRotationPoint(point)
Adds a point to the set of rotation points of the group.
|
|
addScalePoint(point, direction)
Adds a point to the set of the scale points of the group.
|
|
addTranslationPoint(point)
Adds a point to the set of the translation points of the group.
|
|
List of the element ids resp.
|
|
removePoint(point)
Removes a point from the group.
|
|
removeRotationPoint(point)
Removes the rotation property from a point of the group.
|
|
removeScalePoint(point)
Removes the scaling property from a point of the group.
|
|
removeTranslationPoint(point)
Removes the translation property from a point of the group.
|
|
setParents(parents)
Sets ids of elements to the array this.parents.
|
|
<deprecated> | |
setRotationCenter(object)
Sets the center of rotation for the group.
|
|
setRotationPoints(objects)
Sets the rotation points of the group.
|
|
setScaleCenter(object)
Sets the center of scaling for the group.
|
|
setScalePoints(objects, direction)
Sets the scale points of the group.
|
|
setTranslationPoints(objects)
Sets the translation points of the group.
|
|
ungroup()
Releases all elements of this group.
|
|
update()
Sends an update to all group members.
|
Class Detail
JXG.Group(board, id, name, objects, attributes)
Creates a new instance of Group.
- Parameters:
- {JXG.Board} board
- {String} id
- Unique identifier for this object. If null or an empty string is given, an unique id will be generated by Board
- {String} name
- Not necessarily unique name, displayed on the board. If null or an empty string is given, an unique name will be generated.
- {Array} objects
- Array of points to add to this group.
- {Object} attributes
- Defines the visual appearance of the group.
Field Detail
<private>
{Object}
coords
Cache coordinates of points. From this and the actual position
of the points, the translation is determined.
It has to be kept updated in this class "by hand"-
Method Detail
<private>
_addActionPoint(action, point)
- Parameters:
- action
- point
<private>
_removeActionPoint(action, point)
- Parameters:
- action
- point
<private>
_setActionPoints(action, objects)
- Parameters:
- action
- objects
<private>
_update_apply_transformation(drag, t)
- Parameters:
- drag
- t
<private>
{Array}
_update_centroid_center()
- Returns:
- {Array} array of length two,
<private>
_update_find_drag_type()
<private>
_updateCoordsCache(el)
Update the cached coordinates of a group element.
- Parameters:
- {String} el
- element id of the group element whose cached coordinates are going to be updated.
- Returns:
- null
{JXG.Group}
addGroup(group)
Adds all points in a group to this group.
- Parameters:
- {JXG.Group} group
- The group added to this group.
- Returns:
- {JXG.Group} returns this group
{JXG.Object}
addParents(parents)
Adds ids of elements to the array this.parents. This is a copy
of Element.addParents.
- Parameters:
- {Array} parents
- Array of elements or ids of elements. Alternatively, one can give a list of objects as parameters.
- Returns:
- {JXG.Object} reference to the object itself.
{JXG.Group}
addPoint(object)
Adds an Point to this group.
- Parameters:
- {JXG.Point} object
- The point added to the group.
- Returns:
- {JXG.Group} returns this group
{JXG.Group}
addPoints(objects)
Adds multiple points to this group.
- Parameters:
- {Array} objects
- An array of points to add to the group.
- Returns:
- {JXG.Group} returns this group
{JXG.Group}
addRotationPoint(point)
Adds a point to the set of rotation points of the group. Dragging at one of these points results into a rotation of the whole group around
the rotation center of the group {@see JXG.Group#setRotationCenter}.
- Returns:
- {JXG.Group} returns this group
{JXG.Group}
addScalePoint(point, direction)
Adds a point to the set of the scale points of the group. Dragging at one of these points results into a scaling of the whole group.
- Parameters:
- {JXG.Point} point
- JXG.Point element.
- {String} direction
- Restricts the directions to be scaled. Possible values are 'x', 'y', 'xy'. Default value is 'xy'.
- Returns:
- {JXG.Group} returns this group
{JXG.Group}
addTranslationPoint(point)
Adds a point to the set of the translation points of the group.
Dragging one of these points results into a translation of the whole group.
- Returns:
- {JXG.Group} returns this group
{Array}
getParents()
List of the element ids resp. values used as parents in JXG.Board#create.
- Returns:
- {Array}
{JXG.Group}
removePoint(point)
Removes a point from the group.
- Parameters:
- {JXG.Point} point
- Returns:
- {JXG.Group} returns this group
{JXG.Group}
removeRotationPoint(point)
Removes the rotation property from a point of the group.
- Returns:
- {JXG.Group} returns this group
{JXG.Group}
removeScalePoint(point)
Removes the scaling property from a point of the group.
- Returns:
- {JXG.Group} returns this group
{JXG.Group}
removeTranslationPoint(point)
Removes the translation property from a point of the group.
- Returns:
- {JXG.Group} returns this group
{JXG.Object}
setParents(parents)
Sets ids of elements to the array this.parents. This is a copy
of Element.setParents
First, this.parents is cleared. See Group#addParents.
- Parameters:
- {Array} parents
- Array of elements or ids of elements. Alternatively, one can give a list of objects as parameters.
- Returns:
- {JXG.Object} reference to the object itself.
setProperty()
- Deprecated:
- Use setAttribute
{JXG.Group}
setRotationCenter(object)
Sets the center of rotation for the group. This is either a point or the centroid of the group.
- Parameters:
- {JXG.Point|String} object
- A point which will be the center of rotation, the string "centroid", or an array of length two, or a function returning an array of length two.
- Returns:
- {JXG.Group} returns this group
{JXG.Group}
setRotationPoints(objects)
Sets the rotation points of the group. Dragging at one of these points results into a rotation of the whole group around
the rotation center of the group {@see JXG.Group#setRotationCenter}.
- Returns:
- {JXG.Group} returns this group
{JXG.Group}
setScaleCenter(object)
Sets the center of scaling for the group. This is either a point or the centroid of the group.
- Parameters:
- {JXG.Point|String} object
- A point which will be the center of scaling, the string "centroid", or an array of length two, or a function returning an array of length two.
- Returns:
- {JXG.Group} returns this group
{JXG.Group}
setScalePoints(objects, direction)
Sets the scale points of the group. Dragging at one of these points results into a scaling of the whole group.
- Parameters:
- {Array|JXG.Point} objects
- Array of JXG.Point or arbitrary number of JXG.Point elements.
- {String} direction
- Restricts the directions to be scaled. Possible values are 'x', 'y', 'xy'. Default value is 'xy'. By default, all points of the group are translation points.
- Returns:
- {JXG.Group} returns this group
{JXG.Group}
setTranslationPoints(objects)
Sets the translation points of the group. Dragging at one of these points results into a translation of the whole group.
- Parameters:
- {Array|JXG.Point} objects
- Array of JXG.Point or arbitrary number of JXG.Point elements. By default, all points of the group are translation points.
- Returns:
- {JXG.Group} returns this group
{JXG.Group}
ungroup()
Releases all elements of this group.
- Returns:
- {JXG.Group} returns this (empty) group
{JXG.Group}
update()
Sends an update to all group members.
This method is called from the points' coords object event listeners
and not by the board.
- Returns:
- {JXG.Group} returns this group