Constructor
new ThumbnailControl(domElement, viewerControl)
Creates a new PCCViewer.ThumbnailControl
object.
Parameters:
Name | Type | Description |
---|---|---|
domElement |
HTMLElement |
The DOM element in which to embed the |
viewerControl |
PCCViewer.ViewerControl |
The |
Throws:
-
If either of the parameters is undefined or an invalid value.
-
- Type
- Error
Members
(static, readonly) EventType :string
The EventType
enumeration 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 | Description |
---|---|---|
PageSelectionChanged |
string |
Event is triggered when the collection of selected thumbnails changes. Augmented properties of the PCCViewer.Event object for this event:
|
(static, readonly) EventType :string
The EventType
enumeration 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 | Description |
---|---|---|
PageSelectionChanged |
string |
Event is triggered when the collection of selected thumbnails changes. Augmented properties of the PCCViewer.Event object for this event:
|
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
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) 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 ThumbnailControl
view.
Type:
- Array.<number>
(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 ThumbnailControl
view.
Type:
- Array.<number>
Methods
destroy()
This method will remove the thumbnails from the original HTMLElement
and return it to its previous state. It will destroy all of the thumbnails and release their resources. The ThumbnailControl
can no longer be used after calling this method, and a new one will need to be created to continue viewing thumbnails.
destroy()
This method will remove the thumbnails from the original HTMLElement
and return it to its previous state. It will destroy all of the thumbnails and release their resources. The ThumbnailControl
can 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>
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 ViewerControl
associated with this ThumbnailControl
.
getViewerControl() → {PCCViewer.ViewerControl}
Gets the PCCViewer.ViewerControl object associated with this ThumbnailControl
.
Returns:
The ViewerControl
associated with this ThumbnailControl
.
getVisiblePages() → {Array.<number>}
Gets the page numbers of the pages currently visible in the ThumbnailControl
view. 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>
getVisiblePages() → {Array.<number>}
Gets the page numbers of the pages currently visible in the ThumbnailControl
view. 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 |
---|---|---|
eventType |
string |
A string specifying the event type. See PCCViewer.ThumbnailControl.EventType for a list and description of all supported events. |
handler |
PCCViewer.Event~eventHandler |
A function that was attached previously to the 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 ThumbnailControl
object on which this method was called.
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 |
---|---|---|
eventType |
string |
A string specifying the event type. See PCCViewer.ThumbnailControl.EventType for a list and description of all supported events. |
handler |
PCCViewer.Event~eventHandler |
A function that was attached previously to the 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 ThumbnailControl
object 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 |
---|---|---|
eventType |
string |
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. |
handler |
PCCViewer.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 ThumbnailControl
object 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 |
---|---|---|
eventType |
string |
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. |
handler |
PCCViewer.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 ThumbnailControl
object 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 ThumbnailControl
object 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;
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 ThumbnailControl
object 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, optionsopt) → {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 options
parameter.
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
pageNumber |
number |
The page to scroll to. |
|||||||||
options |
Object | <optional> |
Provide options to the scroll method to indicate desired behavior. Properties
|
Throws:
-
If the
pageNumber
is not within the range of the page count for the specified document. -
- Type
- Error
Returns:
The ThumbnailControl
object on which this method was called.
scrollTo(pageNumber, optionsopt) → {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 options
parameter.
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
pageNumber |
number |
The page to scroll to. |
|||||||||
options |
Object | <optional> |
Provide options to the scroll method to indicate desired behavior. Properties
|
Throws:
-
If the
pageNumber
is not within the range of the page count for the specified document. -
- Type
- Error
Returns:
The ThumbnailControl
object on which this method was called.
setSelectedPages(pageNumbers) → {PCCViewer.ThumbnailControl}
Sets the currently selected thumbnails.
Parameters:
Name | Type | Description |
---|---|---|
pageNumbers |
Array.<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
pageNumbers
parameter is undefined, or not a number or array of numbers. -
- Type
- Error
-
-
-
If any of the numbers defined in
pageNumbers
is out of range of the document page count. -
- Type
- Error
-
Returns:
The ThumbnailControl
object on which this method was called.
setSelectedPages(pageNumbers) → {PCCViewer.ThumbnailControl}
Sets the currently selected thumbnails.
Parameters:
Name | Type | Description |
---|---|---|
pageNumbers |
Array.<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
pageNumbers
parameter is undefined, or not a number or array of numbers. -
- Type
- Error
-
-
-
If any of the numbers defined in
pageNumbers
is out of range of the document page count. -
- Type
- Error
-
Returns:
The ThumbnailControl
object on which this method was called.