Class JXG.Coords
This is the Coordinates class.
All members a coordinate has to provide
are defined here.
Defined in: Coords.js.
Constructor Attributes | Constructor Name and Description |
---|---|
JXG.Coords(method, coordinates, renderer)
Constructs a new Coordinates object.
|
Field Attributes | Field Name and Description |
---|---|
Stores the board the object is used on.
|
|
Holds the registered event handlers.
|
|
Stores coordinates for screen view as homogeneous coordinates.
|
|
Stores coordinates for user view as homogeneous coordinates.
|
Method Attributes | Method Name and Description |
---|---|
distance(coord_type, coordinates)
Calculate distance of one point to another.
|
|
off(event, handler)
Unregister an event handler.
|
|
on(event, handler, context)
Register a new event handler.
|
|
setCoordinates(coord_type, coordinates, doRound)
Set coordinates by either user coordinates or screen coordinates and recalculate the other one.
|
|
triggerEventHandlers(event)
Triggers all event handlers of this element for a given event.
|
Event Attributes | Event Name and Description |
---|---|
update(ou, os)
Triggered whenever the coordinates change.
|
Class Detail
JXG.Coords(method, coordinates, renderer)
Constructs a new Coordinates object.
- Parameters:
- {int} method
- The type of coordinates given by the user. Accepted values are COORDS_BY_SCREEN and COORDS_BY_USER.
- {Array} coordinates
- An array of affine coordinates.
- {JXG.AbstractRenderer} renderer
- A reference to a Renderer.
Field Detail
{JXG.Board}
board
Stores the board the object is used on.
{Object}
eventHandlers
Holds the registered event handlers.
Defined in: EventEmitter.js.
Defined in: EventEmitter.js.
{Array}
scrCoords
Stores coordinates for screen view as homogeneous coordinates.
{Array}
usrCoords
Stores coordinates for user view as homogeneous coordinates.
Method Detail
{Number}
distance(coord_type, coordinates)
Calculate distance of one point to another.
- Parameters:
- {Number} coord_type
- The type of coordinates used here. Possible values are JXG.COORDS_BY_USER and JXG.COORDS_BY_SCREEN.
- {JXG.Coords} coordinates
- The Coords object to which the distance is calculated.
- Returns:
- {Number} The distance
off(event, handler)
Unregister an event handler.
Defined in: EventEmitter.js.
Defined in: EventEmitter.js.
- Parameters:
- {String} event
- {Function} handler
- Returns:
- Reference to the object.
on(event, handler, context)
Register a new event handler. For a list of possible events see documentation of the elements and objects implementing
the EventEmitter interface.
Defined in: EventEmitter.js.
Defined in: EventEmitter.js.
- Parameters:
- {String} event
- {Function} handler
- {Object} context Optional
- The context the handler will be called in, default is the element itself.
- Returns:
- Reference to the object.
{JXG.Coords}
setCoordinates(coord_type, coordinates, doRound)
Set coordinates by either user coordinates or screen coordinates and recalculate the other one.
- Parameters:
- {Number} coord_type
- The type of coordinates used here. Possible values are COORDS_BY_USER and COORDS_BY_SCREEN.
- {Array} coordinates
- An array of affine coordinates the Coords object is set to.
- {Boolean} doRound Optional, Default: true
- flag If true or null round the coordinates in usr2screen. This is used in smooth curve plotting. The IE needs rounded coordinates. Id doRound==false we have to round in updatePathString.
- Returns:
- {JXG.Coords} Reference to the coords object.
triggerEventHandlers(event)
Triggers all event handlers of this element for a given event.
Defined in: EventEmitter.js.
Defined in: EventEmitter.js.
- Parameters:
- {String} event
- Returns:
- Reference to the object.
Event Detail
update(ou, os)
Triggered whenever the coordinates change.
- Parameters:
- {Array} ou
- Old user coordinates
- {Array} os
- Old screen coordinates