|
66 | 66 | onCancel: function ($item, container, _super) { |
67 | 67 | }, |
68 | 68 | // Executed at the beginning of a mouse move event. |
69 | | - // The Placeholder has not been moved yet |
| 69 | + // The Placeholder has not been moved yet. |
70 | 70 | onDrag: function ($item, position, _super) { |
71 | 71 | $item.css(position) |
72 | 72 | }, |
|
88 | 88 | $item.removeClass("dragged").removeAttr("style") |
89 | 89 | $("body").removeClass("dragging") |
90 | 90 | }, |
| 91 | + // Called on mousedown. |
| 92 | + onMousedown: function($item, event, _super) { |
| 93 | + event.preventDefault() |
| 94 | + }, |
91 | 95 | // Template for the placeholder. Can be any valid jQuery input |
92 | 96 | // e.g. a string, a DOM element |
93 | 97 | placeholder: '<li class="placeholder"/>', |
|
241 | 245 | this.itemContainer = itemContainer |
242 | 246 |
|
243 | 247 | this.setPointer(e) |
| 248 | + |
| 249 | + this.options.onMousedown(this.item, e, groupDefaults.onMousedown) |
244 | 250 | }, |
245 | 251 | drag: function (e) { |
246 | 252 | if(!this.dragging){ |
|
431 | 437 | Container.prototype = { |
432 | 438 | dragInit: function (e) { |
433 | 439 | var rootGroup = this.rootGroup |
434 | | - if(rootGroup.item || |
435 | | - e.which !== 1 || |
436 | | - !this.options.drag || |
437 | | - $(e.target).is(this.options.exclude)) |
438 | | - return; |
439 | | - |
440 | | - e.preventDefault() |
441 | 440 |
|
442 | | - rootGroup.dragInit(e, this) |
| 441 | + if( !rootGroup.item && |
| 442 | + e.which === 1 && |
| 443 | + this.options.drag && |
| 444 | + !$(e.target).is(this.options.exclude)) |
| 445 | + rootGroup.dragInit(e, this) |
443 | 446 | }, |
444 | 447 | searchValidTarget: function (pointer, lastPointer) { |
445 | 448 | var distances = sortByDistanceDesc(this.getItemDimensions(), |
|
0 commit comments