new imageViewer()
imageViewer - This is is a jQuery plugin and as such uses an Immediately Invoked Function Expression (IIFE)
- Source:
- image_viewer.js, line 5
Methods
-
<static> displayLegend()
-
Public method to display the legend modal dialog box as an overlay.
- Source:
- image_viewer.js, line 82
-
<static> hideLegend()
-
Public method to hide the modal dialog box
- Source:
- image_viewer.js, line 101
-
<static> print()
-
Will load all images currently in the images variable and loads them in a new tab. Once in a new tab will open the print dialog box for printing. Images will each be printed separated by a page break. Closes new tab when print dialog is dismissed (by printing or by cancelling)
- Source:
- image_viewer.js, line 155
-
<static> rotate(increment)
-
Rotates current image by increment to the right
Parameters:
Name Type Description increment
integer Angle to be rotated by. Given the integer 90 will rotate current image by 90 degrees to the right. - Source:
- image_viewer.js, line 149
-
<static> rotate_all(increment)
-
Rotates all images currently in the images var
Parameters:
Name Type Description increment
integer Angle to be rotated by. Given the integer 90 will rotate current image by 90 degrees to the right. - Source:
- image_viewer.js, line 140
-
<static> scroll(left, top)
-
Public method for manipulating the top and left dimensions of an image. This is used to move the image up/left/right/down. See tests for examples
Parameters:
Name Type Description left
integer Desired left position of current image. top
integer Desired top position of current image. - Source:
- image_viewer.js, line 109
-
<static> scrollPage(increment)
-
Method by which the next or previous image is retrieved and set to the current image (from the initial sequence of images)
Parameters:
Name Type Description increment
integer Usually 1 or -1 for next and previous page, but can be any integer. - Source:
- image_viewer.js, line 55
-
<static> settings(str)
-
Essentially just an public accessor for getting information about the internal settings variable.
Parameters:
Name Type Description str
string String of setting you'd like to view. - Source:
- image_viewer.js, line 68
-
<static> setupKeyBindings()
-
Public method to setup keybindings via the setupKeyBindings() method
- Source:
- image_viewer.js, line 79
-
<static> teardownKeyBindings()
-
Public method to remove keybindings. Especially useful when displaying multiple image_viewers on a single page.
- Source:
- image_viewer.js, line 76
-
<static> zoom(increment, increment, zoomDirection)
-
Public method for inreasing the width dimension of the current image.
Parameters:
Name Type Description increment
integer Increment you'd like to increase by. If specified as an integer will increase current increment increment
string if Increment is given as a string suffixed by the percent sign (%) will set that percentage absolutely. zoomDirection
string Defaults to 'width' if specified as 'height' will change the height percentage instead of width. - Source:
- image_viewer.js, line 119
-
<private, inner> addGlyphIcon(glyph)
-
builds an i tag with a class of glyph
Parameters:
Name Type Description glyph
string name of glyph class from css. View image_viewer_rails.css.scss to see options. - Source:
- image_viewer.js, line 296
-
<private, inner> addKeyToKeyMaster(keyString, keyScope, func)
-
Convenience method for adding keybindings to imageViewer through keymaster.js
Parameters:
Name Type Description keyString
string String of the key to be bound to func. Listing of keys can be found: https://github.com/madrobby/keymaster keyScope
string Scope for current keybinds. This scope can be deleted (and is with teardownKeyBindings(). func
func function to be bound ot the keyString. - Source:
- image_viewer.js, line 373
-
<private, inner> createNavLink(call, name, glyph)
-
builds link tag with title of name, and the onclick function of call
Parameters:
Name Type Description call
string the imageViewer call that will be assigned to the onclick even of this link. name
string inserted directly into title text of link. glyph
string name of css class glyphicon (see addGlyphIcon) - Source:
- image_viewer.js, line 306
-
<private, inner> createNavTable()
-
Builds the navLinks table. Each call to createNavLink creates an a tag with a contained icon tag. These link tags contain the onclick events
- Source:
- image_viewer.js, line 268
-
<private, inner> delayedRedirect()
-
Redirects window to root path
- Source:
- image_viewer.js, line 358
-
<inner> handleWindowResize()
-
call setupHeight() on resize
- Source:
- image_viewer.js, line 455
-
<private, inner> init(image_path_array, options)
-
initializes the image viewer's internal state. Any settings passed to options are merged into the default settings object. Calls a number of functions to initialize the viewer including setting up containers, listeners, et al
Parameters:
Name Type Description image_path_array
array Array of image paths. These paths will be inserted as the src attribute on img tags later, so ensure that these are valid paths. options
object options that will be merged into the default settings object. - Source:
- image_viewer.js, line 182
-
<private, inner> reload()
-
resets settings object and reinitializes the image_viewer.
- Source:
- image_viewer.js, line 253
-
<private, inner> rotate(increment, imageIndex)
-
Calls jQuery.rotate.js's rotate function.
Parameters:
Name Type Description increment
integer number of degrees to rotate image. imageIndex
integer Set which image to rotate. Defaults to current image based of settings["imageIndex"] - Source:
- image_viewer.js, line 511
-
<private, inner> setupContainers()
-
Clears mainDiv (which is _this_ upon initialization). Assigns width to mainDiv from settings var
- Source:
- image_viewer.js, line 319
-
<private, inner> setupHeight()
-
Calculates the height of the view port and sets the main div to fit.
- Source:
- image_viewer.js, line 427
-
<private, inner> setupImages(images)
-
Creates the img tags on the page and assigns them unique ids
Parameters:
Name Type Description images
array This function is called from init() and accepts the array of images passed there. - Source:
- image_viewer.js, line 329
-
<private, inner> setupKeyBindings()
-
Assigns the various key combinations to their actual function calls.
- Source:
- image_viewer.js, line 385
-
<private, inner> setupLegend()
-
Builds and prepends the the legend dialog box to the #image-viewer-key-bindings.
- Source:
- image_viewer.js, line 201
-
<inner> teardownKeyBindings()
-
Removes keybindings from keymaster.
- Source:
- image_viewer.js, line 363
-
<private, inner> updateOverlay(commandMode)
-
Updates the nav-info to display both command mode toggle and "page of pages"
Parameters:
Name Type Description commandMode
bool Sets comand mode to true or false. - Source:
- image_viewer.js, line 489
-
<private, inner> zoomAbsolute(zoomLevel)
-
Zooms image's 'height' or 'width' to a given percentage. Height or Width is decided by setting the zoomDirection setting var.
Parameters:
Name Type Description zoomLevel
integer Percentage you'd like the image to be sized to. - Source:
- image_viewer.js, line 463