Class Index | File Index

Classes


Class gui.Caret


Defined in: Caret.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
gui.Caret(cursor, viewport, avatarInitiallyVisible, blinkOnRangeSelect)
Class that represents a caret in a document.
Method Summary
Method Attributes Method Name and Description
<inner>  
<inner>  
destroy(callback)
 
destroy(callback)
 
Scrolls the view on the canvas in such a way that the caret is completely visible, with a small margin around.
 
Get the bounding client rectangle of the visual caret.
<inner>  
 
 
<inner>  
Get the client rectangle for the nearest selection point to the caret.
 
Recalculate the caret size and position (but don't scroll into view)
<inner>  
hasStateChanged(property)
Returns true if the requested property is different between the last state and the current state
 
hide()
Hide the caret from view.
 
 
 
<inner>  
Update all properties in the last state to match the current state
 
 
setColor(newColor)
 
 
 
show()
 
 
<inner>  
Synchronize the requested caret state & visible state
<inner>  
Tweak the height and top offset of the caret to display closely inline in the text block.
Class Detail
gui.Caret(cursor, viewport, 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
{!gui.Viewport} viewport
{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} blinkCaret()
Returns:
{undefined}

<inner> {undefined} destroy(callback)
Parameters:
{!function(!Object=)} callback
Returns:
{undefined}

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

{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. If the caret has been hidden via the hide() function, no scrolling will occur when this function is called.
Returns:
{undefined}

{?ClientRect} getBoundingClientRect()
Get the bounding client rectangle of the visual caret.
Returns:
{?ClientRect}

<inner> {?ClientRect} getCaretSizeFromCursor()
Returns:
{?ClientRect}

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

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

<inner> {!{height: !number|top: !number|right: !number|width: !number}} 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 position. The horizontal position of the caret is specified in the "right" property as a caret generally appears to the right of the character or object is represents.
Returns:
{!{height: !number|top: !number|right: !number|width: !number}}

{undefined} handleUpdate()
Recalculate the caret size and position (but don't scroll into view)
Returns:
{undefined}

<inner> {!boolean} hasStateChanged(property)
Returns true if the requested property is different between the last state and the current state
Parameters:
{!string} property
Returns:
{!boolean}

{undefined} hide()
Hide the caret from view. All requests to scroll into view will be ignored while the caret is hidden.
Returns:
{undefined}

{undefined} hideHandle()
Returns:
{undefined}

{undefined} refreshCursorBlinking()
Returns:
{undefined}

{undefined} removeFocus()
Returns:
{undefined}

<inner> {undefined} saveState()
Update all properties in the last state to match the current state
Returns:
{undefined}

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

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

{undefined} setFocus()
Returns:
{undefined}

{undefined} setOverlayElement(element)
Parameters:
{!Element} element
Returns:
{undefined}

{undefined} show()
Returns:
{undefined}

{undefined} showHandle()
Returns:
{undefined}

{undefined} toggleHandleVisibility()
Returns:
{undefined}

<inner> {undefined} updateCaret()
Synchronize the requested caret state & visible state
Returns:
{undefined}

<inner> {undefined} updateOverlayHeightAndPosition()
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)
Returns:
{undefined}

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Sep 17 2014 17:41:07 GMT+0200 (MESZ)