Pass through resizable and draggable ui objects in dialog - partial fix for #5291

This commit is contained in:
Jörn Zaefferer 2010-03-05 17:47:06 +00:00
parent bf7f1352fd
commit eaeb580d82

View File

@ -331,19 +331,19 @@ $.widget("ui.dialog", {
cancel: '.ui-dialog-content, .ui-dialog-titlebar-close', cancel: '.ui-dialog-content, .ui-dialog-titlebar-close',
handle: '.ui-dialog-titlebar', handle: '.ui-dialog-titlebar',
containment: 'document', containment: 'document',
start: function(event) { start: function(event, ui) {
heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height(); heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height();
$(this).height($(this).height()).addClass("ui-dialog-dragging"); $(this).height($(this).height()).addClass("ui-dialog-dragging");
self._trigger('dragStart', event); self._trigger('dragStart', event, ui);
}, },
drag: function(event) { drag: function(event, ui) {
self._trigger('drag', event); self._trigger('drag', event, ui);
}, },
stop: function(event, ui) { stop: function(event, ui) {
options.position = [ui.position.left - doc.scrollLeft(), options.position = [ui.position.left - doc.scrollLeft(),
ui.position.top - doc.scrollTop()]; ui.position.top - doc.scrollTop()];
$(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag); $(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);
self._trigger('dragStop', event); self._trigger('dragStop', event, ui);
$.ui.dialog.overlay.resize(); $.ui.dialog.overlay.resize();
} }
}); });
@ -369,18 +369,18 @@ $.widget("ui.dialog", {
minWidth: options.minWidth, minWidth: options.minWidth,
minHeight: self._minHeight(), minHeight: self._minHeight(),
handles: resizeHandles, handles: resizeHandles,
start: function(event) { start: function(event, ui) {
$(this).addClass("ui-dialog-resizing"); $(this).addClass("ui-dialog-resizing");
self._trigger('resizeStart', event); self._trigger('resizeStart', event, ui);
}, },
resize: function(event) { resize: function(event, ui) {
self._trigger('resize', event); self._trigger('resize', event, ui);
}, },
stop: function(event) { stop: function(event, ui) {
$(this).removeClass("ui-dialog-resizing"); $(this).removeClass("ui-dialog-resizing");
options.height = $(this).height(); options.height = $(this).height();
options.width = $(this).width(); options.width = $(this).width();
self._trigger('resizeStop', event); self._trigger('resizeStop', event, ui);
$.ui.dialog.overlay.resize(); $.ui.dialog.overlay.resize();
} }
}) })