fix inconsistent open-close braces, add warn when using element even when id provided

This commit is contained in:
Joe DF 2022-05-29 20:53:11 -04:00
parent 21146b6b2c
commit d4dfcd2288

View File

@ -57,14 +57,16 @@ $.Navigator = function( options ){
//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 or the element itself //provide the id for the existing element or the element itself
if( !options.element ){ if( !options.element ){
if( !options.id ){ if (!options.id) {
options.id = 'navigator-' + $.now(); options.id = 'navigator-' + $.now();
this.element = $.makeNeutralElement( "div" ); }
options.controlOptions = {
anchor: $.ControlAnchor.TOP_RIGHT, this.element = $.makeNeutralElement( "div" );
attachToViewer: true, options.controlOptions = {
autoFade: options.autoFade anchor: $.ControlAnchor.TOP_RIGHT,
}; attachToViewer: true,
autoFade: options.autoFade
};
if( options.position ){ if( options.position ){
if( 'BOTTOM_RIGHT' === options.position ){ if( 'BOTTOM_RIGHT' === options.position ){
@ -94,6 +96,8 @@ $.Navigator = function( options ){
this.element.id = options.id; this.element.id = options.id;
} else { } else {
this.element = options.element; this.element = options.element;
$.console.warn("Given option.id for Navigator was ignored since option.element was provided and is being used instead.");
options.controlOptions = { options.controlOptions = {
anchor: $.ControlAnchor.NONE, anchor: $.ControlAnchor.NONE,
attachToViewer: false, attachToViewer: false,