Constructor
new Navigator(options)
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Navigator options
Properties
|
- Source:
Extends
Members
canvas :Element
A <div> element, the element where user-input events are handled for panning and zooming.
Child element of
The parent of
Child element of
OpenSeadragon.Viewer#container
,
positioned on top of OpenSeadragon.Viewer#keyboardCommandArea
.The parent of
OpenSeadragon.Drawer#canvas
instances.
Type:
- Element
- Inherited From:
- Source:
container :Element
A <div> element (provided by
Child element of
OpenSeadragon.ControlDock
), the base element of this Viewer instance.Child element of
OpenSeadragon.Viewer#element
.
Type:
- Element
- Inherited From:
- Source:
drawer :OpenSeadragon.Drawer
Handles rendering of tiles in the viewer. Created for each TileSource opened.
Type:
- OpenSeadragon.Drawer
- Inherited From:
- Source:
element :Element
The parent element of this Viewer instance, passed in when the Viewer was created.
Type:
- Element
- Inherited From:
- Source:
initialPage :Number
Index for page to be shown first next time open() is called (only used in sequenceMode).
Type:
- Number
- Inherited From:
- Source:
navigator :OpenSeadragon.Navigator
Type:
- Inherited From:
- Source:
viewport :OpenSeadragon.Viewport
Handles coordinate-related functionality - zoom, pan, rotation, etc. Created for each TileSource opened.
Type:
- Inherited From:
- Source:
world :OpenSeadragon.World
Keeps track of all of the tiled images in the scene.
Type:
- Inherited From:
- Source:
Methods
_cancelPendingImages()
Cancel the "in flight" images.
- Inherited From:
- Source:
addButton(button)
Adds the given button to this viewer.
Parameters:
Name | Type | Description |
---|---|---|
button |
OpenSeadragon.Button |
- Inherited From:
- Source:
addControl()
- Inherited From:
- Source:
addHandler(eventName, handler, userDataopt, priorityopt) → {Boolean}
Add an event handler for a given event.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
eventName |
String | Name of event to register. | ||
handler |
OpenSeadragon.EventHandler | Function to call when event is triggered. | ||
userData |
Object |
<optional> |
null | Arbitrary object to be passed unchanged to the handler. |
priority |
Number |
<optional> |
0 | Handler priority. By default, all priorities are 0. Higher number = priority. |
- Overrides:
- Source:
Returns:
- True if the handler was added, false if it was rejected
- Type
- Boolean
addOnceHandler(eventName, handler, userDataopt, timesopt, priorityopt) → {Boolean}
Add an event handler to be triggered only once (or a given number of times)
for a given event. It is not removable with removeHandler().
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
eventName |
String | Name of event to register. | ||
handler |
OpenSeadragon.EventHandler | Function to call when event is triggered. | ||
userData |
Object |
<optional> |
null | Arbitrary object to be passed unchanged to the handler. |
times |
Number |
<optional> |
1 | The number of times to handle the event before removing it. |
priority |
Number |
<optional> |
0 | Handler priority. By default, all priorities are 0. Higher number = priority. |
- Overrides:
- Source:
Returns:
- True if the handler was added, false if it was rejected
- Type
- Boolean
addOverlay(element, location, placementopt, onDrawopt) → {OpenSeadragon.Viewer}
Adds an html element as an overlay to the current viewport. Useful for
highlighting words or areas of interest on an image or other zoomable
interface. The overlays added via this method are removed when the viewport
is closed which include when changing page.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
element |
Element | String | Object | A reference to an element or an id for
the element which will be overlaid. Or an Object specifying the configuration for the overlay.
If using an object, see OpenSeadragon.Overlay for a list of
all available options. |
||
location |
OpenSeadragon.Point | OpenSeadragon.Rect | The point or rectangle which will be overlaid. This is a viewport relative location. | ||
placement |
OpenSeadragon.Placement |
<optional> |
OpenSeadragon.Placement.TOP_LEFT | The position of the viewport which the location coordinates will be treated as relative to. |
onDraw |
function |
<optional> |
If supplied the callback is called when the overlay needs to be drawn. It is the responsibility of the callback to do any drawing/positioning. It is passed position, size and element. |
- Inherited From:
- Source:
Fires:
Returns:
Chainable.
- Type
- OpenSeadragon.Viewer
addReferenceStrip()
Enables and displays the reference strip based on the currently set tileSources.
Works only when the Viewer has sequenceMode set to true.
- Inherited From:
- Source:
addSimpleImage(options)
Add a simple image to the viewer.
The options are the same as the ones in
OpenSeadragon.Viewer#addTiledImage
except for options.tileSource which is replaced by options.url.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
options |
Object | See OpenSeadragon.Viewer#addTiledImage
for all the options
Properties
|
- Inherited From:
- Source:
Fires:
addTiledImage(options)
Add a tiled image to the viewer.
options.tileSource can be anything that
OpenSeadragon.Viewer#open
supports except arrays of images.
Note that you can specify options.width or options.height, but not both.
The other dimension will be calculated according to the item's aspect ratio.
If collectionMode is on (see OpenSeadragon.Options
), the new image is
automatically arranged with the others.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Overrides:
- Source:
Fires:
areControlsEnabled() → {Boolean}
- Inherited From:
- Source:
Returns:
- Type
- Boolean
bindSequenceControls() → {OpenSeadragon.Viewer}
- Inherited From:
- Source:
Returns:
Chainable.
- Type
- OpenSeadragon.Viewer
bindStandardControls() → {OpenSeadragon.Viewer}
- Inherited From:
- Source:
Returns:
Chainable.
- Type
- OpenSeadragon.Viewer
clearControls() → {OpenSeadragon.ControlDock}
- Inherited From:
- Source:
Returns:
Chainable.
clearOverlays() → {OpenSeadragon.Viewer}
Removes all currently configured Overlays from this Viewer and schedules
an update.
- Inherited From:
- Source:
Fires:
Returns:
Chainable.
- Type
- OpenSeadragon.Viewer
close() → {OpenSeadragon.Viewer}
- Inherited From:
- Source:
Fires:
Returns:
Chainable.
- Type
- OpenSeadragon.Viewer
currentPage() → {Number}
Gets the active page of a sequence
- Inherited From:
- Source:
Returns:
- Type
- Number
destroy()
Function to destroy the viewer and clean up everything created by OpenSeadragon.
Example:
var viewer = OpenSeadragon({
[...]
});
//when you are done with the viewer:
viewer.destroy();
viewer = null; //important
- Overrides:
- Source:
Fires:
forceRedraw() → {OpenSeadragon.Viewer}
Force the viewer to redraw its contents.
- Inherited From:
- Source:
Returns:
Chainable.
- Type
- OpenSeadragon.Viewer
forceResize()
Force the viewer to reset its size to match its container.
- Inherited From:
- Source:
gestureSettingsByDeviceType(type) → {OpenSeadragon.GestureSettings}
Gets this viewer's gesture settings for the given pointer device type.
Parameters:
Name | Type | Description |
---|---|---|
type |
String | The pointer device type to get the gesture settings for ("mouse", "touch", "pen", etc.). |
- Inherited From:
- Source:
Returns:
getHandler(eventName)
Get a function which iterates the list of all handlers registered for a given event, calling the handler for each.
Parameters:
Name | Type | Description |
---|---|---|
eventName |
String | Name of event to get handlers for. |
- Overrides:
- Source:
getOverlayById(element) → {OpenSeadragon.Overlay}
Finds an overlay identified by the reference element or element id
and returns it as an object, return null if not found.
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | String | A reference to the element or an element id which represents the overlay content. |
- Inherited From:
- Source:
Returns:
the matching overlay or null if none found.
goToNextPage()
Sets the image source to the source with index equal to
currentIndex + 1. Changes current image in sequence mode.
If specified, wraps around (see navPrevNextWrap in
OpenSeadragon.Options
)
- Inherited From:
- Source:
goToPage() → {OpenSeadragon.Viewer}
- Inherited From:
- Source:
Fires:
Returns:
Chainable.
- Type
- OpenSeadragon.Viewer
goToPreviousPage()
Sets the image source to the source with index equal to
currentIndex - 1. Changes current image in sequence mode.
If specified, wraps around (see navPrevNextWrap in
OpenSeadragon.Options
)
- Inherited From:
- Source:
isFullPage() → {Boolean}
- Inherited From:
- Source:
Returns:
- Type
- Boolean
isFullScreen() → {Boolean}
- Inherited From:
- Source:
Returns:
returns true if the viewer is in fullscreen
- Type
- Boolean
isMouseNavEnabled() → {Boolean}
- Inherited From:
- Source:
Returns:
- Type
- Boolean
isOpen() → {Boolean}
- Inherited From:
- Source:
Returns:
- Type
- Boolean
isVisible() → {Boolean}
- Inherited From:
- Source:
Returns:
- Type
- Boolean
numberOfHandlers(eventName) → {number}
Get the amount of handlers registered for a given event.
Parameters:
Name | Type | Description |
---|---|---|
eventName |
String | Name of event to inspect. |
- Overrides:
- Source:
Returns:
amount of events
- Type
- number
open(tileSources, initialPage) → {OpenSeadragon.Viewer}
Open tiled images into the viewer, closing any others.
To get the TiledImage instance created by open, add an event listener for
OpenSeadragon.Viewer.html#.event:open
, which when fired can be used to get access
to the instance, i.e., viewer.world.getItemAt(0).
Parameters:
Name | Type | Description |
---|---|---|
tileSources |
Array | String | Object | function | This can be a TiledImage
specifier, a TileSource specifier, or an array of either. A TiledImage specifier
is the same as the options parameter for OpenSeadragon.Viewer#addTiledImage ,
except for the index property; images are added in sequence.
A TileSource specifier is anything you could pass as the tileSource property
of the options parameter for OpenSeadragon.Viewer#addTiledImage . |
initialPage |
Number | If sequenceMode is true, display this page initially for the given tileSources. If specified, will overwrite the Viewer's existing initialPage property. |
- Inherited From:
- Source:
Fires:
Returns:
Chainable.
- Type
- OpenSeadragon.Viewer
raiseEvent(eventName, eventArgs) → {Boolean}
Trigger an event, optionally passing additional information.
Parameters:
Name | Type | Description |
---|---|---|
eventName |
String | Name of event to register. |
eventArgs |
Object | Event-specific data. |
- Overrides:
- Source:
Returns:
True if the event was fired, false if it was rejected because of rejectEventHandler(eventName)
- Type
- Boolean
removeAllHandlers(eventName)
Remove all event handlers for a given event type. If no type is given all
event handlers for every event type are removed.
Parameters:
Name | Type | Description |
---|---|---|
eventName |
String | Name of event for which all handlers are to be removed. |
- Overrides:
- Source:
removeControl() → {OpenSeadragon.ControlDock}
- Inherited From:
- Source:
Returns:
Chainable.
removeHandler(eventName, handler)
Remove a specific event handler for a given event.
Parameters:
Name | Type | Description |
---|---|---|
eventName |
String | Name of event for which the handler is to be removed. |
handler |
OpenSeadragon.EventHandler | Function to be removed. |
- Overrides:
- Source:
removeOverlay(element) → {OpenSeadragon.Viewer}
Removes an overlay identified by the reference element or element id
and schedules an update.
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | String | A reference to the element or an element id which represent the ovelay content to be removed. |
- Inherited From:
- Source:
Fires:
Returns:
Chainable.
- Type
- OpenSeadragon.Viewer
removeReferenceStrip()
Removes the reference strip and disables displaying it.
- Inherited From:
- Source:
requestDrawer(drawerCandidate, options) → {Object|Boolean}
Request a drawer for this viewer, as a supported string or drawer constructor.
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
drawerCandidate |
String | OpenSeadragon.DrawerBase | The type of drawer to try to construct. | ||||||||||||||||
options |
Object |
Properties
|
- Inherited From:
- Source:
Returns:
The drawer that was created, or false if the requested drawer is not supported
- Type
- Object | Boolean
setAjaxHeaders(ajaxHeaders, propagateopt)
Update headers to include when making AJAX requests.
Unless `propagate` is set to false (which is likely only useful in rare circumstances),
the updated headers are propagated to all tiled images, each of which will subsequently
propagate the changed headers to all their tiles.
If applicable, the headers of the viewer's navigator and reference strip will also be updated.
Note that the rules for merging headers still apply, i.e. headers returned by
OpenSeadragon.TileSource#getTileAjaxHeaders
take precedence over
`TiledImage.ajaxHeaders`, which take precedence over the headers here in the viewer.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
ajaxHeaders |
Object | Updated AJAX headers. | ||
propagate |
Boolean |
<optional> |
true | Whether to propagate updated headers to tiled images, etc. |
- Inherited From:
- Source:
setControlsEnabled(true) → {OpenSeadragon.Viewer}
Shows or hides the controls (e.g. the default navigation buttons).
Parameters:
Name | Type | Description |
---|---|---|
true |
Boolean | to show, false to hide. |
- Inherited From:
- Source:
Fires:
Returns:
Chainable.
- Type
- OpenSeadragon.Viewer
setDebugMode(debugMode)
Turns debugging mode on or off for this viewer.
Parameters:
Name | Type | Description |
---|---|---|
debugMode |
Boolean | true to turn debug on, false to turn debug off. |
- Inherited From:
- Source:
setFlip(state)
Flip navigator element
Parameters:
Name | Type | Description |
---|---|---|
state |
Boolean | Flip state to set. |
- Source:
setFullPage(fullPage) → {OpenSeadragon.Viewer}
Toggle full page mode.
Parameters:
Name | Type | Description |
---|---|---|
fullPage |
Boolean | If true, enter full page mode. If false, exit full page mode. |
- Inherited From:
- Source:
Fires:
Returns:
Chainable.
- Type
- OpenSeadragon.Viewer
setFullScreen(fullScreen) → {OpenSeadragon.Viewer}
Toggle full screen mode if supported. Toggle full page mode otherwise.
Parameters:
Name | Type | Description |
---|---|---|
fullScreen |
Boolean | If true, enter full screen mode. If false, exit full screen mode. |
- Inherited From:
- Source:
Fires:
Returns:
Chainable.
- Type
- OpenSeadragon.Viewer
setHeight(height)
Explicitly sets the height of the navigator, in web coordinates. Disables automatic resizing.
Parameters:
Name | Type | Description |
---|---|---|
height |
Number | String | the new height, either a number of pixels or a CSS string, such as "100%" |
- Source:
setMouseNavEnabled(enabled) → {OpenSeadragon.Viewer}
Parameters:
Name | Type | Description |
---|---|---|
enabled |
Boolean | true to enable, false to disable |
- Inherited From:
- Source:
Fires:
Returns:
Chainable.
- Type
- OpenSeadragon.Viewer
setVisible(visible) → {OpenSeadragon.Viewer}
Parameters:
Name | Type | Description |
---|---|---|
visible |
Boolean |
- Inherited From:
- Source:
Fires:
Returns:
Chainable.
- Type
- OpenSeadragon.Viewer
setWidth(width)
Explicitly sets the width of the navigator, in web coordinates. Disables automatic resizing.
Parameters:
Name | Type | Description |
---|---|---|
width |
Number | String | the new width, either a number of pixels or a CSS string, such as "100%" |
- Source:
update(viewportopt)
Used to update the navigator minimap's viewport rectangle when a change in the viewer's viewport occurs.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
viewport |
OpenSeadragon.Viewport |
<optional> |
The viewport to display. Default: the viewport this navigator is tracking. |
- Source:
updateOverlay(element, location, placementopt) → {OpenSeadragon.Viewer}
Updates the overlay represented by the reference to the element or
element id moving it to the new location, relative to the new placement.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
element |
Element | String | A reference to an element or an id for the element which is overlaid. | ||
location |
OpenSeadragon.Point | OpenSeadragon.Rect | The point or rectangle which will be overlaid. This is a viewport relative location. | ||
placement |
OpenSeadragon.Placement |
<optional> |
OpenSeadragon.Placement.TOP_LEFT | The position of the viewport which the location coordinates will be treated as relative to. |
- Inherited From:
- Source:
Fires:
Returns:
Chainable.
- Type
- OpenSeadragon.Viewer
updateSize()
Used to notify the navigator when its size has changed.
Especially useful when
OpenSeadragon.Options
.navigatorAutoResize is set to false and the navigator is resizable.
- Source: