Attributes
Own
none
Inherited
Members
Own
(private) coords : JXG.Coords
- Description
Coordinates of the element.
- Type
- JXG.Coords
- Source
- base/coordselement.js, line 77
(private) groups : Array
- Description
Stores the groups of this element in an array of Group.
- Type
- Array
- See
- Source
- base/coordselement.js, line 147
(private) isConstrained : Boolean
- Description
True if there the method this.updateConstraint() has been set. It is probably different from the prototype function() {return this;}. Used in updateCoords fo glider elements.
- Type
- Boolean
- See
- Source
- base/coordselement.js, line 104
needsUpdateFromParent : Boolean
- Description
A JXG.CoordsElement#updateGlider call is usually followed by a general JXG.Board#update which calls JXG.CoordsElement#updateGliderFromParent. To prevent double updates, JXG.CoordsElement#needsUpdateFromParent is set to false in updateGlider() and reset to true in the following call to JXG.CoordsElement#updateGliderFromParent
- Type
- Boolean
- Source
- base/coordselement.js, line 139
(private) onPolygon : Boolean
- Description
Determines whether the element slides on a polygon if point is a glider.
- Type
- Boolean
- Default Value
- false
- Source
- base/coordselement.js, line 112
(private) position : Number
- Description
Relative position on a slide element (line, circle, curve) if element is a glider on this element.
- Type
- Number
- Source
- base/coordselement.js, line 93
slideObject : JXG.GeometryElement
- Description
When used as a glider this member stores the object, where to glide on. To set the object to glide on use the method JXG.CoordsElement#makeGlider and DO NOT set this property directly as it will break the dependency tree.
- Type
- JXG.GeometryElement
- Source
- base/coordselement.js, line 121
slideObjects
- Description
List of elements the element is bound to, i.e. the element glides on. Only the last entry is active. Use JXG.CoordsElement#popSlideObject to remove the currently active slideObject.
- Source
- base/coordselement.js, line 128
Inherited
Methods
Own
Coords(digitsopt, withZopt) → {String}
Getter method for coordinates x, y and (optional) z.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
digits |
Number | String |
<optional> |
'auto'
|
Truncating rule for the digits in the infobox.
|
withZ |
Boolean |
<optional> |
false
|
If set to true the return value will be |
Returns
User coordinates of point.
- Type
- String
Details
- Source
- base/coordselement.js, line 874
Dist(point2) → {Number}
Getter method for the distance to a second point, this is required for CAS-elements. Here, function inlining seems to be worthwile (for plotting).
Parameters
| Name | Type | Description |
|---|---|---|
point2 |
Point | The point to which the distance shall be calculated. |
Returns
Distance in user coordinate to the given point
- Type
- Number
Details
- Source
- base/coordselement.js, line 969
X() → {Number}
Getter method for x, this is used by for CAS-points to access point coordinates.
Returns
User coordinate of point in x direction.
- Type
- Number
Details
- Source
- base/coordselement.js, line 843
(private) XEval() → {Number}
New evaluation of the function term. This is required for CAS-points: Their XTerm() method is overwritten in JXG.CoordsElement#addConstraint.
Returns
User coordinate of point in x direction.
- Type
- Number
Details
- Source
- base/coordselement.js, line 935
Y() → {Number}
Getter method for y, this is used by CAS-points to access point coordinates.
Returns
User coordinate of point in y direction.
- Type
- Number
Details
- Source
- base/coordselement.js, line 851
(private) YEval() → {Number}
New evaluation of the function term. This is required for CAS-points: Their YTerm() method is overwritten in JXG.CoordsElement#addConstraint.
Returns
User coordinate of point in y direction.
- Type
- Number
Details
- Source
- base/coordselement.js, line 947
Z() → {Number}
Getter method for z, this is used by CAS-points to access point coordinates.
Returns
User coordinate of point in z direction.
- Type
- Number
Details
- Source
- base/coordselement.js, line 859
(private) ZEval() → {Number}
New evaluation of the function term. This is required for CAS-points: Their ZTerm() method is overwritten in JXG.CoordsElement#addConstraint.
Returns
User coordinate of point in z direction.
- Type
- Number
Details
- Source
- base/coordselement.js, line 959
(private) _anim(direction, stepCount, maxRoundsopt) → {JXG.CoordsElement}
Animates a glider. Is called by the browser after startAnimation is called.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
direction |
Number | The direction the glider is animated. |
||
stepCount |
Number | The number of steps in which the parent element is divided. Must be at least 1. |
||
maxRounds |
Number |
<optional> |
-1
|
The number of rounds the glider will be animated. The glider will run infinitely if maxRounds is negative or equal to Infinity. |
Returns
Reference to itself.
- Type
- JXG.CoordsElement
Details
- See
-
- JXG.CoordsElement#startAnimation
- JXG.CoordsElement#stopAnimation
- Source
- base/coordselement.js, line 2411
(private) addAnchor(coordinates, isLabel)
In case there is an attribute "anchor", the element is bound to this anchor element. This is handled with this.relativeCoords. If the element is a label relativeCoords are given in scrCoords, otherwise in usrCoords.
Parameters
| Name | Type | Description |
|---|---|---|
coordinates |
Array | Offset from the anchor element. These are the values for this.relativeCoords. In case of a label, coordinates are screen coordinates. Otherwise, coordinates are user coordinates. |
isLabel |
Boolean | Yes/no |
Details
- Source
- base/coordselement.js, line 1605
addConstraint(terms)
Convert the point to CAS point and call update().
Parameters
| Name | Type | Description |
|---|---|---|
terms |
Array | [[zterm], xterm, yterm] defining terms for the z, x and y coordinate. The z-coordinate is optional and it is used for homogeneous coordinates. The coordinates may be either
|
Details
- See
-
- JXG.GeonextParser#geonext2JS
- Source
- base/coordselement.js, line 1487
addTransform(el, transform) → {JXG.CoordsElement}
Add transformations to this element.
Parameters
| Name | Type | Description |
|---|---|---|
el |
JXG.GeometryElement | |
transform |
JXG.Transformation | Array | Either one JXG.Transformation or an array of JXG.Transformations. |
Returns
Reference to itself.
- Type
- JXG.CoordsElement
Details
- Overrides
- JXG.GeometryElement#addTransform
- Source
- base/coordselement.js, line 1721
clearTransforms(el) → {JXG.CoordsElement}
Remove all JXG.Transformations of this element.
Parameters
| Name | Type | Description |
|---|---|---|
el |
JXG.GeometryElement |
Returns
Reference to itself.
- Type
- JXG.CoordsElement
Details
- Overrides
- JXG.GeometryElement#clearTransforms
- Source
- base/coordselement.js, line 1765
(private) findClosestSnapValue(pos) → {Number}
Find the closest entry in snapValues that is within snapValueDistance of pos.
Parameters
| Name | Type | Description |
|---|---|---|
pos |
Number | Value for which snapping is calculated. |
Returns
Index of the value to snap to, or null.
- Type
- Number
Details
- Source
- base/coordselement.js, line 567
free()
Converts a calculated element into a free element, i.e. it will delete all ancestors and transformations and, if the element is currently a glider, will remove the slideObject reference.
Details
- Source
- base/coordselement.js, line 1393
handleAttractors() → {JXG.CoordsElement}
A point can change its type from free point to glider and vice versa. If it is given an array of attractor elements (attribute attractors) and the attribute attractorDistance then the point will be made a glider if it less than attractorDistance apart from one of its attractor elements. If attractorDistance is equal to zero, the point stays in its current form.
Returns
Reference to this element
- Type
- JXG.CoordsElement
Details
- Source
- base/coordselement.js, line 1077
handleSnapToPoints(force) → {JXG.CoordsElement}
Let a point snap to the nearest point in distance of JXG.Point#attractorDistance. The function uses the coords object of the point as its actual position.
Parameters
| Name | Type | Description |
|---|---|---|
force |
Boolean | force snapping independent of what the snaptogrid attribute says |
Returns
Reference to this element
- Type
- JXG.CoordsElement
Details
- Source
- base/coordselement.js, line 993
makeGlider(slide)
Convert the point to glider and update the construction. To move the point visual onto the glider, a call of board update is necessary.
Parameters
| Name | Type | Description |
|---|---|---|
slide |
String | Object | The object the point will be bound to. |
Details
- Source
- base/coordselement.js, line 1302
moveAlong(path, time, optionsopt) → {JXG.CoordsElement}
Starts an animation which moves the point along a given path in given time.
Parameters
| Name | Type | Attributes | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
path |
Array | function | The path the point is moved on. This can be either an array of arrays or containing x and y values of the points of the path, or an array of points, or a function taking the amount of elapsed time since the animation has started and returns an array containing a x and a y value or NaN. In case of NaN the animation stops. |
||||||||||||||||
time |
Number | The time in milliseconds in which to finish the animation |
||||||||||||||||
options |
Object |
<optional> |
Optional settings for the animation. Properties
|
Returns
Reference to itself.
- Type
- JXG.CoordsElement
Details
moveAlongES6(where, timeopt, optionsopt)
ES6 version of JXG.CoordsElement#moveAlong using a promise.
Example
var A = board.create('point', [4, 4]);
A.moveAlongES6([[3, -2], [4, 0], [3, 1], [4, 4]], 2000)
.then(() => A.moveToES6([-3, -3], 1000));
Parameters
| Name | Type | Attributes | Description |
|---|---|---|---|
where |
Array | Array containing the x and y coordinate of the target location. |
|
time |
Number |
<optional> |
Number of milliseconds the animation should last. |
options |
Object |
<optional> |
Optional settings for the animation |
Returns
Promise
Details
moveTo(where, timeopt, optionsopt) → {JXG.CoordsElement}
Starts an animated point movement towards the given coordinates where.
The animation is done after time milliseconds.
If the second parameter is not given or is equal to 0, setPosition() is called, see
JXG.CoordsElement#setPosition,
i.e. the coordinates are changed without animation.
Example
// moveTo() with different easing options and callback options
let yInit = 3
let [A, B, C, D] = ['==', '<>', '<', '>'].map((s) => board.create('point', [4, yInit--], { name: s, label: { fontSize: 24 } }))
let seg = board.create('segment', [A, [() => A.X(), 0]]) // shows linear
let isLeftRight = true;
let buttonMove = board.create('button', [-2, 4, 'left',
() => {
isLeftRight = !isLeftRight;
buttonMove.rendNodeButton.innerHTML = isLeftRight ? 'left' : 'right';
let x = isLeftRight ? 4 : -4;
let sym = isLeftRight ? 'triangleleft' : 'triangleright';
A.moveTo([x, 3], 1000, { callback: () => A.setAttribute({ face: sym, size: 5 }) });
B.moveTo([x, 2], 1000, { callback: () => B.setAttribute({ face: sym, size: 5 }), effect: "<>" });
C.moveTo([x, 1], 1000, { callback: () => C.setAttribute({ face: sym, size: 5 }), effect: "<" });
D.moveTo([x, 0], 1000, { callback: () => D.setAttribute({ face: sym, size: 5 }), effect: ">" });
}]);
Parameters
| Name | Type | Attributes | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
where |
Array | Array containing the x and y coordinate of the target location. |
||||||||||||||||
time |
Number |
<optional> |
Number of milliseconds the animation should last. |
|||||||||||||||
options |
Object |
<optional> |
Optional settings for the animation Properties
|
Returns
Reference to itself.
- Type
- JXG.CoordsElement
Details
moveToES6(where, timeopt, optionsopt)
ES6 version of JXG.CoordsElement#moveTo using a promise.
Examples
var A = board.create('point', [4, 4]);
A.moveToES6([-3, 3], 1000)
.then(() => A.moveToES6([-3, -3], 1000))
.then(() => A.moveToES6([3, -3], 1000))
.then(() => A.moveToES6([3, -3], 1000));
var A = board.create('point', [4, 4]);
A.moveToES6([-3, 3], 1000)
.then(function() {
return A.moveToES6([-3, -3], 1000);
}).then(function() {
return A.moveToES6([ 3, -3], 1000);
}).then(function() {
return A.moveToES6([ 3, -3], 1000);
}).then(function() {
return A.moveAlongES6([[3, -2], [4, 0], [3, 1], [4, 4]], 5000);
}).then(function() {
return A.visitES6([-4, -4], 3000);
});
Parameters
| Name | Type | Attributes | Description |
|---|---|---|---|
where |
Array | Array containing the x and y coordinate of the target location. |
|
time |
Number |
<optional> |
Number of milliseconds the animation should last. |
options |
Object |
<optional> |
Optional settings for the animation |
Returns
Promise
Details
- See
- Source
- base/coordselement.js, line 2346
popSlideObject()
Remove the last slideObject. If there are more than one elements the point is bound to, the second last element is the new active slideObject.
Details
- Source
- base/coordselement.js, line 1358
removeTransform(transform) → {JXG.CoordsElement}
Remove transformations of this element.
Parameters
| Name | Type | Description |
|---|---|---|
transform |
JXG.Transformation | Array | Either one JXG.Transformation or an array of JXG.Transformations. |
Returns
Reference to itself.
- Type
- JXG.CoordsElement
Details
- Overrides
- JXG.GeometryElement#removeTransform
- Source
- base/coordselement.js, line 1744
setGliderPosition(x) → {JXG.Point}
Sets the position of a glider relative to the defining elements of the JXG.CoordsElement#slideObject.
Parameters
| Name | Type | Description |
|---|---|---|
x |
Number |
Returns
Reference to the point element.
- Type
- JXG.Point
Details
- Source
- base/coordselement.js, line 1288
setPosition(method, coords) → {JXG.CoordsElement}
Sets coordinates and calls the element's update() method.
Parameters
| Name | Type | Description |
|---|---|---|
method |
Number | The type of coordinates used here. Possible values are JXG.COORDS_BY_USER and JXG.COORDS_BY_SCREEN. |
coords |
Array | coordinates in screen/user units |
Returns
- Type
- JXG.CoordsElement
Details
- Overrides
- JXG.GeometryElement#setPosition
- Source
- base/coordselement.js, line 1278
setPositionByTransform(method, tv) → {JXG.CoordsElement}
Translates the point by tv = (x, y).
Parameters
| Name | Type | Description |
|---|---|---|
method |
Number | The type of coordinates used here. Possible values are JXG.COORDS_BY_USER and JXG.COORDS_BY_SCREEN. |
tv |
Array | (x, y) |
Returns
- Type
- JXG.CoordsElement
Details
- Source
- base/coordselement.js, line 1249
setPositionDirectly(method, coords) → {JXG.CoordsElement}
Sets coordinates and calls the elements's update() method.
Parameters
| Name | Type | Description |
|---|---|---|
method |
Number | The type of coordinates used here. Possible values are JXG.COORDS_BY_USER and JXG.COORDS_BY_SCREEN. |
coords |
Array | coordinates |
Returns
this element
- Type
- JXG.CoordsElement
Details
- Overrides
- JXG.GeometryElement#setPositionDirectly
- Source
- base/coordselement.js, line 1175
snapToGrid(force) → {JXG.CoordsElement}
Alias for JXG.Element#handleSnapToGrid
Parameters
| Name | Type | Description |
|---|---|---|
force |
Boolean | force snapping independent of what the snaptogrid attribute says |
Returns
Reference to this element
- Type
- JXG.CoordsElement
Details
- Overrides
- JXG.GeometryElement#snapToGrid
- Source
- base/coordselement.js, line 981
snapToPoints(force) → {JXG.CoordsElement}
Alias for JXG.CoordsElement#handleSnapToPoints.
Parameters
| Name | Type | Description |
|---|---|---|
force |
Boolean | force snapping independent of what the snaptogrid attribute says |
Returns
Reference to this element
- Type
- JXG.CoordsElement
Details
- Overrides
- JXG.GeometryElement#snapToPoints
- Source
- base/coordselement.js, line 1063
(private) updateConstraint()
Dummy function for unconstrained points or gliders.
Details
- Source
- base/coordselement.js, line 194
(private) updateCoords()
Updates the coordinates of the element.
Details
- Source
- base/coordselement.js, line 202
(private) updateGlider()
Update of glider in case of dragging the glider or setting the postion of the glider. The relative position of the glider has to be updated.
In case of a glider on a line: If the second point is an ideal point, then -1 < this.position < 1, this.position==+/-1 equals point2, this.position==0 equals point1
If the first point is an ideal point, then 0 < this.position < 2 this.position==0 or 2 equals point1, this.position==1 equals point2
Details
- Source
- base/coordselement.js, line 252
(private) updateGliderFromParent()
Update of a glider in case a parent element has been updated. That means the relative position of the glider stays the same.
Details
- Source
- base/coordselement.js, line 596
updateTransform(fromParent) → {JXG.CoordsElement}
Applies the transformations of the element. This method applies to text and images. Point transformations are handled differently.
Parameters
| Name | Type | Description |
|---|---|---|
fromParent |
Boolean | True if the drag comes from a child element. Unused. |
Returns
Reference to itself.
- Type
- JXG.CoordsElement
Details
- Source
- base/coordselement.js, line 1680
visit(where, time, optionsopt) → {JXG.CoordsElement}
Starts an animated point movement towards the given coordinates where. After arriving at
where the point moves back to where it started. The animation is done after time
milliseconds.
Example
// visit() with different easing options
let yInit = 3
let [A, B, C, D] = ['==', '<>', '<', '>'].map((s) => board.create('point', [4, yInit--], { name: s, label: { fontSize: 24 } }))
let seg = board.create('segment', [A, [() => A.X(), 0]]) // shows linear
let isLeftRight = true;
let buttonVisit = board.create('button', [0, 4, 'visit',
() => {
let x = isLeftRight ? 4 : -4
A.visit([-x, 3], 4000, { effect: "==", repeat: 2 }) // linear
B.visit([-x, 2], 4000, { effect: "<>", repeat: 2 })
C.visit([-x, 1], 4000, { effect: "<", repeat: 2 })
D.visit([-x, 0], 4000, { effect: ">", repeat: 2 })
}])
Parameters
| Name | Type | Attributes | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
where |
Array | Array containing the x and y coordinate of the target location. |
|||||||||||||||||||||
time |
Number | Number of milliseconds the animation should last. |
|||||||||||||||||||||
options |
Object |
<optional> |
Optional settings for the animation Properties
|
Returns
Reference to itself.
- Type
- JXG.CoordsElement
Details
visitES6(where, timeopt, optionsopt)
ES6 version of JXG.CoordsElement#moveVisit using a promise.
Example
var A = board.create('point', [4, 4]);
A.visitES6([-4, -4], 3000)
.then(() => A.moveToES6([-3, 3], 1000));
Parameters
| Name | Type | Attributes | Description |
|---|---|---|---|
where |
Array | Array containing the x and y coordinate of the target location. |
|
time |
Number |
<optional> |
Number of milliseconds the animation should last. |
options |
Object |
<optional> |
Optional settings for the animation |
Returns
Promise
Details
- See
- Source
- base/coordselement.js, line 2386
(static) create(Callback, board, coords, attr, arg1, arg2) → {Object}
Generic method to create point, text or image. Determines the type of the construction, i.e. free, or constrained by function, transformation or of glider type.
Parameters
| Name | Type | Description |
|---|---|---|
Callback |
Object | |
board |
Object | Link to the board object |
coords |
Array | Array with coordinates. This may be: array of numbers, function returning an array of numbers, array of functions returning a number, object and transformation. If the attribute "slideObject" exists, a glider element is constructed. |
attr |
Object | Attributes object |
arg1 |
Object | Optional argument 1: in case of text this is the text content, in case of an image this is the url. |
arg2 |
Array | Optional argument 2: in case of image this is an array containing the size of the image. |
Returns
returns the created object or false.
- Type
- Object
Details
- Source
- base/coordselement.js, line 2516
Inherited
Events
Own
none
Inherited
Parameters
| Name | Type | Description |
|---|---|---|
coordinates |
Array | An array with the affine user coordinates of the point. JXG.Options#elements, and - optionally - a name and an id. |
Details
- Source
- base/coordselement.js, line 61