From 5e0e8005d67dba110f640c305163e6686494ecf9 Mon Sep 17 00:00:00 2001 From: Grant Echols Date: Mon, 3 Mar 2014 11:14:09 -0700 Subject: [PATCH] Tuned the configuration around the rotate left/right to work when the drawer is instantiated. --- src/viewer.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/viewer.js b/src/viewer.js index 56990624..cd4b5614 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -1234,7 +1234,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, onBlur: onBlurHandler })); - if (this.showRotationControl && this.drawer.canRotate()) { + if (this.showRotationControl) { buttons.push( this.rotateLeft = new $.Button({ element: this.rotateLeftButton ? $.getElement( this.rotateLeftButton ) : null, clickTimeThreshold: this.clickTimeThreshold, @@ -1503,6 +1503,21 @@ function openTileSource( viewer, source ) { debugGridColor: _this.debugGridColor }); + // Now that we have a drawer, see if it supports rotate. If not we need to remove the rotate buttons + if (!_this.drawer.canRotate()) { + // Disable/remove the rotate left/right buttons since they aren't supported + if (_this.rotateLeft) { + i = _this.buttons.buttons.indexOf(_this.rotateLeft); + _this.buttons.buttons.splice(i, 1); + _this.buttons.element.removeChild(_this.rotateLeft.element); + } + if (_this.rotateRight) { + i = _this.buttons.buttons.indexOf(_this.rotateRight); + _this.buttons.buttons.splice(i, 1); + _this.buttons.element.removeChild(_this.rotateRight.element); + } + } + //Instantiate a navigator if configured if ( _this.showNavigator && !_this.collectionMode ){ // Note: By passing the fully parsed source, the navigator doesn't