Skip to content

Commit 725fe9d

Browse files
committed
fix title bar width and height issue
fix title bar height bug fix title bar width issue fix title bar width issue Delete dialog.js fix title bar width issue fix title bar width issuec
1 parent d96af3d commit 725fe9d

File tree

1 file changed

+49
-45
lines changed

1 file changed

+49
-45
lines changed

ui/widgets/dialog.js

Lines changed: 49 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -447,51 +447,55 @@ $.widget( "ui.dialog", {
447447
this.close( event );
448448
}
449449
} );
450-
451-
this.uiDialogTitlebarMinimize = $( "<button type='button'></button>" )
452-
.button( {
453-
label: $( "<a>" ).text( this.options.minimizeText ).html(),
454-
icon: "ui-icon ui-icon-minimize",
455-
showLabel: false
456-
} )
457-
.appendTo( this.uiDialogTitlebar );
458-
this._addClass( this.uiDialogTitlebarMinimize, "ui-dialog-titlebar-minimize" );
459-
this._on( this.uiDialogTitlebarMinimize, {
460-
click: function( event ) {
461-
event.preventDefault();
462-
this.options.restoreWidth = this.options.width;
463-
this.options.restoreHeight = this.options.height;
464-
this.uiDialog.width(300);
465-
this.uiDialog.height(0);
466-
this.element.hide();
467-
this.uiDialogButtonPane.hide();
468-
this.uiDialogTitlebarRestore.button("enable");
469-
this.uiDialogTitlebarMinimize.button( "disable" );
470-
}
471-
} );
472-
this.uiDialogTitlebarRestore = $( "<button type='button'></button>" )
473-
.button( {
474-
label: $( "<a>" ).text( this.options.restoreText ).html(),
475-
icon: "ui-icon ui-icon-restore",
476-
showLabel: false
477-
} )
478-
.appendTo( this.uiDialogTitlebar );
479-
this._addClass( this.uiDialogTitlebarRestore, "ui-dialog-titlebar-restore" );
480-
this._on( this.uiDialogTitlebarRestore, {
481-
click: function( event ) {
482-
event.preventDefault();
483-
if(this.options.restoreWidth != undefined && this.options.restoreWidth != null && this.options.restoreWidth != "")
484-
this.uiDialog.width(this.options.restoreWidth);
485-
if(this.options.restoreHeight != undefined && this.options.restoreHeight != null && this.options.restoreHeight != "")
486-
this.uiDialog.height(this.options.restoreHeight);
487-
this.element.show();
488-
this.uiDialogButtonPane.show();
489-
this.uiDialogTitlebarMinimize.button( "enable" );
490-
this.uiDialogTitlebarRestore.button( "disable" );
491-
}
492-
} );
493-
this.uiDialogTitlebarRestore.button( "disable" );
494-
450+
451+
this.uiDialogTitlebarMinimize = $( "<button type='button'></button>" )
452+
.button( {
453+
label: $( "<a>" ).text( this.options.minimizeText ).html(),
454+
icon: "ui-icon ui-icon-minimize",
455+
showLabel: false
456+
} )
457+
.appendTo( this.uiDialogTitlebar );
458+
this._addClass( this.uiDialogTitlebarMinimize, "ui-dialog-titlebar-minimize" );
459+
this._on( this.uiDialogTitlebarMinimize, {
460+
click: function( event ) {
461+
event.preventDefault();
462+
this.options.restoreWidth = this.options.width;
463+
this.options.restoreHeight = this.options.height;
464+
this.uiDialog.width( this.uiDialogTitlebar.outerWidth() > 300 ? 300 : this.uiDialogTitlebar.outerWidth() );
465+
this.uiDialog.height( this.uiDialogTitlebar.outerHeight() );
466+
this.element.hide();
467+
this.uiDialogButtonPane.hide();
468+
this.uiDialogTitlebarRestore.button( "enable" );
469+
this.uiDialogTitlebarMinimize.button( "disable" );
470+
}
471+
} );
472+
this.uiDialogTitlebarRestore = $( "<button type='button'></button>" )
473+
.button( {
474+
label: $( "<a>" ).text( this.options.restoreText ).html(),
475+
icon: "ui-icon ui-icon-restore",
476+
showLabel: false
477+
} )
478+
.appendTo( this.uiDialogTitlebar );
479+
this._addClass( this.uiDialogTitlebarRestore, "ui-dialog-titlebar-restore" );
480+
this._on( this.uiDialogTitlebarRestore, {
481+
click: function( event ) {
482+
event.preventDefault();
483+
if ( this.options.restoreWidth !== undefined &&
484+
this.options.restoreWidth !== null && this.options.restoreWidth !== "" ) {
485+
this.uiDialog.width( this.options.restoreWidth );
486+
}
487+
if ( this.options.restoreHeight !== undefined &&
488+
this.options.restoreHeight !== null && this.options.restoreHeight !== "" ) {
489+
this.uiDialog.height( this.options.restoreHeight );
490+
}
491+
this.element.show();
492+
this.uiDialogButtonPane.show();
493+
this.uiDialogTitlebarMinimize.button( "enable" );
494+
this.uiDialogTitlebarRestore.button( "disable" );
495+
}
496+
} );
497+
this.uiDialogTitlebarRestore.button( "disable" );
498+
495499
uiDialogTitle = $( "<span>" ).uniqueId().prependTo( this.uiDialogTitlebar );
496500
this._addClass( uiDialogTitle, "ui-dialog-title" );
497501
this._title( uiDialogTitle );

0 commit comments

Comments
 (0)