Add CSS configuration options for the navigator minimap

This patch adds CSS configuration options for the navigator minimap, namely:
- background color
- opacity
- outside border color
- display region border color

If unspecified, the previous default values are kept as default as not to break previous implementations.
This commit is contained in:
evilricio 2018-06-14 17:38:30 +01:00
parent cd0a4aee16
commit 6c2c5ba498
3 changed files with 29 additions and 5 deletions

View File

@ -110,7 +110,11 @@ $.Navigator = function( options ){
animationTime: 0, animationTime: 0,
autoResize: options.autoResize, autoResize: options.autoResize,
// prevent resizing the navigator from adding unwanted space around the image // prevent resizing the navigator from adding unwanted space around the image
minZoomImageRatio: 1.0 minZoomImageRatio: 1.0,
background: options.background,
opacity: options.opacity,
borderColor: options.borderColor,
displayRegionColor: options.displayRegionColor
}); });
options.minPixelRatio = this.minPixelRatio = viewer.minPixelRatio; options.minPixelRatio = this.minPixelRatio = viewer.minPixelRatio;
@ -127,10 +131,10 @@ $.Navigator = function( options ){
if ( options.controlOptions.anchor != $.ControlAnchor.NONE ) { if ( options.controlOptions.anchor != $.ControlAnchor.NONE ) {
(function( style, borderWidth ){ (function( style, borderWidth ){
style.margin = '0px'; style.margin = '0px';
style.border = borderWidth + 'px solid #555'; style.border = borderWidth + 'px solid ' + options.borderColor;
style.padding = '0px'; style.padding = '0px';
style.background = '#000'; style.background = options.background;
style.opacity = 0.8; style.opacity = options.opacity;
style.overflow = 'hidden'; style.overflow = 'hidden';
}( this.element.style, this.borderWidth)); }( this.element.style, this.borderWidth));
} }
@ -145,7 +149,7 @@ $.Navigator = function( options ){
style.left = '0px'; style.left = '0px';
style.fontSize = '0px'; style.fontSize = '0px';
style.overflow = 'hidden'; style.overflow = 'hidden';
style.border = borderWidth + 'px solid #900'; style.border = borderWidth + 'px solid ' + options.displayRegionColor;
style.margin = '0px'; style.margin = '0px';
style.padding = '0px'; style.padding = '0px';
//TODO: IE doesnt like this property being set //TODO: IE doesnt like this property being set

View File

@ -419,6 +419,18 @@
* @property {Boolean} [navigatorRotate=true] * @property {Boolean} [navigatorRotate=true]
* If true, the navigator will be rotated together with the viewer. * If true, the navigator will be rotated together with the viewer.
* *
* @property {String} [navigatorBackground='#000']
* Specifies the background color of the navigator minimap
*
* @property {Number} [navigatorOpacity=0.8]
* Specifies the opacity of the navigator minimap.
*
* @property {String} [navigatorBorderColor='#555']
* Specifies the border color of the navigator minimap
*
* @property {String} [navigatorDisplayRegionColor='#900']
* Specifies the border color of the display region rectangle of the navigator minimap
*
* @property {Number} [controlsFadeDelay=2000] * @property {Number} [controlsFadeDelay=2000]
* The number of milliseconds to wait once the user has stopped interacting * The number of milliseconds to wait once the user has stopped interacting
* with the interface before begining to fade the controls. Assumes * with the interface before begining to fade the controls. Assumes
@ -1151,6 +1163,10 @@ function OpenSeadragon( options ){
navigatorAutoResize: true, navigatorAutoResize: true,
navigatorAutoFade: true, navigatorAutoFade: true,
navigatorRotate: true, navigatorRotate: true,
navigatorBackground: '#000',
navigatorOpacity: 0.8,
navigatorBorderColor: '#555',
navigatorDisplayRegionColor: '#900',
// INITIAL ROTATION // INITIAL ROTATION
degrees: 0, degrees: 0,

View File

@ -429,6 +429,10 @@ $.Viewer = function( options ) {
prefixUrl: this.prefixUrl, prefixUrl: this.prefixUrl,
viewer: this, viewer: this,
navigatorRotate: this.navigatorRotate, navigatorRotate: this.navigatorRotate,
background: this.navigatorBackground,
opacity: this.navigatorOpacity,
borderColor: this.navigatorBorderColor,
displayRegionColor: this.navigatorDisplayRegionColor,
crossOriginPolicy: this.crossOriginPolicy crossOriginPolicy: this.crossOriginPolicy
}); });
} }