events/onselectstart: Don't prevent default behaviour on form fields

Fixes #56.
This commit is contained in:
vieron
2012-10-07 21:36:58 +02:00
parent 5a3c382c8b
commit 5411836c88
+13 -4
View File
@@ -13,7 +13,8 @@
distance: 1,
limit: true,
offset_left: 0,
autoscroll: true
autoscroll: true,
ignore_dragging: ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON']
// ,drag: function(e){},
// start : function(e, ui){},
// stop : function(e){}
@@ -76,7 +77,7 @@
};
fn.events = function() {
this.$container.on('selectstart', this.on_select_start);
this.$container.on('selectstart', $.proxy(this.on_select_start, this));
this.$container.on(pointer_events.start, this.options.items, $.proxy(
this.drag_handler, this));
@@ -183,8 +184,7 @@
return;
}
if (node === 'INPUT' || node === 'TEXTAREA' || node === 'SELECT' ||
node === 'BUTTON') {
if (this.ignore_drag(e)) {
return;
}
@@ -306,6 +306,11 @@
fn.on_select_start = function(e) {
if (this.disabled) { return; }
if (this.ignore_drag(e)) {
return;
}
return false;
};
@@ -323,6 +328,10 @@
$.removeData(this.$container, 'drag');
};
fn.ignore_drag = function(event) {
return $.inArray(event.target.nodeName, this.options.ignore_dragging) >= 0;
};
//jQuery adapter
$.fn.drag = function ( options ) {
return this.each(function () {