sometimes a dialog's size was stuck after moving it around

This commit is contained in:
fkloft
2015-10-14 21:08:59 +02:00
parent 95acdd773e
commit 99e6cc57ef

View File

@ -93,6 +93,15 @@ window.dialog = function(options) {
} }
} }
// there seems to be a bug where width/height are set to a fixed value after moving a dialog
function sizeFix() {
if(dialog.data('collapsed')) return;
var options = dialog.dialog('option');
dialog.dialog('option', 'height', options.height);
dialog.dialog('option', 'width', options.width);
}
// Create the window, appending a div to the body // Create the window, appending a div to the body
$('body').append('<div id="' + id + '"></div>'); $('body').append('<div id="' + id + '"></div>');
var dialog = $(jqID).dialog($.extend(true, { var dialog = $(jqID).dialog($.extend(true, {
@ -140,7 +149,8 @@ window.dialog = function(options) {
var button = dialog.find('.ui-dialog-titlebar-button-collapse'); var button = dialog.find('.ui-dialog-titlebar-button-collapse');
// Slide toggle // Slide toggle
$(selector).slideToggle({duration: window.DIALOG_SLIDE_DURATION}); $(this).css('height', '');
$(selector).slideToggle({duration: window.DIALOG_SLIDE_DURATION, complete: sizeFix});
if(collapsed) { if(collapsed) {
$(button).removeClass('ui-dialog-titlebar-button-collapse-collapsed'); $(button).removeClass('ui-dialog-titlebar-button-collapse-collapsed');
@ -214,6 +224,8 @@ window.dialog = function(options) {
} }
}, options)); }, options));
dialog.on('dialogdragstop dialogresizestop', sizeFix);
// Set HTML and IDs // Set HTML and IDs
dialog.html(html); dialog.html(html);
dialog.data('id', id); dialog.data('id', id);