Class CoreControls.DisplayMode
Represents a Display Mode.
Constructor Attributes | Constructor Name and Description |
---|---|
CoreControls.DisplayMode(docViewer, mode, scrollable)
Constructs a new Display Mode that specifies how the pages are displayed on the screen
|
Method Attributes | Method Name and Description |
---|---|
getPageOffset(pageIndex)
Returns the amount the page is offset from its container
|
|
getPageTransform(pageIndex)
Returns the amount the page is shifted relative to the viewport
|
|
getSelectedPages(mousePt1, mousePt2)
Gets the indexes of the first and last pages selected.
|
|
getVisiblePages(amountAhead, amountSide)
Returns an array of page indexes that are visible on screen.
|
|
pageToWindow(pagePt, pageIndex)
Converts page coordinates to window coordinates.
|
|
Sets callbacks to provide custom functionality when in custom display mode
|
|
setParameters(nCols, nRows, currentRow, startRow, endRow)
Sets parameters of the display mode
|
|
windowToPage(windowPt, pageIndex)
Converts window coordinates to page coordinates.
|
Class Detail
CoreControls.DisplayMode(docViewer, mode, scrollable)
Constructs a new Display Mode that specifies how the pages are displayed on the screen
- Parameters:
- {object} docViewer
- The DocumentViewer instance
- {object} mode
- The display mode type
- {boolean} scrollable
- Whether the display mode is scrollable or not
Method Detail
{object}
getPageOffset(pageIndex)
Returns the amount the page is offset from its container
- Parameters:
- {number} pageIndex
- The index of the page
- Returns:
- {object} An object with x and y properties of the amount the page is offset from its container
{object}
getPageTransform(pageIndex)
Returns the amount the page is shifted relative to the viewport
- Parameters:
- {number} pageIndex
- The index of the page
- Returns:
- {object} 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.
{object}
getSelectedPages(mousePt1, mousePt2)
Gets the indexes of the first and last pages selected.
- Parameters:
- {object} mousePt1
- The starting mouse point, an object with x and y properties
- {object} mousePt2
- The ending mouse point, an object with x and y properties
- Returns:
- {object} An object with a 'first' property being the first page selected and a 'last' property being the last page selected. last must be >= first.
{number[]}
getVisiblePages(amountAhead, amountSide)
Returns an array of page indexes that are visible on screen.
- Parameters:
- {number} amountAhead Optional
- The amount of space ahead of the viewport to count as visible as a multiple of the screen height (default is 0.5)
- {number} amountSide 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:
- {number[]} an array of 0-indexed page numbers.
{object}
pageToWindow(pagePt, pageIndex)
Converts page coordinates to window coordinates.
- Parameters:
- {object} pagePt
- A object with x and y properties in page coordinates
- {number} pageIndex
- The page index
- Returns:
- {object} An object with the page index as well as x and y values in window coordinates
setCustomFunctions()
Sets callbacks to provide custom functionality when in custom display mode
- Parameters:
- 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:
- {number} nCols
- The number of columns
- {number} nRows
- The number of rows
- {number} currentRow
- The current row to be displayed
- {number} startRow
- The starting row to have in the DOM
- {number} endRow
- The ending row to have in the DOM
{object}
windowToPage(windowPt, pageIndex)
Converts window coordinates to page coordinates.
- Parameters:
- {object} windowPt
- A object with x and y properties in window coordinates
- {number} pageIndex
- The page index
- Returns:
- {object} An object with the page index as well as x and y values in page coordinates