Class Index | File Index

Classes


Class gui.Caret


Defined in: Caret.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
gui.Caret(cursor, avatarInitiallyVisible, blinkOnRangeSelect)
Class that represents a caret in a document.
Method Summary
Method Attributes Method Name and Description
<inner>  
blink(reset)
 
destroy(callback)
 
Scrolls the view on the canvas in such a way that the caret is completely visible, with a small margin around.
<inner>  
getCaretClientRectWithMargin(caretElement, margin)
Calculates the bounding client rect of the caret element, expanded with a specific margin
 
 
<inner>  
Get the client rectangle for the nearest selection point to the caret.
<inner>  
Tweak the height and top offset of the caret to display closely inline in the text block.
 
hide()
 
<inner>  
length(node)
Return the maximum available offset for the supplied node.
<inner>  
 
 
 
setColor(newColor)
 
 
show()
 
 
<inner>  
verticalOverlap(cursorNode, rangeRect)
Calculate the number of pixels of vertical overlap.
Class Detail
gui.Caret(cursor, avatarInitiallyVisible, blinkOnRangeSelect)
Class that represents a caret in a document. The caret is implemented by the left border of a span positioned absolutely to the cursor element, with a width of 0 px and a height of 1em (CSS rules). Blinking is done by switching the color of the border from transparent to the member color and back.
Parameters:
{!ops.OdtCursor} cursor
{boolean} avatarInitiallyVisible
Sets the initial visibility of the caret's avatar
{boolean} blinkOnRangeSelect
Specify that the caret should blink if a non-collapsed range is selected
Method Detail
<inner> {undefined} blink(reset)
Parameters:
{boolean} reset
Returns:
{undefined}

{undefined} destroy(callback)
Parameters:
{!function(!Object=)} callback
Callback to call when the destroy is complete, passing an error object in case of error
Returns:
{undefined}

ensureVisible()
Scrolls the view on the canvas in such a way that the caret is completely visible, with a small margin around. The view on the canvas is only scrolled as much as needed. If the caret is already visible nothing will happen.

<inner> {!{left:!number|top:!number|right:!number|bottom:!number}} getCaretClientRectWithMargin(caretElement, margin)
Calculates the bounding client rect of the caret element, expanded with a specific margin
Parameters:
{!Element} caretElement
{!{left:!number|top:!number|right:!number|bottom:!number}} margin
Returns:
{!{left:!number|top:!number|right:!number|bottom:!number}}

{!ops.OdtCursor} getCursor()
Returns:
{!ops.OdtCursor} }

{!Element} getFocusElement()
Returns:
{!Element}

<inner> {?ClientRect} getSelectionRect()
Get the client rectangle for the nearest selection point to the caret. This works on the assumption that the next or previous sibling is likely to be a text node that will provide an accurate rectangle for the caret's desired height and vertical position.
Returns:
{?ClientRect}

<inner> handleUpdate()
Tweak the height and top offset of the caret to display closely inline in the text block. This uses ranges to account for line-height and text offsets. This adjustment is necessary as various combinations of fonts and line sizes otherwise cause the caret to appear above or below the natural line of the text. Fonts known to cause this problem: - STIXGeneral (MacOS, Chrome & Safari)

{undefined} hide()
Returns:
{undefined}

{undefined} hideHandle()
Returns:
{undefined}

<inner> {!number} length(node)
Return the maximum available offset for the supplied node.
Parameters:
{!Node} node
Returns:
{!number}

<inner> {undefined} refreshCursorBlinking()
Returns:
{undefined}

{undefined} removeFocus()
Returns:
{undefined}

{undefined} setAvatarImageUrl(url)
Parameters:
{string} url
Returns:
{undefined}

{undefined} setColor(newColor)
Parameters:
{string} newColor
Returns:
{undefined}

{undefined} setFocus()
Returns:
{undefined}

{undefined} show()
Returns:
{undefined}

{undefined} showHandle()
Returns:
{undefined}

{undefined} toggleHandleVisibility()
Returns:
{undefined}

<inner> {!number} verticalOverlap(cursorNode, rangeRect)
Calculate the number of pixels of vertical overlap. If there is no overlap, this number will be negative
Parameters:
{!Element} cursorNode
{!ClientRect} rangeRect
Returns:
{!number}

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Jan 28 2014 15:10:24 GMT+0100 (CET)