diff --git a/src/openseadragon.js b/src/openseadragon.js index 9ee18112..7e3c8366 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -336,6 +336,11 @@ * image and if the 'next' button will wrap to the first image when viewing * 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] * If the viewer has been configured with a sequence of tile sources, then * provide buttons for navigating forward and backward through the images. @@ -807,6 +812,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){ } }, navPrevNextWrap: false, + showRotationControl: false, //DEVELOPER SETTINGS debugMode: false, diff --git a/src/strings.js b/src/strings.js index e6cf8352..03f4ed42 100644 --- a/src/strings.js +++ b/src/strings.js @@ -55,7 +55,9 @@ var I18N = { ZoomIn: "Zoom in", ZoomOut: "Zoom out", NextPage: "Next page", - PreviousPage: "Previous page" + PreviousPage: "Previous page", + RotateLeft: "Rotate left", + RotateRight: "Rotate right" } }; diff --git a/src/viewer.js b/src/viewer.js index ca20ca98..56990624 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -1234,33 +1234,36 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, onBlur: onBlurHandler })); - buttons.push( this.rotateLeft = new $.Button({ - element: this.rotateLeftButton ? $.getElement( this.rotateLeftButton ) : null, - clickTimeThreshold: this.clickTimeThreshold, - clickDistThreshold: this.clickDistThreshold, - tooltip: $.getString( "Tooltips.RotateLeft" ), - srcRest: resolveUrl( this.prefixUrl, navImages.rotateleft.REST ), - srcGroup: resolveUrl( this.prefixUrl, navImages.rotateleft.GROUP ), - srcHover: resolveUrl( this.prefixUrl, navImages.rotateleft.HOVER ), - srcDown: resolveUrl( this.prefixUrl, navImages.rotateleft.DOWN ), - onRelease: onRotateLeftHandler, - onFocus: onFocusHandler, - onBlur: onBlurHandler - })); + if (this.showRotationControl && this.drawer.canRotate()) { + buttons.push( this.rotateLeft = new $.Button({ + element: this.rotateLeftButton ? $.getElement( this.rotateLeftButton ) : null, + clickTimeThreshold: this.clickTimeThreshold, + clickDistThreshold: this.clickDistThreshold, + tooltip: $.getString( "Tooltips.RotateLeft" ), + srcRest: resolveUrl( this.prefixUrl, navImages.rotateleft.REST ), + srcGroup: resolveUrl( this.prefixUrl, navImages.rotateleft.GROUP ), + srcHover: resolveUrl( this.prefixUrl, navImages.rotateleft.HOVER ), + srcDown: resolveUrl( this.prefixUrl, navImages.rotateleft.DOWN ), + onRelease: onRotateLeftHandler, + onFocus: onFocusHandler, + onBlur: onBlurHandler + })); - buttons.push( this.rotateRight = new $.Button({ - element: this.rotateRightButton ? $.getElement( this.rotateRightButton ) : null, - clickTimeThreshold: this.clickTimeThreshold, - clickDistThreshold: this.clickDistThreshold, - tooltip: $.getString( "Tooltips.RotateRight" ), - srcRest: resolveUrl( this.prefixUrl, navImages.rotateright.REST ), - srcGroup: resolveUrl( this.prefixUrl, navImages.rotateright.GROUP ), - srcHover: resolveUrl( this.prefixUrl, navImages.rotateright.HOVER ), - srcDown: resolveUrl( this.prefixUrl, navImages.rotateright.DOWN ), - onRelease: onRotateRightHandler, - onFocus: onFocusHandler, - onBlur: onBlurHandler - })); + buttons.push( this.rotateRight = new $.Button({ + element: this.rotateRightButton ? $.getElement( this.rotateRightButton ) : null, + clickTimeThreshold: this.clickTimeThreshold, + clickDistThreshold: this.clickDistThreshold, + tooltip: $.getString( "Tooltips.RotateRight" ), + srcRest: resolveUrl( this.prefixUrl, navImages.rotateright.REST ), + srcGroup: resolveUrl( this.prefixUrl, navImages.rotateright.GROUP ), + srcHover: resolveUrl( this.prefixUrl, navImages.rotateright.HOVER ), + srcDown: resolveUrl( this.prefixUrl, navImages.rotateright.DOWN ), + onRelease: onRotateRightHandler, + onFocus: onFocusHandler, + onBlur: onBlurHandler + })); + + } if( useGroup ){ this.buttons = new $.ButtonGroup({