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, attributes)
Constructs a new Board object.
|
Field Attributes | Field Name and Description |
---|---|
Time (in msec) between two animation steps.
|
|
Show default axis.
|
|
Bounding box of the visible area in user coordinates.
|
|
Attributes for the default axes in case of the attribute
axis:true in JXG.JSXGraph#initBoard.
|
|
Supply the document object.
|
|
If set true and
hasPoint() is true for both an element and it's label,
the element (and not the label) is taken as drag element.
|
|
If set to true the bounding box might be changed such that
the ratio of width and height of the hosting HTML div is equal
to the ratio of wifth and height of the bounding box.
|
|
Maximum number of digits in automatic label generation.
|
|
Change redraw strategy in SVG rendering engine.
|
|
A number that will be added to the absolute position of the board used in mouse coordinate
calculations in JXG.Board#getCoordsTopLeftCorner.
|
|
A number that will be added to the absolute position of the board used in mouse coordinate
calculations in JXG.Board#getCoordsTopLeftCorner.
|
|
Control the possibilities for panning interaction (i.e.
|
|
Allow user interaction by registering mouse and touch events.
|
|
Control the possibilities for a selection rectangle.
|
|
Show a button which allows to clear all traces of a board.
|
|
Show copyright string in canvas.
|
|
Display of navigation arrows and zoom buttons
|
|
Show a button to force reload of a construction.
|
|
Display of zoom buttons.
|
|
If true the first element of the set JXG.board.objects having hasPoint==true is taken as drag element.
|
|
If true, when read from a file or string - the size of the div can be changed by the construction text.
|
|
Control the possibilities for zoom interaction.
|
|
Additional zoom factor multiplied to JXG.Board#zoomX and JXG.Board#zoomY.
|
Field Attributes | Field Name and Description |
---|---|
<private> |
Offset for large coords elements like images
|
Alias of JXG.Board.on.
|
|
Stores all the objects that are currently running an animation.
|
|
<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.
|
|
The html-id of the html element containing the board.
|
|
Pointer to the html element containing the board.
|
|
Cached result of getCoordsTopLeftCorner for touch/mouseMove-Events to save some DOM operations.
|
|
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.
|
|
The last position where a drag event has been fired.
|
|
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 the JXG.Board#mouseUpListener is currently registered.
|
|
A flag which stores if the board registered pointer events.
|
|
A flag which tells us if the board has a pointerUp event registered at the moment.
|
|
A flag which tells if the board the JXG.Board#touchEndListener is currently registered.
|
|
A flag which tells if the board registers touch events.
|
|
An associative array containing all highlighted elements belonging to the board.
|
|
During the update process this is set to false to prevent an endless loop.
|
|
A flag which tells us if the user is selecting
|
|
If true updates are skipped.
|
|
Keep aspect ratio if bounding box is set and the width/height ratio differs from the
width/height ratio of the canvas.
|
|
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.
|
|
An array containing all geometric objects on the board in the order of construction.
|
|
Some standard options
|
|
Coordinates of the boards origin.
|
|
Contains the last time (epoch, msec) since the last getCoordsTopLeftCorner call which was not thrown away.
|
|
If reducedUpdate is set to true then only the dragged element and few (e.g.
|
|
Alias of JXG.Board.off.
|
|
A reference to this boards renderer.
|
|
A bounding box for the selection
|
|
A flag which tells us if the board is in the selecting mode
|
|
Keeps track on touched elements, like JXG.Board#mouse does for mouse events.
|
|
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 |
---|---|
<private> |
_createSelectionPolygon(attr)
Create the internal selection polygon, which will be available as board.selectionPolygon.
|
<private> |
_isRequiredKeyPressed(evt, action)
Test if the required key combination is pressed for wheel zoom, move origin and
selection
|
<private> |
_moveSelecting(pos)
Update the selection rectangle during a move event.
|
<private> |
pointer-Events
|
<private> |
Update the Selection rectangle.
|
<private> |
_startSelecting(pos)
Start the selection of a region.
|
<private> |
_stopSelecting(evt)
Update the selection rectangle during an up event.
|
<private> |
_testForSelection(evt)
Test if a down event should start a selection.
|
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)
Please use JXG.Board.on instead.
|
|
Registers mouse move, down and wheel event handlers.
|
|
Registers the MSPointer* event handlers.
|
|
addTouchEventHandlers(appleGestures)
Register touch start and move and gesture start and change event handlers.
|
|
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.
|
|
Handler for click on down arrow in the navigation bar
|
|
Handler for click on left arrow in the navigation bar
|
|
Handler for click on right arrow in the navigation bar
|
|
Handler for click on up arrow in the navigation bar
|
|
create(elementType, parents, attributes)
Creates a new geometric element of type elementType.
|
|
Deprecated name for JXG.Board.create.
|
|
createRoulette(c1, c2, start_c1, stepsize, direction, 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.
|
|
Triggered on iOS/Safari while the user inputs a gesture (e.g.
|
|
gestureStartListener(evt)
Called by iOS/Safari as soon as the user starts a gesture.
|
|
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.
|
|
getScrCoordsOfMouse(x, y)
Returns the input parameters in an array.
|
|
getUsrCoordsOfMouse(evt)
This method calculates the user coords of the current mouse coordinates.
|
|
hasPoint(x, y)
Checks if the given point is inside the boundingbox.
|
|
highlightCustomInfobox(text, el)
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, evt, type)
Collects all elements below the current mouse pointer and fulfilling the following constraints:
|
|
initMoveOrigin(x, y)
Initiate moving the origin.
|
|
migratePoint(src, dest, copyName)
Migrate the dependency properties of the point src
to the point dest and delete the point src.
|
|
mouseDownListener(evt)
This method is called by the browser when the mouse button is clicked.
|
|
mouseMoveListener(evt)
This method is called by the browser when the mouse is moved.
|
|
mouseUpListener(evt)
This method is called by the browser when the mouse button is released.
|
|
mouseWheelListener(evt)
Handler for mouse wheel events.
|
|
moveObject(x, y, o, evt, type)
Moves an object.
|
|
moveOrigin(x, y, diff)
Moves the origin and initializes an update of all elements.
|
|
<private> |
Stop moving the origin with one finger
|
pointerDownListener(evt, object)
This method is called by the browser when a pointing device is pressed on the screen.
|
|
pointerMoveListener(evt)
Called periodically by the browser while the user moves a pointing device across the screen.
|
|
pointerUpListener(evt)
Triggered as soon as the user stops touching the device with at least one finger.
|
|
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)
Please use JXG.Board.off instead.
|
|
De-register mouse event handlers.
|
|
removeObject(object)
Removes object from board and renderer.
|
|
Remove MSPointer* Event handlers.
|
|
Remove all registered touch event handlers.
|
|
resizeContainer(canvasWidth, canvasHeight, dontset, dontSetBoundingBox)
Change the height and width of the board's container.
|
|
<private> |
saveStartPos(obj, targets)
Helper function which returns a reasonable starting point for the object being dragged.
|
select(str)
Select a single or multiple elements at once.
|
|
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.
|
|
showInfobox(val)
Set infobox visible / invisible.
|
|
showXML()
Lists the XML code of the construction in a new HTML-window.
|
|
Start selection mode.
|
|
Cancels all running animations.
|
|
Finalize the selection: disable selection mode and return the coordinates
of the selection rectangle.
|
|
Stop updates of the board.
|
|
touchEndListener(evt)
Triggered as soon as the user stops touching the device with at least one finger.
|
|
touchMoveListener(evt)
Called periodically by the browser while the user moves his fingers across the device.
|
|
<private> |
touchOriginMove(evt)
Move the origin with one finger
|
<private> |
touchOriginMoveStart(evt)
Start moving the origin with one finger.
|
touchStartListener(evt)
This method is called by the browser when a finger touches the surface of the touch-device.
|
|
twoFingerMove(p1, p2, o, evt)
Moves elements in multitouch mode.
|
|
twoFingerTouchObject(np1c, np2c, o, drag)
Moves a line or polygon with two fingers
|
|
Enable updates of the board.
|
|
update(drag)
Runs through most elements and calls their update() method and update the conditions.
|
|
updateConditions()
|
|
Update the coords object of all elements which possess this
property.
|
|
Update CSS transformations of sclaing type.
|
|
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.
|
|
Runs through all elements and calls their update() method.
|
|
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.attr.zoom.factorX and board.attr.zoom.factorY and applies the zoom.
|
|
zoomOut(x, y)
Zooms out of the board by the factors board.attr.zoom.factorX and board.attr.zoom.factorY and applies the zoom.
|
Event Attributes | Event Name and Description |
---|---|
The bounding box of the board has changed.
|
|
down(e)
Whenever the user starts to touch or click the board.
|
|
hit(e, el, target)
Whenever an element is highlighted this event is fired.
|
|
mousedown(e)
Whenever the user starts to click on the board.
|
|
mousehit(e, el, target)
Whenever an element is highlighted this event is fired.
|
|
mousemove(e, mode)
This event is fired whenever the user is moving the mouse over the board.
|
|
A move event while selecting of a region is active
from a device sending mouse events.
|
|
Select a region is started during a down event
from a device sending mouse events or by calling
JXG.Board.startSelectionMode.
|
|
Selection of a region is stopped during an up event
from a device sending mouse events.
|
|
mouseup(e)
Whenever the user releases the mousebutton over the board.
|
|
move(e, mode)
This event is fired whenever the user is moving the finger or mouse pointer over the board.
|
|
A move event while selecting of a region is active.
|
|
pointerdown(e)
Whenever the user starts to click on the board with a
device sending pointer events.
|
|
pointermove(e, mode)
This event is fired whenever the user is moving the mouse over the board with a
device sending pointer events.
|
|
Select a region is started during a down event
from a device sending mouse events.
|
|
Select a region is started during a down event
from a device sending pointer events or by calling
JXG.Board.startSelectionMode.
|
|
Selection of a region is stopped during an up event
from a device sending pointer events.
|
|
pointerup(e)
Whenever the user releases the mousebutton over the board with a
device sending pointer events.
|
|
Select a region is started during a down event or by calling
JXG.Board.startSelectionMode
|
|
Selection of a region is stopped during an up event.
|
|
touchend(e)
Whenever the user stops touching the board.
|
|
touchmove(e, mode)
This event is fired whenever the user is moving the finger over the board.
|
|
Select a region is started during a down event
from a device sending touch events.
|
|
touchstart(e)
Whenever the user starts to touch the board.
|
|
Select a region is started during a down event
from a device sending touch events or by calling
JXG.Board.startSelectionMode.
|
|
Selection of a region is stopped during an up event
from a device sending touch events.
|
|
up(e)
Whenever the user stops to touch or click the board.
|
|
update()
This board is updated.
|
Class Detail
JXG.Board(container, renderer, id, origin, zoomX, zoomY, unitX, unitY, canvasWidth, canvasHeight, attributes)
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
- {Object} attributes
- The attributes object given to JXG.JSXGraph.initBoard
Attribute Detail
{Number}
animationDelay
Time (in msec) between two animation steps. Used in
JXG.CoordsElement#moveAlong, JXG.CoordsElement#moveTo and
JXG.CoordsElement#visit.
Defined in: options.js.
Defined in: options.js.
- Default Value:
- 35
{Boolean}
axis
Show default axis.
If shown, the horizontal axis can be accessed via JXG.Board.defaultAxes.x, the
vertical axis can be accessed via JXG.Board.defaultAxes.y.
Both axes have a sub-element "defaultTicks".
Value can be Boolean or an object containing axis attributes.
Defined in: options.js.
Defined in: options.js.
- Default Value:
- false
{Array}
boundingbox
Bounding box of the visible area in user coordinates.
It is an array consisting of four values:
[x1, y1, x2, y2]
The canvas will be spanned from the upper left corner (1, y1)
to the lower right corner (x2, y2).
Defined in: options.js.
Defined in: options.js.
- Default Value:
- [-5, 5, 5, -5]
defaultAxes
Attributes for the default axes in case of the attribute
axis:true in JXG.JSXGraph#initBoard.
Defined in: options.js.
Defined in: options.js.
{DOM object}
document
Supply the document object. Defaults to window.document
Defined in: options.js.
Defined in: options.js.
- Default Value:
- false (meaning window.document)
{Booelan}
ignoreLabels
If set true and
hasPoint() is true for both an element and it's label,
the element (and not the label) is taken as drag element.
If set false and hasPoint() is true for both an element and it's label,
the label is taken (if it is on a higher layer than the element)
Defined in: options.js.
Defined in: options.js.
- Default Value:
- true
{Boolean}
keepAspectRatio
If set to true the bounding box might be changed such that
the ratio of width and height of the hosting HTML div is equal
to the ratio of wifth and height of the bounding box.
This is necessary if circles should look like circles and not
like ellipses. It is recommended to set keepAspectRatio = true
for geometric applets. For function plotting keepAspectRatio = false
might be the better choice.
Defined in: options.js.
Defined in: options.js.
- Default Value:
- false
{Number}
maxNameLength
Maximum number of digits in automatic label generation.
For example, if set to 1 automatic point labels end at "Z".
If set to 2, point labels end at "ZZ".
Defined in: options.js.
Defined in: options.js.
- Default Value:
- 1
{String}
minimizeReflow
Change redraw strategy in SVG rendering engine.
If set to 'svg', before every redrawing of the JSXGraph construction
the SVG sub-tree of the DOM tree is taken out of the DOM.
If set to 'all', before every redrawing of the JSXGraph construction the
complete DOM tree is taken out of the DOM.
If set to 'none' the redrawing is done in-place.
Using 'svg' or 'all' speeds up the update process considerably. The risk
is that if there is an exception, only a white div or window is left.
Defined in: options.js.
Defined in: options.js.
- Default Value:
- 'svg'
{Number}
offsetX
A number that will be added to the absolute position of the board used in mouse coordinate
calculations in JXG.Board#getCoordsTopLeftCorner.
Defined in: options.js.
Defined in: options.js.
- See:
- JXG.Board#offsetY
- Default Value:
- 0
{Number}
offsetY
A number that will be added to the absolute position of the board used in mouse coordinate
calculations in JXG.Board#getCoordsTopLeftCorner.
Defined in: options.js.
Defined in: options.js.
- See:
- JXG.Board#offsetX
- Default Value:
- 0
{Object}
pan
Control the possibilities for panning interaction (i.e. moving the origin).
Possible sub-attributes with default values are:
Defined in: options.js.
pan: { enabled: true // Allow panning needTwoFingers: true, // panning is done with two fingers on touch devices needShift: true, // mouse panning needs pressing of the shift key }
Defined in: options.js.
{Boolean}
registerEvents
Allow user interaction by registering mouse and touch events.
Defined in: options.js.
Defined in: options.js.
- Default Value:
- true
{Object}
selection
Control the possibilities for a selection rectangle.
Starting a selection event triggers the "startselecting" event.
When the mouse pointer is released, the "stopselecting" event is fired.
The "stopselecting" event must be supplied by the user.
Defined in: options.js.
Possible sub-attributes with default values are:
selection: { enabled: false, name: 'selectionPolygon', needShift: false, // mouse selection needs pressing of the shift key needCtrl: true, // mouse selection needs pressing of the shift key withLines: false, // Selection polygon has border lines vertices: { visible: false }, fillColor: '#ffff00', visible: false // Initial visibility. Should be set to false always }
Defined in: options.js.
board.on('stopselecting', function(){ var box = board.stopSelectionMode(), // bbox has the coordinates of the selectionr rectangle. // Attention: box[i].usrCoords have the form [1, x, y], i.e. // are homogeneous coordinates. bbox = box[0].usrCoords.slice(1).concat(box[1].usrCoords.slice(1)); // Set a new bounding box board.setBoundingBox(bbox, false); });
- See:
- JXG.Board#startselecting
- JXG.Board#stopselecting
- JXG.Board#mousestartselecting
- JXG.Board#pointerstartselecting
- JXG.Board#touchstartselecting
- JXG.Board#mousestopselecting
- JXG.Board#pointerstopselecting
- JXG.Board#touchstopselecting
{Boolean}
showClearTraces
Show a button which allows to clear all traces of a board.
Defined in: options.js.
Defined in: options.js.
- Default Value:
- false
{Boolean}
showCopyright
Show copyright string in canvas.
Defined in: options.js.
Defined in: options.js.
- Default Value:
- true
{Boolean}
showNavigation
Display of navigation arrows and zoom buttons
Defined in: options.js.
Defined in: options.js.
- Default Value:
- true
{Boolean}
showReload
Show a button to force reload of a construction.
Works only with the JessieCode tag
Defined in: options.js.
Defined in: options.js.
- Default Value:
- false
{Boolean}
showZoom
Display of zoom buttons. To show zoom buttons, additionally
showNavigation has to be set to true.
Defined in: options.js.
Defined in: options.js.
- Default Value:
- true
{Boolean}
takeFirst
If true the first element of the set JXG.board.objects having hasPoint==true is taken as drag element.
Defined in: options.js.
Defined in: options.js.
- Default Value:
- false
{Boolean}
takeSizeFromFile
If true, when read from a file or string - the size of the div can be changed by the construction text.
Defined in: options.js.
Defined in: options.js.
- Default Value:
- false
{Object}
zoom
Control the possibilities for zoom interaction.
Possible sub-attributes with default values are:
Defined in: options.js.
zoom: { factorX: 1.25, // horizontal zoom factor (multiplied to JXG.Board#zoomX) factorY: 1.25, // vertical zoom factor (multiplied to JXG.Board#zoomY) wheel: true, // allow zooming by mouse wheel or // by pinch-to-toom gesture on touch devices needShift: true, // mouse wheel zooming needs pressing of the shift key min: 0.001 // minimal values of JXG.Board#zoomX and JXG.Board#zoomY, limits zoomOut max: 1000.0 // maximal values of JXG.Board#zoomX and JXG.Board#zoomY, limits zoomIn pinchHorizontal: true // Allow pinch-to-zoom to zoom only horizontal axis pinchVertical: true // Allow pinch-to-zoom to zoom only vertical axis pinchSensitivity: 7 // Sensitivity (in degrees) for recognizing horizontal or vertical pinch-to-zoom gestures. }Deprecated: zoom.eps which is superseded by zoom.min
Defined in: options.js.
{Number}
zoomFactor
- Default Value:
- 1.0
Field Detail
<private>
_drag_offset
Offset for large coords elements like images
- Default Value:
- [0, 0]
addEvent
Alias of JXG.Board.on.
{Object}
animationObjects
Stores all the objects that are currently running an animation.
<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.
{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 result of getCoordsTopLeftCorner for touch/mouseMove-Events to save some DOM operations.
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
{Array}
drag_position
The last position where a drag event has been fired.
- See:
- JXG.Board#moveObject
{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:
- false
{Boolean}
hasMouseUp
A flag which tells if the board the JXG.Board#mouseUpListener is currently registered.
- Default Value:
- false
hasPointerHandlers
A flag which stores if the board registered pointer events.
- Default Value:
- false
hasPointerUp
A flag which tells us if the board has a pointerUp event registered at the moment.
- Default Value:
- false
{Boolean}
hasTouchEnd
A flag which tells if the board the JXG.Board#touchEndListener is currently registered.
- Default Value:
- false
{Boolean}
hasTouchHandlers
A flag which tells if the board registers touch events.
- Default Value:
- false
{Object}
highlightedObjects
An associative array containing all highlighted elements belonging to the board.
{Boolean}
inUpdate
During the update process this is set to false to prevent an endless loop.
- Default Value:
- false
isSelecting
A flag which tells us if the user is selecting
- Default Value:
- false
{Boolean}
isSuspendedRedraw
If true updates are skipped.
keepaspectratio
Keep aspect ratio if bounding box is set and the width/height ratio differs from the
width/height ratio of the canvas.
{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_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.
objectsList
An array containing all geometric objects on the board in the order of construction.
{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.
{Number}
positionAccessLast
Contains the last time (epoch, msec) since the last getCoordsTopLeftCorner call which was not thrown away.
{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
removeEvent
Alias of JXG.Board.off.
{JXG.AbstractRenderer}
renderer
A reference to this boards renderer.
selectingBox
A bounding box for the selection
- Default Value:
- [ [0,0], [0,0] ]
selectingMode
A flag which tells us if the board is in the selecting mode
- Default Value:
- false
{Array}
touches
Keeps track on touched elements, like JXG.Board#mouse does for mouse events.
- See:
{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
<private>
{Object}
_createSelectionPolygon(attr)
Create the internal selection polygon, which will be available as board.selectionPolygon.
- Parameters:
- {Object} attr
- board attributes, e.g. the subobject board.attr.
- Returns:
- {Object} pointer to the board to enable chaining.
<private>
{Boolean}
_isRequiredKeyPressed(evt, action)
Test if the required key combination is pressed for wheel zoom, move origin and
selection
- Parameters:
- {Object} evt
- Mouse or pen event
- {String} action
- String containing the action: 'zoom', 'pan', 'selection'. Corresponds to the attribute subobject.
- Returns:
- {Boolean} true or false.
<private>
_moveSelecting(pos)
Update the selection rectangle during a move event.
- Parameters:
- {Array} pos
- Screen coordiates of the move event
<private>
_pointerAddBoardTouches(evt)
pointer-Events
- Parameters:
- evt
<private>
_setSelectionPolygonFromBox()
Update the Selection rectangle.
<private>
_startSelecting(pos)
Start the selection of a region.
- Parameters:
- {Array} pos
- Screen coordiates of the upper left corner of the selection rectangle.
<private>
_stopSelecting(evt)
Update the selection rectangle during an up event. Stop selection.
- Parameters:
- {Object} evt
- Event object
<private>
_testForSelection(evt)
Test if a down event should start a selection. Test if the
required keys are pressed. If yes, JXG.Board.startSelectionMode is called.
- Parameters:
- {Object} evt
- Event object
{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 occurred.
- 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)
Please use JXG.Board.on instead.
- Parameters:
- {Function} hook
- A function to be called by the board after an update occurred.
- {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.
addMouseEventHandlers()
Registers mouse move, down and wheel event handlers.
addPointerEventHandlers()
Registers the MSPointer* event handlers.
addTouchEventHandlers(appleGestures)
Register touch start and move and gesture start and change event handlers.
- Parameters:
- {Boolean} appleGestures
- If set to false the gesturestart and gesturechange event handlers will not be registered.
{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
{JXG.Board}
clickDownArrow()
Handler for click on down arrow in the navigation bar
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
clickLeftArrow()
Handler for click on left arrow in the navigation bar
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
clickRightArrow()
Handler for click on right arrow in the navigation bar
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
clickUpArrow()
Handler for click on up arrow in the navigation bar
- Returns:
- {JXG.Board} Reference to the board
{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 Optional
- 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.
createElement()
Deprecated name for JXG.Board.create.
createRoulette(c1, c2, start_c1, stepsize, direction, 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} direction
- {Number} time
- Delay time for setInterval()
- {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.
{Boolean}
gestureChangeListener(evt)
Triggered on iOS/Safari while the user inputs a gesture (e.g. pinch) and is used to zoom into the board.
Works on iOS/Safari and Android.
- Parameters:
- {Event} evt
- Browser event object
- Returns:
- {Boolean}
{Boolean}
gestureStartListener(evt)
Called by iOS/Safari as soon as the user starts a gesture. Works natively on iOS/Safari,
on Android we emulate it.
- Parameters:
- {Event} evt
- Returns:
- {Boolean}
{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
{Array}
getScrCoordsOfMouse(x, y)
Returns the input parameters in an array. This method looks pointless and it really is, but it had a purpose
once.
- Parameters:
- {Number} x
- X coordinate in screen coordinates
- {Number} y
- Y coordinate in screen coordinates
- Returns:
- {Array} Coordinates of the mouse in screen coordinates.
{Array}
getUsrCoordsOfMouse(evt)
This method calculates the user coords of the current mouse coordinates.
- Parameters:
- {Event} evt
- Event object containing the mouse coordinates.
- Returns:
- {Array} Coordinates of the mouse in screen coordinates.
{Boolean}
hasPoint(x, y)
Checks if the given point is inside the boundingbox.
- Parameters:
- {Number|JXG.Coords} x
- User coordinate or JXG.Coords object.
- {Number} y Optional
- User coordinate. May be omitted in case x is a JXG.Coords object.
- Returns:
- {Boolean}
{JXG.Board}
highlightCustomInfobox(text, el)
Changes the text of the info box to what is provided via text.
- Parameters:
- {String} text
- {JXG.GeometryElement} el Optional
- 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.GeometryElement} el Optional
- 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, evt, type)
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
- {Object} evt
- An event object
- {String} type
- What type of event? 'touch' or 'mouse'.
- 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
{JXG.Board}
migratePoint(src, dest, copyName)
Migrate the dependency properties of the point src
to the point dest and delete the point src.
For example, a circle around the point src
receives the new center dest. The old center src
will be deleted.
- Parameters:
- {JXG.Point} src
- Original point which will be deleted
- {JXG.Point} dest
- New point with the dependencies of src.
- {Boolean} copyName
- Flag which decides if the name of the src element is copied to the dest element.
- Returns:
- {JXG.Board} Reference to the board
{Boolean}
mouseDownListener(evt)
This method is called by the browser when the mouse button is clicked.
- Parameters:
- {Event} evt
- The browsers event object.
- Returns:
- {Boolean} True if no element is found under the current mouse pointer, false otherwise.
mouseMoveListener(evt)
This method is called by the browser when the mouse is moved.
- Parameters:
- {Event} evt
- The browsers event object.
mouseUpListener(evt)
This method is called by the browser when the mouse button is released.
- Parameters:
- {Event} evt
{Boolean}
mouseWheelListener(evt)
Handler for mouse wheel events. Used to zoom in and out of the board.
- Parameters:
- {Event} evt
- Returns:
- {Boolean}
moveObject(x, y, o, evt, type)
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}.
- {Object} evt
- The event object.
- {String} type
- Mouse or touch event?
{JXG.Board}
moveOrigin(x, y, diff)
Moves the origin and initializes an update of all elements.
- Parameters:
- {Number} x
- {Number} y
- {Boolean} diff Optional, Default: false
- Returns:
- {JXG.Board} Reference to this board.
<private>
{null}
originMoveEnd()
Stop moving the origin with one finger
- Returns:
- {null} null
{Boolean}
pointerDownListener(evt, object)
This method is called by the browser when a pointing device is pressed on the screen.
- Parameters:
- {Event} evt
- The browsers event object.
- {Object} object
- If the object to be dragged is already known, it can be submitted via this parameter
- Returns:
- {Boolean} ...
{Boolean}
pointerMoveListener(evt)
Called periodically by the browser while the user moves a pointing device across the screen.
- Parameters:
- {Event} evt
- Returns:
- {Boolean}
{Boolean}
pointerUpListener(evt)
Triggered as soon as the user stops touching the device with at least one finger.
- Parameters:
- {Event} evt
- Returns:
- {Boolean}
{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)
Please use JXG.Board.off instead.
- Parameters:
- {Number|function} id
- The number you got when you added the hook or a reference to the event handler.
- Returns:
- {JXG.Board} Reference to the board
removeMouseEventHandlers()
De-register mouse event handlers.
{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
removePointerEventHandlers()
Remove MSPointer* Event handlers.
removeTouchEventHandlers()
Remove all registered touch event handlers.
{JXG.Board}
resizeContainer(canvasWidth, canvasHeight, dontset, dontSetBoundingBox)
Change the height and width of the board's container.
After doing so, JXG.JSXGraph.setBoundingBox is called using
the actual size of the bounding box and the actual value of keepaspectratio.
If setBoundingbox() should not be called automatically,
call resizeContainer with dontSetBoundingBox == true.
- Parameters:
- {Number} canvasWidth
- New width of the container.
- {Number} canvasHeight
- New height of the container.
- {Boolean} dontset Optional, Default: false
- If true do not set the height of the DOM element.
- {Boolean} dontSetBoundingBox Optional, Default: false
- If true do not call setBoundingBox().
- Returns:
- {JXG.Board} Reference to the board
<private>
saveStartPos(obj, targets)
Helper function which returns a reasonable starting point for the object being dragged.
Formerly known as initXYstart().
- Parameters:
- {JXG.GeometryElement} obj
- The object to be dragged
- {Array} targets
- Array of targets. It is changed by this function.
{JXG.GeometryElement|JXG.Composition}
select(str)
Select a single or multiple elements at once.
- Parameters:
- {String|Object|function} str
- The name, id or a reference to a JSXGraph element on this board. An object will be used as a filter to return multiple elements at once filtered by the properties of the object.
- Returns:
- {JXG.GeometryElement|JXG.Composition}
- Examples:
// select the element with name A board.select('A'); // select all elements with strokecolor set to 'red' (but not '#ff0000') board.select({ strokeColor: 'red' }); // select all points on or below the x axis and make them black. board.select({ elementClass: JXG.OBJECT_CLASS_POINT, Y: function (v) { return v <= 0; } }).setAttribute({color: 'black'}); // select all elements board.select(function (el) { return true; });
{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. 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} Reference to the board.
{JXG.Board}
showDependencies()
Lists the dependencies graph in a new HTML-window.
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
showInfobox(val)
Set infobox visible / invisible.
It uses its property hiddenByParent to memorize its status.
In this way, many DOM access can be avoided.
- Parameters:
- {Boolean} val
- true for visible, false for invisible
- 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
startSelectionMode()
Start selection mode. This function can either be triggered from outside or by
a down event together with correct key pressing. The default keys are
shift+ctrl. But this can be changed in the options.
Starting from out side can be realized for example with a button like this:
<button onclick="board.startSelectionMode()">Start</button>
- Examples:
// // Set a new bounding box from the selection rectangle // var board = JXG.JSXGraph.initBoard('jxgbox', { boundingBox:[-3,2,3,-2], keepAspectRatio: false, axis:true, selection: { enabled: true, needShift: false, needCtrl: true, withLines: false, vertices: { visible: false }, fillColor: '#ffff00', } }); var f = function f(x) { return Math.cos(x); }, curve = board.create('functiongraph', [f]); board.on('stopselecting', function(){ var box = board.stopSelectionMode(), // bbox has the coordinates of the selection rectangle. // Attention: box[i].usrCoords have the form [1, x, y], i.e. // are homogeneous coordinates. bbox = box[0].usrCoords.slice(1).concat(box[1].usrCoords.slice(1)); // Set a new bounding box board.setBoundingBox(bbox, false); });
{JXG.Board}
stopAllAnimation()
Cancels all running animations.
- Returns:
- {JXG.Board} Reference to the board
{Array}
stopSelectionMode()
Finalize the selection: disable selection mode and return the coordinates
of the selection rectangle.
- Returns:
- {Array} Coordinates of the selection rectangle. The array contains two JXG.Coords objects. One the upper left corner and the second for the lower right corner.
{JXG.Board}
suspendUpdate()
Stop updates of the board.
- Returns:
- {JXG.Board} Reference to the board
{Boolean}
touchEndListener(evt)
Triggered as soon as the user stops touching the device with at least one finger.
- Parameters:
- {Event} evt
- Returns:
- {Boolean}
{Boolean}
touchMoveListener(evt)
Called periodically by the browser while the user moves his fingers across the device.
- Parameters:
- {Event} evt
- Returns:
- {Boolean}
<private>
{Boolean}
touchOriginMove(evt)
Move the origin with one finger
- Parameters:
- {Object} evt
- Event from touchMoveListener
- Returns:
- {Boolean} returns if the origin is moved.
<private>
{Boolean}
touchOriginMoveStart(evt)
Start moving the origin with one finger.
- Parameters:
- {Object} evt
- Event from touchStartListener
- Returns:
- {Boolean} returns if the origin is moved.
{Boolean}
touchStartListener(evt)
This method is called by the browser when a finger touches the surface of the touch-device.
- Parameters:
- {Event} evt
- The browsers event object.
- Returns:
- {Boolean} ...
twoFingerMove(p1, p2, o, evt)
Moves elements 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}.
- {Object} evt
- The event object that lead to this movement.
twoFingerTouchObject(np1c, np2c, o, drag)
Moves a line or polygon with two fingers
- Parameters:
- {JXG.Coords} np1c
- x,y coordinates of first touch
- {JXG.Coords} np2c
- x,y coordinates of second touch
- {object} o
- The touch object that is dragged: {JXG.Board#touches}.
- {object} drag
- The object that is dragged:
{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:
- {JXG.GeometryElement} drag Optional
- Element that caused the update.
- Returns:
- {JXG.Board} Reference to the board
updateConditions()
{JXG.Board}
updateCoords()
Update the coords object of all elements which possess this
property. This is necessary after changing the viewport.
- Returns:
- {JXG.Board} Reference to this board.
updateCSSTransforms()
Update CSS transformations of sclaing type. It is used to correct the mouse position
in JXG.Board.getMousePosition.
The inverse transformation matrix is updated on each mouseDown and touchStart event.
It is up to the user to call this method after an update of the CSS transformation
in the DOM.
{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()
Runs through all elements and calls their update() method.
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
updateRendererCanvas()
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.
- 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.attr.zoom.factorX and board.attr.zoom.factorY and applies the zoom.
The zoom operation is centered at x, y.
- Parameters:
- {Number} x Optional
- {Number} y Optional
- Returns:
- {JXG.Board} Reference to the board
{JXG.Board}
zoomOut(x, y)
Zooms out of the board by the factors board.attr.zoom.factorX and board.attr.zoom.factorY and applies the zoom.
The zoom operation is centered at x, y.
- Parameters:
- {Number} x Optional
- {Number} y Optional
- Returns:
- {JXG.Board} Reference to the board
Event Detail
boundingbox()
The bounding box of the board has changed.
down(e)
Whenever the user starts to touch or click the board.
- Parameters:
- {Event} e
- The browser's event object.
hit(e, el, target)
Whenever an element is highlighted this event is fired.
- Parameters:
- {Event} e
- The browser's event object.
- {JXG.GeometryElement} el
- The hit element.
- target
mousedown(e)
Whenever the user starts to click on the board.
- Parameters:
- {Event} e
- The browser's event object.
mousehit(e, el, target)
Whenever an element is highlighted this event is fired.
- Parameters:
- {Event} e
- The browser's event object.
- {JXG.GeometryElement} el
- The hit element.
- target
mousemove(e, mode)
This event is fired whenever the user is moving the mouse over the board.
- Parameters:
- {Event} e
- The browser's event object.
- {Number} mode
- The mode the board currently is in
- See:
mousemoveselecting()
A move event while selecting of a region is active
from a device sending mouse events.
mousestartselecting()
Select a region is started during a down event
from a device sending mouse events or by calling
JXG.Board.startSelectionMode.
mousestopselecting()
Selection of a region is stopped during an up event
from a device sending mouse events.
mouseup(e)
Whenever the user releases the mousebutton over the board.
- Parameters:
- {Event} e
- The browser's event object.
move(e, mode)
This event is fired whenever the user is moving the finger or mouse pointer over the board.
- Parameters:
- {Event} e
- The browser's event object.
- {Number} mode
- The mode the board currently is in
- See:
moveselecting()
A move event while selecting of a region is active.
pointerdown(e)
Whenever the user starts to click on the board with a
device sending pointer events.
- Parameters:
- {Event} e
- The browser's event object.
pointermove(e, mode)
This event is fired whenever the user is moving the mouse over the board with a
device sending pointer events.
- Parameters:
- {Event} e
- The browser's event object.
- {Number} mode
- The mode the board currently is in
- See:
pointermoveselecting()
Select a region is started during a down event
from a device sending mouse events.
pointerstartselecting()
Select a region is started during a down event
from a device sending pointer events or by calling
JXG.Board.startSelectionMode.
pointerstopselecting()
Selection of a region is stopped during an up event
from a device sending pointer events.
pointerup(e)
Whenever the user releases the mousebutton over the board with a
device sending pointer events.
- Parameters:
- {Event} e
- The browser's event object.
startselecting()
Select a region is started during a down event or by calling
JXG.Board.startSelectionMode
stopselecting()
Selection of a region is stopped during an up event.
touchend(e)
Whenever the user stops touching the board.
- Parameters:
- {Event} e
- The browser's event object.
touchmove(e, mode)
This event is fired whenever the user is moving the finger over the board.
- Parameters:
- {Event} e
- The browser's event object.
- {Number} mode
- The mode the board currently is in
- See:
touchmoveselecting()
Select a region is started during a down event
from a device sending touch events.
touchstart(e)
Whenever the user starts to touch the board.
- Parameters:
- {Event} e
- The browser's event object.
touchstartselecting()
Select a region is started during a down event
from a device sending touch events or by calling
JXG.Board.startSelectionMode.
touchstopselecting()
Selection of a region is stopped during an up event
from a device sending touch events.
up(e)
Whenever the user stops to touch or click the board.
- Parameters:
- {Event} e
- The browser's event object.
update()
This board is updated.