Created a new extension : 'extended-toolbar.js' #44
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This extension adds a new toolbar that improves access to several IIPMooViewer functions : annotation creation, zoom, rotation, reset view, export image of current view, etc.
A demo page 'index-extended-toolbar-demo.html' shows an example of a viewer with the extended toolbar extension loaded. It's still necessary to modify the lines
var server = '/fcgi-bin/iipsrv.fcgi';
and
var image = '/path/to/image.tif';
to match your server and image.
The buttons to be included in the toolbar are simply set in an array of strings where each string correspond to a button. The accepted strings are :
newAnnotation // old method to create annotation
drawNewAnnotation // new method to create annotation - coming soon...
rotateclockwise
rotateanticlockwise
toggleNavigationWindow
toggleAnnotations
getRegionalURL
zoomIn
zoomOut
reset
toggleFullscreen
The extension is loaded with this line :
<script type="text/javascript" src="src/extended-toolbar.js"></script>The toolbar is inserted in a div with an id of your choice.
The toolbar can be displayed horizontally, vertically as well as inside or outside of the viewer.
To create a toolbar, you call the function createExtendedToolbar. The arguments are the div id (string), the position (inside/outside - string), the orientation (vertical/horizontal - string) and the buttons (see list above - string array).
Example : in order to create a vertical toolbar inside the viewer with buttons allowing to create annotations, and to rotate the image, one would declare :
var buttons = ['newAnnotation', 'rotateanticlockwise', 'rotateclockwise'];
var position = 'inside'; // inside or outside
var orientation = 'vertical'; // vertical or horizontal
iipmooviewer.createExtendedToolbar('mytoolbar', position, orientation, buttons);