mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-24 22:26:10 +03:00
Merge pull request #853 from altert/smallfix
Add Viewer.getOverlayById and Overlay.getBounds functions
This commit is contained in:
commit
cb1318de1f
@ -312,6 +312,14 @@
|
||||
this.placement = location instanceof $.Point ?
|
||||
placement :
|
||||
$.OverlayPlacement.TOP_LEFT;
|
||||
},
|
||||
/**
|
||||
* @function
|
||||
* @returns {OpenSeadragon.Rect} overlay bounds
|
||||
*/
|
||||
getBounds: function() {
|
||||
|
||||
return this.bounds.clone();
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -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 null if not found.
|
||||
* @method
|
||||
* @param {Element|String} element - A reference to the element or an
|
||||
* element id which represent the overlay content.
|
||||
* @return {OpenSeadragon.Overlay} the matching overlay or null if none found.
|
||||
*/
|
||||
getOverlayById: function( element ) {
|
||||
var i;
|
||||
|
||||
element = $.getElement( element );
|
||||
i = getOverlayIndex( this.currentOverlays, element );
|
||||
|
||||
if (i>=0) {
|
||||
return this.currentOverlays[i];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
},
|
||||
/**
|
||||
* Updates the sequence buttons.
|
||||
* @function OpenSeadragon.Viewer.prototype._updateSequenceButtons
|
||||
|
Loading…
Reference in New Issue
Block a user