new DisplayMode(docViewer, mode [, scrollable])
Constructs a new Display Mode that specifies how the pages are displayed on the screen
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
docViewer |
Core.DocumentViewer | The DocumentViewer instance | |
mode |
Core.DisplayModes | A value from Core.DisplayModes identifying the display mode type | |
scrollable |
boolean |
<optional> |
Whether the display mode is scrollable or not |
Methods
-
getMode()
-
Returns the current display mode
Returns:
The current display mode value- Type
- string
-
getPageOffset(pageNumber)
-
Returns the amount the page is offset from its container
Parameters:
Name Type Description pageNumbernumber The number of the page Returns:
A point with x and y properties of the amount the page is offset from its container -
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 containing x, y offsets relative to the viewport and width, height of the page -
getSelectedPages(mousePt1, mousePt2)
-
Gets the indexes of the first and last pages selected
Parameters:
Name Type Description mousePt1Core.DisplayMode.Point The starting mouse point mousePt2Core.DisplayMode.Point The ending mouse point Returns:
Object with first and last selected page numbers; last must be >= first -
getVisiblePages( [amountAhead] [, amountSide])
-
Returns an array of page indexes that are visible on screen
Parameters:
Name Type Argument Default Description amountAheadnumber <optional>
0.5 The amount of space ahead of the viewport to count as visible as a multiple of the screen height amountSidenumber <optional>
0.5 The amount of space to the side of the viewport to count as visible as a multiple of the screen height Returns:
An array of visible page numbers ordered by percentage visible (most visible first)- Type
- Array.<number>
-
isContinuous()
-
Returns whether the current display mode is continuous
Returns:
true if the display mode is continuous i.e. shows more than one row at a time- Type
- boolean
-
IsScrollable()
-
Returns whether the current display mode is scrollable
Returns:
true if scrolling is enabled for this display mode- Type
- boolean
-
pageToWindow(pagePt, pageNumber)
-
Converts page coordinates to window coordinates
Parameters:
Name Type Description pagePtCore.DisplayMode.Point Point in page coordinates pageNumbernumber The page number Returns:
Point in window coordinates -
pageToWindowNoRotate(pagePt, pageNumber)
-
Converts page coordinates to viewer coordinates without accounting for page rotation
Parameters:
Name Type Description pagePtCore.DisplayMode.Point Point in unrotated page coordinates pageNumbernumber The page number Returns:
Point in viewer coordinates ignoring rotation -
setCustomFunctions(fns)
-
Sets callbacks to provide custom functionality when in custom display mode
Parameters:
Name Type Description fnsCore.DisplayMode.CustomFunctionParameters Object containing callback overrides for the functions listed on Core.DisplayMode.CustomFunctionParameters -
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 - Deprecated:
-
- setParameters has been deprecated
-
windowToPage(windowPt, pageNumber)
-
Converts window coordinates to page coordinates
Parameters:
Name Type Description windowPtCore.DisplayMode.Point Point in window coordinates pageNumbernumber The page number Returns:
Point in page coordinates including the pageNumber property -
windowToPageNoRotate(windowPt, pageNumber)
-
Converts viewer coordinates to page coordinates without accounting for page rotation
Parameters:
Name Type Description windowPtCore.DisplayMode.Point Point in viewer coordinates pageNumbernumber The page number Returns:
Point in unrotated page coordinates with pageNumber
Type Definitions
-
CreatePageSectionsCallback()
-
Returns:
No return value- Type
- void
-
CustomFunctionParameters
-
Type:
- Object
Properties:
Name Type Argument Description getPageTransformCore.DisplayMode.GetPageTransformCallback <optional>
Gets the amount the page is shifted relative to the viewport getSelectedPagesCore.DisplayMode.GetSelectedPagesCallback <optional>
Gets the indexes of the first and last pages selected getVisiblePagesCore.DisplayMode.GetVisiblePagesCallback <optional>
Gets the indexes of the currently visible pages pageToWindowCore.DisplayMode.PageToWindowCallback <optional>
Converts page coordinates to window coordinates windowToPageCore.DisplayMode.WindowToPageCallback <optional>
Converts window coordinates to page coordinates createPageSectionsCore.DisplayMode.CreatePageSectionsCallback <optional>
-
GetPageTransformCallback(pageNumber)
-
Parameters:
Name Type Description pageNumbernumber The page number Returns:
Offsets and dimensions -
GetSelectedPagesCallback(mousePt1, mousePt2)
-
Parameters:
Name Type Description mousePt1Core.DisplayMode.Point Starting mouse point mousePt2Core.DisplayMode.Point Ending mouse point Returns:
Selected page range -
GetVisiblePagesCallback( [amountAhead] [, amountSide])
-
Parameters:
Name Type Argument Description amountAheadnumber <optional>
Vertical multiplier amountSidenumber <optional>
Horizontal multiplier Returns:
Visible page numbers ordered by visibility- Type
- Array.<number>
-
PagePoint
-
Type:
- Object
Properties:
Name Type Description pageNumbernumber The page index xnumber X coordinate in page coordinates ynumber Y coordinate in page coordinates -
PageToWindowCallback(pagePt, pageNumber)
-
Parameters:
Name Type Description pagePtCore.DisplayMode.Point Point in page coordinates pageNumbernumber The page number Returns:
Point in window coordinates -
PageTransformReturnType
-
Type:
- Object
Properties:
Name Type Description xnumber Horizontal offset of the page relative to the viewport (pixels) ynumber Vertical offset of the page relative to the viewport (pixels) widthnumber Page width (pixels) heightnumber Page height (pixels) -
Point
-
Type:
- Object
Properties:
Name Type Description xnumber The X coordinate ynumber The Y coordinate -
SelectedPagesReturnType
-
The selected page range
Type:
- Object
Properties:
Name Type Description firstnumber First page in the range lastnumber Last page in the range -
WindowToPageCallback(windowPt, pageNumber)
-
Parameters:
Name Type Description windowPtCore.DisplayMode.Point Point in window coordinates pageNumbernumber The page number Returns:
Page-coordinate point including pageNumber