Class: DisplayMode

CoreControls. DisplayMode

Represents a Display Mode.

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
pageNumber number 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
pageNumber number 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
mousePt1 object The starting mouse point, an object with x and y properties
mousePt2 object 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
amountAhead number <optional>
The amount of space ahead of the viewport to count as visible as a multiple of the screen height (default is 0.5)
amountSide number <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
pagePt object A object with x and y properties in page coordinates
pageNumber number 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.pageToWindow transform coordinates relative to a document page to coordinates relative to the viewer div
fns.windowToPage transform coordinates relative to the viewer div relative to a document page
fns.getSelectedPages returns an array of currently selected page indices
fns.getVisiblePages returns an array of currently visible pages
fns.getPageTransform returns the offsets of a page container
fns.createPageSections lays 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
nCols number The number of columns
nRows number The number of rows
currentRow number The current row to be displayed
startRow number The starting row to have in the DOM
endRow number The ending row to have in the DOM

windowToPage(windowPt, pageNumber)

Converts window coordinates to page coordinates.
Parameters:
Name Type Description
windowPt object A object with x and y properties in window coordinates
pageNumber number The page number
Returns:
An object with the page number as well as x and y values in page coordinates
Type
object