Added configuration around the rotate left/right buttons. The default for showRotationControls is false to preserve existing functionality. Also added default tooltip strings for the buttons.

This version runts the tests fine locally using 'npm test'. It looks like the remote build was having a timeout issue which I couldn't reproduce.
This commit is contained in:
Grant Echols 2014-03-03 09:28:28 -07:00
parent e8697e5c19
commit 60da75aede
3 changed files with 38 additions and 27 deletions

View File

@ -336,6 +336,11 @@
* image and if the 'next' button will wrap to the first image when viewing * image and if the 'next' button will wrap to the first image when viewing
* the last image. * the last image.
* *
* @property {Boolean} [showRotationControl=false]
* If true then the rotate left/right controls will be displayed as part of the
* standard controls. This is also subject to the browser support for rotate
* (e.g. viewer.drawer.canRotate()).
*
* @property {Boolean} [showSequenceControl=true] * @property {Boolean} [showSequenceControl=true]
* If the viewer has been configured with a sequence of tile sources, then * If the viewer has been configured with a sequence of tile sources, then
* provide buttons for navigating forward and backward through the images. * provide buttons for navigating forward and backward through the images.
@ -807,6 +812,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
} }
}, },
navPrevNextWrap: false, navPrevNextWrap: false,
showRotationControl: false,
//DEVELOPER SETTINGS //DEVELOPER SETTINGS
debugMode: false, debugMode: false,

View File

@ -55,7 +55,9 @@ var I18N = {
ZoomIn: "Zoom in", ZoomIn: "Zoom in",
ZoomOut: "Zoom out", ZoomOut: "Zoom out",
NextPage: "Next page", NextPage: "Next page",
PreviousPage: "Previous page" PreviousPage: "Previous page",
RotateLeft: "Rotate left",
RotateRight: "Rotate right"
} }
}; };

View File

@ -1234,6 +1234,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
onBlur: onBlurHandler onBlur: onBlurHandler
})); }));
if (this.showRotationControl && this.drawer.canRotate()) {
buttons.push( this.rotateLeft = new $.Button({ buttons.push( this.rotateLeft = new $.Button({
element: this.rotateLeftButton ? $.getElement( this.rotateLeftButton ) : null, element: this.rotateLeftButton ? $.getElement( this.rotateLeftButton ) : null,
clickTimeThreshold: this.clickTimeThreshold, clickTimeThreshold: this.clickTimeThreshold,
@ -1262,6 +1263,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
onBlur: onBlurHandler onBlur: onBlurHandler
})); }));
}
if( useGroup ){ if( useGroup ){
this.buttons = new $.ButtonGroup({ this.buttons = new $.ButtonGroup({
buttons: buttons, buttons: buttons,