Merge remote-tracking branch 'cameronbaney/add-element-option-navigator' into patch-for-PR-1303

This commit is contained in:
Joe DF 2022-05-29 20:33:23 -04:00
commit 21146b6b2c

View File

@ -55,15 +55,16 @@ $.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 = 'navigator-' + $.now(); if( !options.id ){
this.element = $.makeNeutralElement( "div" ); options.id = 'navigator-' + $.now();
options.controlOptions = { this.element = $.makeNeutralElement( "div" );
anchor: $.ControlAnchor.TOP_RIGHT, options.controlOptions = {
attachToViewer: true, anchor: $.ControlAnchor.TOP_RIGHT,
autoFade: options.autoFade attachToViewer: true,
}; autoFade: options.autoFade
};
if( options.position ){ if( options.position ){
if( 'BOTTOM_RIGHT' === options.position ){ if( 'BOTTOM_RIGHT' === options.position ){
@ -81,17 +82,24 @@ $.Navigator = function( options ){
options.controlOptions.height = options.height; options.controlOptions.height = options.height;
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;
} else { } else {
this.element = document.getElementById( options.id ); this.element = options.element;
options.controlOptions = { options.controlOptions = {
anchor: $.ControlAnchor.NONE, anchor: $.ControlAnchor.NONE,
attachToViewer: false, attachToViewer: false,
autoFade: false autoFade: false
}; };
} }
this.element.id = options.id;
this.element.className += ' navigator'; this.element.className += ' navigator';
options = $.extend( true, { options = $.extend( true, {