-
new ThumbnailControl(domElement, viewerControl)
-
Creates a new
PCCViewer.ThumbnailControlobject.Parameters:
Name Type Description domElementHTMLElement The DOM element in which to embed the
ThumbnailControl.viewerControlPCCViewer.ViewerControl The
ViewerControlobject for which to display thumbnails.Throws:
-
If either of the parameters is undefined or an invalid value.
-
- Type
- Error
-
Members
-
<static, readonly> EventType :string
-
The
EventTypeenumeration defines event types known to PCCViewer.ThumbnailControl.Note: This enumeration is for convenience for API developers. Instead of using this enumeration, you can pass string values of the eventType (enumeration values)
Type:
- string
-
Properties:
-
Name Type Default Description PageSelectionChangedstring PageSelectionChanged Event is triggered when the collection of selected thumbnails changes.
Augmented properties of the PCCViewer.Event object for this event:
pageNumbers{Array.<number>} The currently selected page numbers.
-
- See:
-
selectedPages :Array.<number>|number
-
An ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8.
Gets and sets the selected pages in the Thumbnail Control.
Type:
- Array.<number> | number
-
<readonly> viewerControl :PCCViewer.ViewerControl
-
An ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8.
Gets the PCCViewer.ViewerControl object associated with this
ThumbnailControl.Type:
-
<readonly> visiblePages :Array.<number>
-
An ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8.
Gets the page numbers of the pages currently visible in the
ThumbnailControlview.Type:
- Array.<number>
Methods
-
destroy()
-
This method will remove the thumbnails from the original
HTMLElementand return it to its previous state. It will destroy all of the thumbnails and release their resources. TheThumbnailControlcan no longer be used after calling this method, and a new one will need to be created to continue viewing thumbnails. -
getSelectedPages() → {Array.<number>}
-
Gets the currently selected thumbnails.
Returns:
The page numbers of the selected thumbnails.
- Type
- Array.<number>
-
getViewerControl() → {PCCViewer.ViewerControl}
-
Gets the PCCViewer.ViewerControl object associated with this
ThumbnailControl.Returns:
The
ViewerControlassociated with thisThumbnailControl. -
getVisiblePages() → {Array.<number>}
-
Gets the page numbers of the pages currently visible in the
ThumbnailControlview. This will include pages that are only partly visible, as well as pages that are not yet fully loaded but part of their placeholder is visible.Returns:
An array of page numbers.
- Type
- Array.<number>
-
off(eventType, handler) → {PCCViewer.ThumbnailControl}
-
Unsubscribe an event handler from a specified event type.
Typically, an event is unsubscribed when you no longer want further notification of the event.
Parameters:
Name Type Description eventTypestring A string specifying the event type. See PCCViewer.ThumbnailControl.EventType for a list and description of all supported events.
handlerPCCViewer.Event~eventHandler A function that was attached previously to the
ViewerControl.Note: This must be the same function object previously passed to PCCViewer.ThumbnailControl#on. It cannot be an different object that is functionally equivalent.
- See:
-
- PCCViewer.ViewerControl#on
- PCCViewer.ViewerControl#off for more details on usage.
Returns:
The
ThumbnailControlobject on which this method was called. -
on(eventType, handler) → {PCCViewer.ThumbnailControl}
-
Subscribe an event handler to an event of a specified type.
Parameters:
Name Type Description eventTypestring A string that specifies the event type. This value is case-insensitive. See PCCViewer.ThumbnailControl.EventType for a list and description of all supported events.
handlerPCCViewer.Event~eventHandler A function that will be called whenever the event is triggered.
- See:
-
- PCCViewer.ThumbnailControl#off
- PCCViewer.ViewerControl#on for more details on usage.
Returns:
The
ThumbnailControlobject on which this method was called. -
reflow() → {PCCViewer.ThumbnailControl}
-
This method will calculate the size of a thumbnail based on the defined CSS, and will fit each individual page element to the thumbnail container. This method can also be called to programmatically trigger the loading of newly visible pages in cases where the thumbnail view either dynamically or manually changes size, or the thumbnails themselves change size.
Note: This method can be a bit expensive, so it is best to debounce it from any event that triggers a thumbnail resize, such as a window resize.
Returns:
The
ThumbnailControlobject on which this method was called.Example
// First, get the thumbnailControl // Create a resize function var resize = function(){ thumbnailControl.reflow(); }; // Create a debounce function var debounceTimer; var debounceEvent = function(){ if (debounceTimer) { clearTimeout(debounceTimer); debounceTimer = undefined; } debounceTimer = setTimeout(resize, 300); }; // Add the debounced function to the resize event window.onresize = debounceEvent; -
scrollTo(pageNumber, options) → {PCCViewer.ThumbnailControl}
-
Scrolls to a specified page. By default, this will be done using the minimum amount of scrolling, so pages that are above the current view will be scrolled to appear at the top of the view, and pages below the current view will be scrolled to appear at the bottom. This can be overridden with the
optionsparameter.Parameters:
Name Type Argument Description pageNumbernumber The page to scroll to.
optionsObject <optional> Provide options to the scroll method to indicate desired behavior.
Properties
Name Type Argument Description forceAlignTopboolean <optional> Overrides the default scrolling behavior, and forces the specified page to always be scrolled to the top of the view.
Throws:
-
If the
pageNumberis not within the range of the page count for the specified document. -
- Type
- Error
Returns:
The
ThumbnailControlobject on which this method was called. -
-
setSelectedPages(pageNumbers) → {PCCViewer.ThumbnailControl}
-
Sets the currently selected thumbnails.
Parameters:
Name Type Description pageNumbersArray.<number> | number The page number (or numbers) to select. The first selected page will automatically be scrolled into view if it is not already visible. See PCCViewer.ThumbnailControl#scrollTo for more details on scrolling to a page.
Throws:
-
-
If the
pageNumbersparameter is undefined, or not a number or array of numbers. -
- Type
- Error
-
-
-
If any of the numbers defined in
pageNumbersis out of range of the document page count. -
- Type
- Error
-
Returns:
The
ThumbnailControlobject on which this method was called. -