fix(gridster): custom ignore_dragging overwrites the default value

This commit is contained in:
vieron
2014-06-25 23:24:53 +02:00
parent 21a294cf29
commit 6bcfa6e16e
2 changed files with 15 additions and 5 deletions
+3
View File
@@ -62,6 +62,9 @@
* the mouse must move before dragging should start.
* @param {Boolean} [options.limit] Constrains dragging to the width of
* the container
* @param {Object|Function} [options.ignore_dragging] Array of node names
* that sould not trigger dragging, by default is `['INPUT', 'TEXTAREA',
* 'SELECT', 'BUTTON']`. If a function is used return true to ignore dragging.
* @param {offset_left} [options.offset_left] Offset added to the item
* that is being dragged.
* @param {Number} [options.drag] Executes a callback when the mouse is
+12 -5
View File
@@ -43,7 +43,8 @@
collision: {},
draggable: {
items: '.gs-w',
distance: 4
distance: 4,
ignore_dragging: Draggable.defaults.ignore_dragging.slice(0)
},
resize: {
enabled: false,
@@ -102,8 +103,10 @@
* @param {Object} [options.draggable] An Object with all options for
* Draggable class you want to overwrite. See Draggable docs for more
* info.
* @param {Object} [options.resize] An Object with resize config
* options.
* @param {Object|Function} [options.draggable.ignore_dragging] Note that
* if you use a Function, and resize is enabled, you should ignore the
* resize handlers manually (options.resize.handle_class).
* @param {Object} [options.resize] An Object with resize config options.
* @param {Boolean} [options.resize.enabled] Set to true to enable
* resizing.
* @param {Array} [options.resize.axes] Axes in which widgets can be
@@ -943,8 +946,6 @@
offset_top: this.options.widget_margins[1],
container_width: this.cols * this.min_widget_width,
limit: true,
ignore_dragging: ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON',
'.' + this.options.resize.handle_class],
start: function(event, ui) {
self.$widgets.filter('.player-revert')
.removeClass('player-revert');
@@ -1014,6 +1015,12 @@
this.resize_handle_tpl = $.map(axes, function(type) {
return handle_tpl.replace('{type}', type);
}).join('');
if ($.isArray(this.options.draggable.ignore_dragging)) {
this.options.draggable.ignore_dragging.push(
'.' + this.resize_handle_class);
}
return this;
};