Class JXG.Board
↳ JXG.Board
JXG.Board controls all properties and methods used to manage a geonext board like managing geometric
elements, managing mouse and touch events, etc. You probably don't want to use this constructor directly.
Please use JXG.JSXGraph#initBoard to initialize a board.
Defined in: Board.js.
Constructor Attributes | Constructor Name and Description |
---|---|
JXG.Board(container, renderer, id, origin, zoomX, zoomY, unitX, unitY, canvasWidth, canvasHeight, showCopyright)
Constructs a new Board object.
|
Field Attributes | Field Name and Description |
---|---|
Stores all the objects that are currently running an animation.
|
|
<constant> |
Board is in construction mode, objects are highlighted on mouse over and the behaviour of the board
is determined by the construction type stored in the field constructionType.
|
<constant> |
Board is in drag mode, objects aren't highlighted on mouse over and the object referenced in
{JXG.Board#mouse} is updated on mouse movement.
|
<constant> |
In this mode a mouse move changes the origin's screen coordinates.
|
<constant> |
Board is in no special mode, objects are highlighted on mouse over and objects may be
clicked to start drag&drop.
|
<constant> |
Update is made with high quality, e.g.
|
<constant> |
Update is made with high quality, e.g.
|
<constant> |
/* Update is made with low quality, e.g.
|
Canvas Height
|
|
Canvas width.
|
|
<constant> |
When the board is in construction mode this construction type says we want to construct a circle.
|
<private> |
When the board is in construction mode this construction type says we want to construct a glider.
|
<private> |
When the board is in construction mode this construction type says we want to construct a intersection.
|
<private> |
When the board is in construction mode this construction type says we want to construct a line.
|
<private> |
When the board is in construction mode this construction type says we want to construct a midpoint.
|
<private> |
When the board is in construction mode this construction type says we want to construct a parallel.
|
<private> |
When the board is in construction mode this construction type says we want to construct a perpendicular.
|
<constant> |
When the board is in construction mode this construction type says we want to construct a point.
|
The html-id of the html element containing the board.
|
|
Pointer to the html element containing the board.
|
|
Cached ressult of getCoordsTopLeftCorner for touch/mouseMove-Events to save some DOM operations.
|
|
Deprecated name for JXG.Board#create.
|
|
The current color blindness deficiency is stored in this property.
|
|
An array containing all other boards that are updated after this board has been updated.
|
|
Dimension of the board.
|
|
Collects all elements that triggered a mouse down event.
|
|
The distance from the mouse to the dragged object in x direction when the user clicked the mouse button.
|
|
The distance from the mouse to the dragged object in y direction when the user clicked the mouse button.
|
|
An associative array to store the objects of the board by name.
|
|
If GEONExT constructions are displayed, then this property should be set to true.
|
|
Grids keeps track of all grids attached to this board.
|
|
An associative array containing all groups belonging to the board.
|
|
A flag which tells if the board registers mouse events.
|
|
A flag which tells if the board registers touch events.
|
|
An associative array containing all highlighted elements belonging to the board.
|
|
An array containing all hook functions.
|
|
GUI interface
|
|
During the update process this is set to false to prevent an endless loop.
|
|
If true updates are skipped.
|
|
The board mode the board is currently in.
|
|
References to the object that is dragged with the mouse on the board.
|
|
Full updates are needed after zoom and axis translates.
|
|
Number of objects ever created on this board.
|
|
An associative array containing all geometric objects belonging to the board.
|
|
Some standard options
|
|
Coordinates of the boards origin.
|
|
If reducedUpdate is set to true then only the dragged element and few (e.g.
|
|
A reference to this boards renderer.
|
|
Display the licence text.
|
|
Keeps track on touched elements, like JXG.Board#mouse does for mouse events.
|
|
Contains the last time (epoch, msec) since the last touchMove event which was not thrown away or since
touchStart because Android's Webkit browser fires too much of them.
|
|
The number of pixels which represent one unit in user-coordinates in x direction.
|
|
The number of pixels which represent one unit in user-coordinates in y direction.
|
|
The update quality of the board.
|
|
A string containing the XML text of the construction.
|
|
Zoom factor in X direction.
|
|
Zoom factor in Y direction.
|
Method Attributes | Method Name and Description |
---|---|
addAnimation(element)
Adds an animation.
|
|
addChild(board)
Adds a dependent board to this board.
|
|
addConditions(str)
Add conditional updates to the elements.
|
|
Add all possible event handlers to the board object
|
|
addGrid()
Adds a grid to the board according to the settings given in board.options.
|
|
addHook(hook, m, context)
Adds a hook to this board.
|
|
animate()
General purpose animation function.
|
|
Apply update on all objects with the new zoom-factors.
|
|
Calculates adequate snap sizes.
|
|
Delete the elements drawn as part of a trace of an element.
|
|
<private> |
Handler for click on down arrow in the navigation bar
|
<private> |
Handler for click on left arrow in the navigation bar
|
<private> |
Handler for click on right arrow in the navigation bar
|
<private> |
Handler for click on up arrow in the navigation bar
|
create(elementType, parents, attributes)
Creates a new geometric element of type elementType.
|
|
createRoulette(c1, c2, start_c1, stepsize, time, time, pointlist)
Function to animate a curve rolling on another curve.
|
|
Remove highlighting of all elements.
|
|
emulateColorblindness(deficiency)
Initializes color blindness simulation.
|
|
finalizeAdding(obj)
After construction of the object the visibility is set
and the label is constructed if necessary.
|
|
Runs through all elements and calls their update() method and update the conditions.
|
|
Generates unique id for a board.
|
|
generateName(object)
Generates an unique name for the given object.
|
|
Collects all elements under current mouse position.
|
|
getAllUnderMouse(Evt)
Collects all elements under current mouse position plus current user coordinates of mouse cursor.
|
|
Get the bounding box of the board.
|
|
Calculates mouse coordinates relative to the boards container.
|
|
getMousePosition(e, i)
Get the position of the mouse in screen coordinates, relative to the upper left corner
of the host tag.
|
|
getPartialConstruction(root, filters)
Return all elements that somehow depend on the element root and satisfy one of the filter rules.
|
|
getScrCoordsOfMouse(x, y)
In case of snapToGrid activated this method caclulates the screen coords of mouse "snapped to grid".
|
|
getUsrCoordsOfMouse(Evt)
In case of snapToGrid activated this method calculates the user coords of mouse "snapped to grid".
|
|
highlightCustomInfobox(text)
Changes the text of the info box to what is provided via text.
|
|
highlightInfobox(x, y, el)
Changes the text of the info box to show the given coordinates.
|
|
Initialize some objects which are contained in every GEONExT construction by default,
but are not contained in the gxt files.
|
|
Initialize the info box object which is used to display
the coordinates of points near the mouse pointer,
|
|
initMoveObject(x, y)
Collects all elements below the current mouse pointer and fulfilling the following constraints:
|
|
initMoveOrigin(x, y)
Initiate moving the origin.
|
|
initXYstart(obj)
Helper function which returns a reasonable starting point for the object being dragged
|
|
mouseDownListener(Evt)
This method is called by the browser when the mouse is moved.
|
|
<private> |
mouseMoveListener(Event)
This method is called by the browser when the left mouse button is clicked.
|
<private> |
mouseUpListener(Evt)
This method is called by the browser when the left mouse button is released.
|
mouseWheelListener(Event)
Handler for mouse wheel events.
|
|
moveLine(p1, p2, o)
Moves a line in multitouch mode.
|
|
moveObject(x, y, o)
Moves an object.
|
|
moveOrigin(x, y)
Moves the origin and initializes an update of all elements.
|
|
otherIntersection(el1, el2, el)
Intersectionof circles and line
|
|
Sets for all objects the needsUpdate flag to "true".
|
|
removeAncestors(object)
Removes the ancestors of an object an the object itself from board and renderer.
|
|
removeChild(board)
Deletes a board from the list of dependent boards.
|
|
Remove all event handlers from the board object
|
|
Removes all grids assigned to this board.
|
|
removeHook(id)
Removes a hook from the board.
|
|
removeObject(object)
Removes object from board and renderer.
|
|
resizeContainer(canvasWidth, canvasHeight)
Change the height and width of the board's container.
|
|
setBoundingBox(bbox, keepaspectratio)
Set the bounding box of the board.
|
|
setId(obj, type)
Composes an id for an element.
|
|
setZoom(fX, fY)
Sets the zoom level to fX resp fY.
|
|
Lists the dependencies graph in a new HTML-window.
|
|
showXML()
Lists the XML code of the construction in a new HTML-window.
|
|
Cancels all running animations.
|
|
Stop updates of the board.
|
|
touchStartListener(evt)
Touch-Events
|
|
Enable updates of the board.
|
|
update(drag)
Runs through most elements and calls their update() method and update the conditions.
|
|
<private> |
Computes the commands in the conditions-section of the gxt file.
|
updateElements(drag)
Runs through all elements and calls their update() method.
|
|
updateHooks(m)
Runs through all hooked functions and calls them.
|
|
updateInfobox(el)
Updates and displays a little info box to show coordinates of current selected points.
|
|
updateRenderer(drag)
Runs through all elements and calls their update() method.
|
|
updateRendererCanvas(drag)
Runs through all elements and calls their update() method.
|
|
zoom100()
Resets zoom factor to 100%.
|
|
Zooms the board so every visible point is shown.
|
|
zoomElements(elements)
Reset the bounding box and the zoom level to 100% such that a given set of elements is within the board's viewport.
|
|
zoomIn(x, y)
Zooms into the board by the factors board.options.zoom.factorX and board.options.zoom.factorY and applies the zoom.
|
|
zoomOut(x, y)
Zooms out of the board by the factors board.options.zoom.factorX and board.options.zoom.factorY and applies the zoom.
|
Class Detail
JXG.Board(container, renderer, id, origin, zoomX, zoomY, unitX, unitY, canvasWidth, canvasHeight, showCopyright)
Constructs a new Board object.
- Parameters:
- {String} container
- The id or reference of the HTML DOM element the board is drawn in. This is usually a HTML div.
- {JXG.AbstractRenderer} renderer
- The reference of a renderer.
- {String} id
- Unique identifier for the board, may be an empty string or null or even undefined.
- {JXG.Coords} origin
- The coordinates where the origin is placed, in user coordinates.
- {Number} zoomX
- Zoom factor in x-axis direction
- {Number} zoomY
- Zoom factor in y-axis direction
- {Number} unitX
- Units in x-axis direction
- {Number} unitY
- Units in y-axis direction
- {Number} canvasWidth
- The width of canvas
- {Number} canvasHeight
- The height of canvas
- {Boolean} showCopyright
- Display the copyright text
Field Detail
{Object}
animationObjects
Stores all the objects that are currently running an animation.
<constant>
{Number}
BOARD_MODE_CONSTRUCT
Board is in construction mode, objects are highlighted on mouse over and the behaviour of the board
is determined by the construction type stored in the field constructionType.
<constant>
{Number}
BOARD_MODE_DRAG
Board is in drag mode, objects aren't highlighted on mouse over and the object referenced in
{JXG.Board#mouse} is updated on mouse movement.
- See:
- JXG.Board#drag_obj
<constant>
{Number}
BOARD_MODE_MOVE_ORIGIN
In this mode a mouse move changes the origin's screen coordinates.
<constant>
{Number}
BOARD_MODE_NONE
Board is in no special mode, objects are highlighted on mouse over and objects may be
clicked to start drag&drop.
<constant>
{Number}
BOARD_MODE_ZOOM
Update is made with high quality, e.g. graphs are evaluated at much more points.
<constant>
{Number}
BOARD_QUALITY_HIGH
Update is made with high quality, e.g. graphs are evaluated at much more points.
<constant>
{Number}
BOARD_QUALITY_LOW
/* Update is made with low quality, e.g. graphs are evaluated at a lesser amount of points.
{Number}
canvasHeight
Canvas Height
{Number}
canvasWidth
Canvas width.
<constant>
{Number}
CONSTRUCTION_TYPE_CIRCLE
When the board is in construction mode this construction type says we want to construct a circle.
<private>
{int}
CONSTRUCTION_TYPE_GLIDER
When the board is in construction mode this construction type says we want to construct a glider.
<private>
{int}
CONSTRUCTION_TYPE_INTERSECTION
When the board is in construction mode this construction type says we want to construct a intersection.
<private>
{int}
CONSTRUCTION_TYPE_LINE
When the board is in construction mode this construction type says we want to construct a line.
<private>
{int}
CONSTRUCTION_TYPE_MIDPOINT
When the board is in construction mode this construction type says we want to construct a midpoint.
<private>
{int}
CONSTRUCTION_TYPE_PARALLEL
When the board is in construction mode this construction type says we want to construct a parallel.
<private>
{int}
CONSTRUCTION_TYPE_PERPENDICULAR
When the board is in construction mode this construction type says we want to construct a perpendicular.
<constant>
{Number}
CONSTRUCTION_TYPE_POINT
When the board is in construction mode this construction type says we want to construct a point.
{String}
container
The html-id of the html element containing the board.
{Object}
containerObj
Pointer to the html element containing the board.
{Array}
cPos
Cached ressult of getCoordsTopLeftCorner for touch/mouseMove-Events to save some DOM operations.
createElement
Deprecated name for JXG.Board#create.
currentCBDef
The current color blindness deficiency is stored in this property. If color blindness is not emulated
at the moment, it's value is 'none'.
{Array}
dependentBoards
An array containing all other boards that are updated after this board has been updated.
{Number}
dimension
Dimension of the board.
- Default Value:
- 2
{Array}
downObjects
Collects all elements that triggered a mouse down event.
{Number}
drag_dx
The distance from the mouse to the dragged object in x direction when the user clicked the mouse button.
- See:
- JXG.Board#drag_dy
- JXG.Board#drag_obj
{Number}
drag_dy
The distance from the mouse to the dragged object in y direction when the user clicked the mouse button.
- See:
- JXG.Board#drag_dx
- JXG.Board#drag_obj
{Object}
elementsByName
An associative array to store the objects of the board by name. the name of the object is the key and value is a reference to the object.
{Boolean}
geonextCompatibilityMode
If GEONExT constructions are displayed, then this property should be set to true.
At the moment there should be no difference. But this may change.
This is set in JXG.GeonextReader#readGeonext.
- See:
- JXG.GeonextReader#readGeonext
- Default Value:
- false
grids
Grids keeps track of all grids attached to this board.
{Object}
groups
An associative array containing all groups belonging to the board. Key is the id of the group and value is a reference to the object.
{Boolean}
hasMouseHandlers
A flag which tells if the board registers mouse events.
- Default Value:
- true
{Boolean}
hasTouchHandlers
A flag which tells if the board registers touch events.
- Default Value:
- true
{Object}
highlightedObjects
An associative array containing all highlighted elements belonging to the board.
{Array}
hooks
An array containing all hook functions.
intersectionOptions
GUI interface
Defined in: Wrappers.js.
Defined in: Wrappers.js.
{Boolean}
inUpdate
During the update process this is set to false to prevent an endless loop.
- Default Value:
- false
{Boolean}
isSuspendedRedraw
If true updates are skipped.
{Number}
mode
The board mode the board is currently in. Possible values are
- JXG.Board.BOARD_MODE_NONE
- JXG.Board.BOARD_MODE_DRAG
- JXG.Board.BOARD_MODE_CONSTRUCT
- JXG.Board.BOARD_MODE_MOVE_ORIGIN
{.}
mouse
References to the object that is dragged with the mouse on the board.
- See:
{Boolean}
needsFullUpdate
Full updates are needed after zoom and axis translates. This saves some time during an update.
- Default Value:
- false
{Number}
numObjects
Number of objects ever created on this board. This includes every object, even invisible and deleted ones.
{Object}
objects
An associative array containing all geometric objects belonging to the board. Key is the id of the object and value is a reference to the object.
{JXG.Options}
options
Some standard options
{Object}
origin
Coordinates of the boards origin. This a object with the two properties
usrCoords and scrCoords. usrCoords always equals [1, 0, 0] and scrCoords
stores the boards origin in homogeneous screen coordinates.
{Boolean}
reducedUpdate
If reducedUpdate is set to true then only the dragged element and few (e.g. 2) following
elements are updated during mouse move. On mouse up the whole construction is
updated. This enables us to be fast even on very slow devices.
- Default Value:
- false
{JXG.AbstractRenderer}
renderer
A reference to this boards renderer.
showCopyright
Display the licence text.
- See:
- JXG.JSXGraph#licenseText
- JXG.JSXGraph#initBoard
{Array}
touches
Keeps track on touched elements, like JXG.Board#mouse does for mouse events.
- See:
{Number}
touchMoveLast
Contains the last time (epoch, msec) since the last touchMove event which was not thrown away or since
touchStart because Android's Webkit browser fires too much of them.
{Number}
unitX
The number of pixels which represent one unit in user-coordinates in x direction.
{Number}
unitY
The number of pixels which represent one unit in user-coordinates in y direction.
{Number}
updateQuality
The update quality of the board. In most cases this is set to JXG.Board#BOARD_QUALITY_HIGH.
If JXG.Board#mode equals JXG.Board#BOARD_MODE_DRAG this is set to
JXG.Board#BOARD_QUALITY_LOW to speed up the update process by e.g. reducing the number of
evaluation points when plotting functions. Possible values are
- BOARD_QUALITY_LOW
- BOARD_QUALITY_HIGH
- See:
- JXG.Board#mode
{String}
xmlString
A string containing the XML text of the construction. This is set in JXG.FileReader#parseString.
Only useful if a construction is read from a GEONExT-, Intergeo-, Geogebra-, or Cinderella-File.
{Number}
zoomX
Zoom factor in X direction. It only stores the zoom factor to be able
to get back to 100% in zoom100().
{Number}
zoomY
Zoom factor in Y direction. It only stores the zoom factor to be able
to get back to 100% in zoom100().
Method Detail
{JXG.Board}
addAnimation(element)
Adds an animation. Animations are controlled by the boards, so the boards need to be aware of the
animated elements. This function tells the board about new elements to animate.
- Parameters:
- {JXG.GeometryElement} element
- The element which is to be animated.
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
addChild(board)
Adds a dependent board to this board.
- Parameters:
- {JXG.Board} board
- A reference to board which will be updated after an update of this board occured.
- Returns:
- {JXG.Board} Reference to the board
addConditions(str)
Add conditional updates to the elements.
- Parameters:
- {String} str
- String containing coniditional update in geonext syntax
addEventHandlers()
Add all possible event handlers to the board object
{JXG.Board}
addGrid()
Adds a grid to the board according to the settings given in board.options.
- Returns:
- {JXG.Board} Reference to the board.
{Number}
addHook(hook, m, context)
Adds a hook to this board. A hook is a function which will be called on every board update.
- Parameters:
- {Function} hook
- A function to be called by the board after an update occured.
- {String} m Optional, Default: 'update'
- When the hook is to be called. Possible values are mouseup, mousedown and update.
- {Object} context Optional, Default: board
- Determines the execution context the hook is called. This parameter is optional, default is the board object the hook is attached to.
- Returns:
- {Number} Id of the hook, required to remove the hook from the board.
{JXG.Board}
animate()
General purpose animation function. This currently only supports moving points from one place to another. This
is faster than managing the animation per point, especially if there is more than one animated point at the same time.
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
applyZoom()
Apply update on all objects with the new zoom-factors. Clears all traces.
- Returns:
- {JXG.Board} Reference to the board.
{JXG.Board}
calculateSnapSizes()
Calculates adequate snap sizes.
- Returns:
- {JXG.Board} Reference to the board.
{JXG.Board}
clearTraces()
Delete the elements drawn as part of a trace of an element.
- Returns:
- {JXG.Board} Reference to the board
<private>
clickDownArrow()
Handler for click on down arrow in the navigation bar
<private>
clickLeftArrow()
Handler for click on left arrow in the navigation bar
<private>
clickRightArrow()
Handler for click on right arrow in the navigation bar
<private>
clickUpArrow()
Handler for click on up arrow in the navigation bar
{Object}
create(elementType, parents, attributes)
Creates a new geometric element of type elementType.
- Parameters:
- {String} elementType
- Type of the element to be constructed given as a string e.g. 'point' or 'circle'.
- {Array} parents
- Array of parent elements needed to construct the element e.g. coordinates for a point or two points to construct a line. This highly depends on the elementType that is constructed. See the corresponding JXG.create* methods for a list of possible parameters.
- {Object} attributes
- An object containing the attributes to be set. This also depends on the elementType. Common attributes are name, visible, strokeColor.
- Returns:
- {Object} Reference to the created element. This is usually a GeometryElement, but can be an array containing two or more elements.
{Array}
createRoulette(c1, c2, start_c1, stepsize, time, time, pointlist)
Function to animate a curve rolling on another curve.
- Parameters:
- {Curve} c1
- JSXGraph curve building the floor where c2 rolls
- {Curve} c2
- JSXGraph curve which rolls on c1.
- {number} start_c1
- The parameter t such that c1(t) touches c2. This is the start position of the rolling process
- {Number} stepsize
- Increase in t in each step for the curve c1
- {Number} time
- Delay time for setInterval()
- time
- pointlist
- Returns:
- {Array} pointlist Array of points which are rolled in each step. This list should contain all points which define c2 and gliders on c2.
- Examples:
// Line which will be the floor to roll upon. var line = brd.create('curve', [function (t) { return t;}, function (t){ return 1;}], {strokeWidth:6}); // Center of the rolling circle var C = brd.create('point',[0,2],{name:'C'}); // Starting point of the rolling circle var P = brd.create('point',[0,1],{name:'P', trace:true}); // Circle defined as a curve. The circle "starts" at P, i.e. circle(0) = P var circle = brd.create('curve',[ function (t){var d = P.Dist(C), beta = JXG.Math.Geometry.rad([C.X()+1,C.Y()],C,P); t += beta; return C.X()+d*Math.cos(t); }, function (t){var d = P.Dist(C), beta = JXG.Math.Geometry.rad([C.X()+1,C.Y()],C,P); t += beta; return C.Y()+d*Math.sin(t); }, 0,2*Math.PI], {strokeWidth:6, strokeColor:'green'}); // Point on circle var B = brd.create('glider',[0,2,circle],{name:'B', color:'blue',trace:false}); var roll = brd.createRoulette(line, circle, 0, Math.PI/20, 1, 100, [C,P,B]); roll.start() // Start the rolling, to be stopped by roll.stop()
{JXG.Board}
dehighlightAll()
Remove highlighting of all elements.
- Returns:
- {JXG.Board} Reference to the board.
{JXG.Board}
emulateColorblindness(deficiency)
Initializes color blindness simulation.
- Parameters:
- {String} deficiency
- Describes the color blindness deficiency which is simulated. Accepted values are 'protanopia', 'deuteranopia', and 'tritanopia'.
- Returns:
- {JXG.Board} Reference to the board
finalizeAdding(obj)
After construction of the object the visibility is set
and the label is constructed if necessary.
- Parameters:
- {Object} obj
- The object to add.
{JXG.Board}
fullUpdate()
Runs through all elements and calls their update() method and update the conditions.
This is necessary after zooming and changing the bounding box.
- Returns:
- {JXG.Board} Reference to the board
{String}
generateId()
Generates unique id for a board. The result is randomly generated and prefixed with 'jxgBoard'.
- Returns:
- {String} Unique id for a board.
{String}
generateName(object)
Generates an unique name for the given object. The result depends on the objects type, if the
object is a JXG.Point, capital characters are used, if it is of type JXG.Line
only lower case characters are used. If object is of type JXG.Polygon, a bunch of lower
case characters prefixed with P_ are used. If object is of type JXG.Circle the name is
generated using lower case characters. prefixed with k_ is used. In any other case, lower case
chars prefixed with s_ is used.
- Parameters:
- {Object} object
- Reference of an JXG.GeometryElement that is to be named.
- Returns:
- {String} Unique name for the object.
{Array}
getAllObjectsUnderMouse(Evt)
Collects all elements under current mouse position.
- Parameters:
- {Event} Evt
- Event object containing the mouse coordinates.
- Returns:
- {Array} Array of elements at the current mouse position.
{Array}
getAllUnderMouse(Evt)
Collects all elements under current mouse position plus current user coordinates of mouse cursor.
- Parameters:
- {Event} Evt
- Event object containing the mouse coordinates.
- Returns:
- {Array} Array of elements at the current mouse position plus current user coordinates of mouse.
{Array}
getBoundingBox()
Get the bounding box of the board.
- Returns:
- {Array} bounding box [x1,y1,x2,y2] upper left corner, lower right corner
{Array}
getCoordsTopLeftCorner()
Calculates mouse coordinates relative to the boards container.
- Returns:
- {Array} Array of coordinates relative the boards container top left corner.
{Array}
getMousePosition(e, i)
Get the position of the mouse in screen coordinates, relative to the upper left corner
of the host tag.
- Parameters:
- {Event} e
- Event object given by the browser.
- {Number} i Optional
- Only use in case of touch events. This determines which finger to use and should not be set for mouseevents.
- Returns:
- {Array} Contains the mouse coordinates in user coordinates, ready for JXG.Coords
getPartialConstruction(root, filters)
Return all elements that somehow depend on the element root and satisfy one of the filter rules.
filters are objects which's properties are compared to every element found in the dependency tree.
- Parameters:
- {JXG.GeometryElement} root
- Dependency tree root element
- {Object} filters
- An arbitrary amount of objects which define filters for the elements to return. Only elements that fulfill at least one filter are returned. The comparison is a direct comparison, i.e. nested objects won't be compared.
- Examples:
// This will return only points var partPoints = board.getPartialConstruction(p, {elementClass: JXG.OBJECT_CLASS_POINT}); // This will return only points and lines var partPointsLines = board.getPartialConstruction(p, {elementClass: JXG.OBJECT_CLASS_POINT}, {elementClass: JXG.OBJECT_CLASS_LINE});
{Array}
getScrCoordsOfMouse(x, y)
In case of snapToGrid activated this method caclulates the screen coords of mouse "snapped to grid".
- Parameters:
- {Number} x
- X coordinate in screen coordinates
- {Number} y
- Y coordinate in screen coordinates
- Returns:
- {Array} Coordinates of the mouse in screen coordinates, snapped to grid.
{Array}
getUsrCoordsOfMouse(Evt)
In case of snapToGrid activated this method calculates the user coords of mouse "snapped to grid".
- Parameters:
- {Event} Evt
- Event object containing the mouse coordinates.
- Returns:
- {Array} Coordinates of the mouse in screen coordinates, snapped to grid.
{JXG.Board}
highlightCustomInfobox(text)
Changes the text of the info box to what is provided via text.
- Parameters:
- {String} text
- Returns:
- {JXG.Board} Reference to the board.
{JXG.Board}
highlightInfobox(x, y, el)
Changes the text of the info box to show the given coordinates.
- Parameters:
- {Number} x
- {Number} y
- {JXG.Point} el
- The element the mouse is pointing at
- Returns:
- {JXG.Board} Reference to the board.
{JXG.Board}
initGeonextBoard()
Initialize some objects which are contained in every GEONExT construction by default,
but are not contained in the gxt files.
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
initInfobox()
Initialize the info box object which is used to display
the coordinates of points near the mouse pointer,
- Returns:
- {JXG.Board} Reference to the board
{Array}
initMoveObject(x, y)
Collects all elements below the current mouse pointer and fulfilling the following constraints:
- isDraggable
- visible
- not fixed
- not frozen
- Parameters:
- {Number} x
- Current mouse/touch coordinates
- {Number} y
- current mouse/touch coordinates
- Returns:
- {Array} A list of geometric elements.
initMoveOrigin(x, y)
Initiate moving the origin. This is used in mouseDown and touchStart listeners.
- Parameters:
- {Number} x
- Current mouse/touch coordinates
- {Number} y
- Current mouse/touch coordinates
{Array}
initXYstart(obj)
Helper function which returns a reasonable starting point for the object being dragged
- Parameters:
- {JXG.GeometryElement} obj
- The object to be dragged
- Returns:
- {Array} The starting point in usr coords
{Boolean}
mouseDownListener(Evt)
This method is called by the browser when the mouse is moved.
- Parameters:
- {Event} Evt
- The browsers event object.
- Returns:
- {Boolean} True if no element is found under the current mouse pointer, false otherwise.
<private>
mouseMoveListener(Event)
This method is called by the browser when the left mouse button is clicked.
- Parameters:
- {Event} Event
- The browsers event object.
<private>
mouseUpListener(Evt)
This method is called by the browser when the left mouse button is released.
- Parameters:
- Evt
{Boolean}
mouseWheelListener(Event)
Handler for mouse wheel events. Used to zoom in and out of the board.
- Parameters:
- {Event} Event
- Returns:
- {Boolean}
moveLine(p1, p2, o)
Moves a line in multitouch mode.
- Parameters:
- {array} p1
- x,y coordinates of first touch
- {array} p2
- x,y coordinates of second touch
- {object} o
- The touch object that is dragged: {JXG.Board#touches}.
moveObject(x, y, o)
Moves an object.
- Parameters:
- {Number} x
- Coordinate
- {Number} y
- Coordinate
- {object} o
- The touch object that is dragged: {JXG.Board#mouse} or {JXG.Board#touches}.
{JXG.Board}
moveOrigin(x, y)
Moves the origin and initializes an update of all elements.
- Parameters:
- x
- y
- Returns:
- {JXG.Board} Reference to this board.
otherIntersection(el1, el2, el)
Intersectionof circles and line
Defined in: Wrappers.js.
Defined in: Wrappers.js.
- Parameters:
- el1
- el2
- el
{JXG.Board}
prepareUpdate()
Sets for all objects the needsUpdate flag to "true".
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
removeAncestors(object)
Removes the ancestors of an object an the object itself from board and renderer.
- Parameters:
- {JXG.GeometryElement} object
- The object to remove.
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
removeChild(board)
Deletes a board from the list of dependent boards.
- Parameters:
- {JXG.Board} board
- Reference to the board which will be removed.
- Returns:
- {JXG.Board} Reference to the board
removeEventHandlers()
Remove all event handlers from the board object
{JXG.Board}
removeGrids()
Removes all grids assigned to this board. Warning: This method also removes all objects depending on one or
more of the grids.
- Returns:
- {JXG.Board} Reference to the board object.
{JXG.Board}
removeHook(id)
Removes a hook from the board.
- Parameters:
- {Number} id
- Id for the hook. The number you got when you added the hook.
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
removeObject(object)
Removes object from board and renderer.
- Parameters:
- {JXG.GeometryElement} object
- The object to remove.
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
resizeContainer(canvasWidth, canvasHeight)
Change the height and width of the board's container.
- Parameters:
- {Number} canvasWidth
- New width of the container.
- {Number} canvasHeight
- New height of the container.
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
setBoundingBox(bbox, keepaspectratio)
Set the bounding box of the board.
- Parameters:
- {Array} bbox
- New bounding box [x1,y1,x2,y2]
- {Boolean} keepaspectratio Optional, Default: false
- If set to true, the aspect ratio will be 1:1, but the resulting viewport may be larger.
- Returns:
- {JXG.Board} Reference to the board
{String}
setId(obj, type)
Composes an id for an element. If the ID is empty ('' or null) a new ID is generated, depending on the
object type. Additionally, the id of the label is set. As a side effect JXG.Board#numObjects
is updated.
- Parameters:
- {Object} obj
- Reference of an geometry object that needs an id.
- {Number} type
- Type of the object.
- Returns:
- {String} Unique id for an element.
{JXG.Board}
setZoom(fX, fY)
Sets the zoom level to fX resp fY.
- Parameters:
- {Number} fX
- {Number} fY
- Returns:
- {JXG.Board}
{JXG.Board}
showDependencies()
Lists the dependencies graph in a new HTML-window.
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
showXML()
Lists the XML code of the construction in a new HTML-window.
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
stopAllAnimation()
Cancels all running animations.
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
suspendUpdate()
Stop updates of the board.
- Returns:
- {JXG.Board} Reference to the board
touchStartListener(evt)
Touch-Events
- Parameters:
- evt
{JXG.Board}
unsuspendUpdate()
Enable updates of the board.
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
update(drag)
Runs through most elements and calls their update() method and update the conditions.
- Parameters:
- {Object} drag
- Element that caused the update.
- Returns:
- {JXG.Board} Reference to the board
<private>
updateConditions()
Computes the commands in the conditions-section of the gxt file.
It is evaluated after an update, before the unsuspendRedraw.
The function is generated in
{JXG.Board}
updateElements(drag)
Runs through all elements and calls their update() method.
- Parameters:
- {JXG.GeometryElement} drag
- Element that caused the update.
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
updateHooks(m)
Runs through all hooked functions and calls them.
- Parameters:
- m
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
updateInfobox(el)
Updates and displays a little info box to show coordinates of current selected points.
- Parameters:
- {JXG.GeometryElement} el
- A GeometryElement
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
updateRenderer(drag)
Runs through all elements and calls their update() method.
- Parameters:
- {JXG.GeometryElement} drag
- Element that caused the update.
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
updateRendererCanvas(drag)
Runs through all elements and calls their update() method.
This is a special version for the CanvasRenderer.
Here, we have to do our own layer handling.
- Parameters:
- {JXG.GeometryElement} drag
- Element that caused the update.
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
zoom100()
Resets zoom factor to 100%.
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
zoomAllPoints()
Zooms the board so every visible point is shown. Keeps aspect ratio.
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
zoomElements(elements)
Reset the bounding box and the zoom level to 100% such that a given set of elements is within the board's viewport.
- Parameters:
- {Array} elements
- A set of elements given by id, reference, or name.
- Returns:
- {JXG.Board} Reference to the board.
{JXG.Board}
zoomIn(x, y)
Zooms into the board by the factors board.options.zoom.factorX and board.options.zoom.factorY and applies the zoom.
- Parameters:
- x
- y
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
zoomOut(x, y)
Zooms out of the board by the factors board.options.zoom.factorX and board.options.zoom.factorY and applies the zoom.
- Parameters:
- x
- y
- Returns:
- {JXG.Board} Reference to the board