new DisplayMode(docViewer, mode, scrollable)
Constructs a new Display Mode that specifies how the pages are displayed on the screen
Parameters:
| Name | Type | Description |
|---|---|---|
docViewer |
object | The DocumentViewer instance |
mode |
object | The display mode type |
scrollable |
boolean | Whether the display mode is scrollable or not |
Methods
-
getPageOffset(pageNumber)
-
Returns the amount the page is offset from its container
Parameters:
Name Type Description pageNumbernumber The number of the page Returns:
An object with x and y properties of the amount the page is offset from its container- Type
- object
-
getPageTransform(pageNumber)
-
Returns the amount the page is shifted relative to the viewport
Parameters:
Name Type Description pageNumbernumber The number of the page Returns:
An object with x and y properties of the amount the page is shifted relative to the viewport and width and height properties of the page.- Type
- object
-
getSelectedPages(mousePt1, mousePt2)
-
Gets the indexes of the first and last pages selected.
Parameters:
Name Type Description mousePt1object The starting mouse point, an object with x and y properties mousePt2object The ending mouse point, an object with x and y properties Returns:
An object with a 'first' property being the first page selected and a 'last' property being the last page selected. last must be >= first.- Type
- object
-
getVisiblePages( [amountAhead] [, amountSide])
-
Returns an array of page indexes that are visible on screen.
Parameters:
Name Type Argument Description amountAheadnumber <optional>
The amount of space ahead of the viewport to count as visible as a multiple of the screen height (default is 0.5) amountSidenumber <optional>
The amount of space to the side of the viewport to count as visible as a multiple of the screen height (default is 0.5) Returns:
an array of 0-indexed page numbers.- Type
- Array.<number>
-
isContinuous()
-
Returns whether or not the display is continuous
Returns:
true if the display mode is continuous i.e. shows more than one row at a time- Type
- boolean
-
pageToWindow(pagePt, pageNumber)
-
Converts page coordinates to window coordinates.
Parameters:
Name Type Description pagePtobject A object with x and y properties in page coordinates pageNumbernumber The page number Returns:
An object with the page index as well as x and y values in window coordinates- Type
- object
-
setCustomFunctions()
-
Sets callbacks to provide custom functionality when in custom display mode
Parameters:
Name Type Description fns.pageToWindowtransform coordinates relative to a document page to coordinates relative to the viewer div fns.windowToPagetransform coordinates relative to the viewer div relative to a document page fns.getSelectedPagesreturns an array of currently selected page indices fns.getVisiblePagesreturns an array of currently visible pages fns.getPageTransformreturns the offsets of a page container fns.createPageSectionslays out pageSection and pageContainer divs to DocumentViewer can put content in them -
setParameters(nCols, nRows, currentRow, startRow, endRow)
-
Sets parameters of the display mode
Parameters:
Name Type Description nColsnumber The number of columns nRowsnumber The number of rows currentRownumber The current row to be displayed startRownumber The starting row to have in the DOM endRownumber The ending row to have in the DOM -
windowToPage(windowPt, pageNumber)
-
Converts window coordinates to page coordinates.
Parameters:
Name Type Description windowPtobject A object with x and y properties in window coordinates pageNumbernumber The page number Returns:
An object with the page number as well as x and y values in page coordinates- Type
- object