Skip to content

Commit

Permalink
Dialog: Fixed #3389: Non-draggable dialogs shouldn't instantiate drag…
Browse files Browse the repository at this point in the history
…gables.
  • Loading branch information
scottgonzalez committed Sep 14, 2008
1 parent 8bd855a commit 608cab6
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions ui/ui.dialog.js
Expand Up @@ -111,26 +111,7 @@ $.widget("ui.dialog", {
$.ui.disableSelection(this); $.ui.disableSelection(this);
}); });


if ($.fn.draggable) { (options.draggable && $.fn.draggable && this._makeDraggable());
uiDialog.draggable({
cancel: '.ui-dialog-content',
helper: options.dragHelper,
handle: '.ui-dialog-titlebar',
start: function() {
self._moveToTop();
(options.dragStart && options.dragStart.apply(self.element[0], arguments));
},
drag: function() {
(options.drag && options.drag.apply(self.element[0], arguments));
},
stop: function() {
(options.dragStop && options.dragStop.apply(self.element[0], arguments));
$.ui.dialog.overlay.resize();
}
});
(options.draggable || uiDialog.draggable('disable'));
}

(options.resizable && $.fn.resizable && this._makeResizable()); (options.resizable && $.fn.resizable && this._makeResizable());


this._createButtons(options.buttons); this._createButtons(options.buttons);
Expand Down Expand Up @@ -171,14 +152,38 @@ $.widget("ui.dialog", {
}); });
}, },


_makeDraggable: function() {
var self = this,
options = this.options;

this.uiDialog.draggable({
cancel: '.ui-dialog-content',
helper: options.dragHelper,
handle: '.ui-dialog-titlebar',
start: function() {
self._moveToTop();
(options.dragStart && options.dragStart.apply(self.element[0], arguments));
},
drag: function() {
(options.drag && options.drag.apply(self.element[0], arguments));
},
stop: function() {
(options.dragStop && options.dragStop.apply(self.element[0], arguments));
$.ui.dialog.overlay.resize();
}
});
},

_setData: function(key, value){ _setData: function(key, value){
(setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value)); (setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value));
switch (key) { switch (key) {
case "buttons": case "buttons":
this._createButtons(value); this._createButtons(value);
break; break;
case "draggable": case "draggable":
this.uiDialog.draggable(value ? 'enable' : 'disable'); (value
? this._makeDraggable()
: this.uiDialog.draggable('destroy'));
break; break;
case "height": case "height":
this.uiDialog.height(value); this.uiDialog.height(value);
Expand Down

0 comments on commit 608cab6

Please sign in to comment.