mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16:10 +03:00
commit
d956b2ae9d
@ -45,7 +45,9 @@
|
|||||||
* @memberof OpenSeadragon
|
* @memberof OpenSeadragon
|
||||||
* @extends OpenSeadragon.Viewer
|
* @extends OpenSeadragon.Viewer
|
||||||
* @extends OpenSeadragon.EventSource
|
* @extends OpenSeadragon.EventSource
|
||||||
* @param {Object} options
|
* @param {Object} options - Navigator options
|
||||||
|
* @param {Element} [options.element] - An element to use for the navigator.
|
||||||
|
* @param {String} [options.id] - Id of the element to use for the navigator. However, this is ignored if {@link options.element} is provided.
|
||||||
*/
|
*/
|
||||||
$.Navigator = function( options ){
|
$.Navigator = function( options ){
|
||||||
|
|
||||||
@ -55,8 +57,31 @@ $.Navigator = function( options ){
|
|||||||
navigatorSize;
|
navigatorSize;
|
||||||
|
|
||||||
//We may need to create a new element and id if they did not
|
//We may need to create a new element and id if they did not
|
||||||
//provide the id for the existing element
|
//provide the id for the existing element or the element itself
|
||||||
if( !options.id ){
|
if( options.element || options.id ){
|
||||||
|
if ( options.element ) {
|
||||||
|
if ( options.id ){
|
||||||
|
$.console.warn("Given option.id for Navigator was ignored since option.element was provided and is being used instead.");
|
||||||
|
} else {
|
||||||
|
// Don't overwrite the element's id if it has one already
|
||||||
|
if ( options.element.id ) {
|
||||||
|
options.id = options.element.id;
|
||||||
|
} else {
|
||||||
|
options.id = 'navigator-' + $.now();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.element = options.element;
|
||||||
|
} else {
|
||||||
|
this.element = document.getElementById( options.id );
|
||||||
|
}
|
||||||
|
|
||||||
|
options.controlOptions = {
|
||||||
|
anchor: $.ControlAnchor.NONE,
|
||||||
|
attachToViewer: false,
|
||||||
|
autoFade: false
|
||||||
|
};
|
||||||
|
} else {
|
||||||
options.id = 'navigator-' + $.now();
|
options.id = 'navigator-' + $.now();
|
||||||
this.element = $.makeNeutralElement( "div" );
|
this.element = $.makeNeutralElement( "div" );
|
||||||
options.controlOptions = {
|
options.controlOptions = {
|
||||||
@ -82,14 +107,6 @@ $.Navigator = function( options ){
|
|||||||
options.controlOptions.width = options.width;
|
options.controlOptions.width = options.width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
this.element = document.getElementById( options.id );
|
|
||||||
options.controlOptions = {
|
|
||||||
anchor: $.ControlAnchor.NONE,
|
|
||||||
attachToViewer: false,
|
|
||||||
autoFade: false
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
this.element.id = options.id;
|
this.element.id = options.id;
|
||||||
this.element.className += ' navigator';
|
this.element.className += ' navigator';
|
||||||
|
Loading…
Reference in New Issue
Block a user