Class JXG.Text
↳ JXG.Text
Text: On creation the GEONExT syntax
of
Defined in: text.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
JXG.Text(board, content, coords, attributes)
Construct and handle texts.
|
| Method Attributes | Method Name and Description |
|---|---|
| <private> |
_setText(text)
Defines new content.
|
| <private> |
_setUpdateText(text)
This sets the updateText function of this element that depending on the type of text content passed.
|
| <private> |
Used to save updateSize() calls.
|
| <private> |
Converts the GEONExT tags
|
|
A very crude estimation of the dimensions of the textbox in case nothing else is available.
|
|
| <private> |
generateTerm(contentStr)
Converts the GEONExT syntax of the
|
|
getSize()
Return the width of the text element.
|
|
| <private> |
hasPoint(x, y)
|
| <private> |
notifyParents(content)
Finds dependencies in a given term and notifies the parents by adding the
dependent object to the found objects child elements.
|
|
replaceSub(te)
Replace _{} by <sub>
|
|
|
replaceSup(te)
Replace ^{} by <sup>
|
|
|
setCoords(x, y)
Move the text to new coordinates.
|
|
|
setPositionDirectly(method, coords, oldcoords)
Sets x and y coordinate of the text.
|
|
|
setText(text)
Defines new content.
|
|
|
setTextJessieCode(text)
Defines new content but converts < and > to HTML entities before updating the DOM.
|
|
|
Alias for JXG.Element#handleSnapToGrid
|
|
|
update()
Evaluates the text.
|
|
|
Updates the coordinates of the text element.
|
|
| <private> |
The update function of the renderert
is called.
|
|
Recompute the width and the height of the text box.
|
|
|
updateText()
|
|
|
utf8_decode(string)
Decode unicode entities into characters.
|
|
|
X()
|
|
|
Y()
|
Class Detail
JXG.Text(board, content, coords, attributes)
Construct and handle texts.
- Parameters:
- board
- content
- coords
- attributes
- Returns:
- A new geometry element Text
Method Detail
<private>
{JXG.Text}
_setText(text)
Defines new content. This is used by JXG.Text#setTextJessieCode and JXG.Text#setText. This is required because
JessieCode needs to filter all Texts inserted into the DOM and thus has to replace setText by setTextJessieCode.
- Parameters:
- {String|Function|Number} text
- Returns:
- {JXG.Text}
<private>
_setUpdateText(text)
This sets the updateText function of this element that depending on the type of text content passed.
Used by JXG.Text#_setText and JXG.Text constructor.
- Parameters:
- {String|Function|Number} text
<private>
checkForSizeUpdate()
Used to save updateSize() calls.
Called in JXG.Text.update
That means this.update() has been called.
More tests are in JXG.Renderer.updateTextStyle. The latter tests
are one update off. But this should pose not too many problems, since
it affects fontSize and cssClass changes.
<private>
convertGeonext2CSS(s)
Converts the GEONExT tags and to
HTML span tags with proper CSS formating.
- Parameters:
- s
- See:
- JXG.Text.generateTerm @see JXG.Text._setText
{Array}
crudeSizeEstimate()
A very crude estimation of the dimensions of the textbox in case nothing else is available.
- Returns:
- {Array}
<private>
generateTerm(contentStr)
Converts the GEONExT syntax of the terms into JavaScript.
Also, all Objects whose name appears in the term are searched and
the text is added as child to these objects.
- Parameters:
- contentStr
- See:
- JXG.GeonextParser.geonext2JS.
{Array}
getSize()
Return the width of the text element.
- Returns:
- {Array} [width, height] in pixel
<private>
{Boolean}
hasPoint(x, y)
- Parameters:
- {Number} x
- {Number} y
- Returns:
- {Boolean}
<private>
notifyParents(content)
Finds dependencies in a given term and notifies the parents by adding the
dependent object to the found objects child elements.
- Parameters:
- {String} content
- String containing dependencies for the given object.
{String}
replaceSub(te)
Replace _{} by <sub>
- Parameters:
- {String} te
- String containing _{}.
- Returns:
- {String} Given string with _{} replaced by <sub>.
{String}
replaceSup(te)
Replace ^{} by <sup>
- Parameters:
- {String} te
- String containing ^{}.
- Returns:
- {String} Given string with ^{} replaced by <sup>.
{object}
setCoords(x, y)
Move the text to new coordinates.
- Parameters:
- {number} x
- {number} y
- Returns:
- {object} reference to the text object.
{JXG.Text}
setPositionDirectly(method, coords, oldcoords)
Sets x and y coordinate of the text.
- Parameters:
- {Number} method
- The type of coordinates used here. Possible values are JXG.COORDS_BY_USER and JXG.COORDS_BY_SCREEN.
- {Array} coords
- coordinates in screen/user units
- {Array} oldcoords
- previous coordinates in screen/user units
- Returns:
- {JXG.Text} this element
{JXG.Text}
setText(text)
Defines new content.
- Parameters:
- {String|function} text
- Returns:
- {JXG.Text} Reference to the text object.
setTextJessieCode(text)
Defines new content but converts < and > to HTML entities before updating the DOM.
- Parameters:
- {String|function} text
{JXG.Text}
snapToGrid()
Alias for JXG.Element#handleSnapToGrid
- Returns:
- {JXG.Text} Reference to this element
update()
Evaluates the text.
Then, the update function of the renderer
is called.
updateCoords()
Updates the coordinates of the text element.
<private>
updateRenderer()
The update function of the renderert
is called.
updateSize()
Recompute the width and the height of the text box.
Update array this.size with pixel values.
The result may differ from browser to browser
by some pixels.
In canvas an old IEs we use a very crude estimation of the dimensions of
the textbox.
In JSXGraph this.size is necessary for applying rotations in IE and
for aligning text.
updateText()
{String}
utf8_decode(string)
Decode unicode entities into characters.
- Parameters:
- {String} string
- Returns:
- {String}
X()
Y()
JSXGraph Reference
Elements