Skip to content

Commit

Permalink
Add support to add/remove layers and change their levels.
Browse files Browse the repository at this point in the history
  • Loading branch information
avandecreme committed Dec 9, 2013
1 parent 58da998 commit 0c2af65
Show file tree
Hide file tree
Showing 4 changed files with 259 additions and 90 deletions.
22 changes: 22 additions & 0 deletions src/drawer.js
Expand Up @@ -91,6 +91,7 @@ $.Drawer = function( options ) {
collectionOverlays: {},

//configurable settings
opacity: $.DEFAULT_SETTINGS.opacity,
maxImageCacheCount: $.DEFAULT_SETTINGS.maxImageCacheCount,
imageLoaderLimit: $.DEFAULT_SETTINGS.imageLoaderLimit,
minZoomImageRatio: $.DEFAULT_SETTINGS.minZoomImageRatio,
Expand Down Expand Up @@ -143,6 +144,7 @@ $.Drawer = function( options ) {
this.canvas.style.width = "100%";
this.canvas.style.height = "100%";
this.canvas.style.position = "absolute";
$.setElementOpacity( this.canvas, this.opacity, true );

// explicit left-align
this.container.style.textAlign = "left";
Expand Down Expand Up @@ -340,6 +342,26 @@ $.Drawer.prototype = /** @lends OpenSeadragon.Drawer.prototype */{
return this;
},

/**
* Set the opacity of the drawer.
* @method
* @param {Number} opacity
* @return {OpenSeadragon.Drawer} Chainable.
*/
setOpacity: function( opacity ) {
this.opacity = opacity;
$.setElementOpacity( this.canvas, this.opacity, true );
return this;
},

/**
* Get the opacity of the drawer.
* @method
* @returns {Number}
*/
getOpacity: function() {
return this.opacity;
},

/**
* Returns whether the Drawer is scheduled for an update at the
Expand Down
6 changes: 6 additions & 0 deletions src/openseadragon.js
Expand Up @@ -190,6 +190,9 @@
* Zoom level to use when image is first opened or the home button is clicked.
* If 0, adjusts to fit viewer.
*
* @property {Number} [opacity=1]
* Opacity of the drawer (1=opaque, 0=transparent)
*
* @property {Number} [degrees=0]
* Initial rotation.
*
Expand Down Expand Up @@ -715,6 +718,9 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
// INITIAL ROTATION
degrees: 0,

// APPEARANCE
opacity: 1,

//REFERENCE STRIP SETTINGS
showReferenceStrip: false,
referenceStripScroll: 'horizontal',
Expand Down

0 comments on commit 0c2af65

Please sign in to comment.