diff --git a/src/overlay.js b/src/overlay.js index 41f8b9be..a2a5b1a3 100644 --- a/src/overlay.js +++ b/src/overlay.js @@ -312,6 +312,14 @@ this.placement = location instanceof $.Point ? placement : $.OverlayPlacement.TOP_LEFT; + }, + /** + * @function + * @returns {OpenSeadragon.Rect} overlay bounds + */ + getBounds: function() { + + return this.bounds; } }; diff --git a/src/viewer.js b/src/viewer.js index b1342e88..8a2e5b0a 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -1944,7 +1944,28 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, this.raiseEvent( 'clear-overlay', {} ); return this; }, + + /** + * Finds an overlay identified by the reference element or element id + * and returns it as an object, return false if not found. + * @method + * @param {Element|String} element - A reference to the element or an + * element id which represent the ovelay content to be removed. + * @return {OpenSeadragon.Overlay} Chainable. + */ + getOverlayById: function( element ) { + var i; + element = $.getElement( element ); + i = getOverlayIndex( this.currentOverlays, element ); + + if (i>=0) { + return this.currentOverlays[i]; + } else { + return false; + } + + }, /** * Updates the sequence buttons. * @function OpenSeadragon.Viewer.prototype._updateSequenceButtons