|
67 | 67 | }, |
68 | 68 | // Executed before onDrop if placeholder is detached. |
69 | 69 | // This happens if pullPlaceholder is set to false and the drop occurs outside a container. |
70 | | - onCancel: function ($item, container, _super) { |
| 70 | + onCancel: function ($item, container, _super, event) { |
71 | 71 | }, |
72 | 72 | // Executed at the beginning of a mouse move event. |
73 | 73 | // The Placeholder has not been moved yet. |
74 | | - onDrag: function ($item, position, _super) { |
| 74 | + onDrag: function ($item, position, _super, event) { |
75 | 75 | $item.css(position) |
76 | 76 | }, |
77 | 77 | // Called after the drag has been started, |
78 | 78 | // that is the mouse button is beeing held down and |
79 | 79 | // the mouse is moving. |
80 | 80 | // The container is the closest initialized container. |
81 | 81 | // Therefore it might not be the container, that actually contains the item. |
82 | | - onDragStart: function ($item, container, _super) { |
| 82 | + onDragStart: function ($item, container, _super, event) { |
83 | 83 | $item.css({ |
84 | 84 | height: $item.height(), |
85 | 85 | width: $item.width() |
|
88 | 88 | $("body").addClass("dragging") |
89 | 89 | }, |
90 | 90 | // Called when the mouse button is beeing released |
91 | | - onDrop: function ($item, container, _super) { |
| 91 | + onDrop: function ($item, container, _super, event) { |
92 | 92 | $item.removeClass("dragged").removeAttr("style") |
93 | 93 | $("body").removeClass("dragging") |
94 | 94 | }, |
95 | 95 | // Called on mousedown. |
96 | | - onMousedown: function($item, event, _super) { |
| 96 | + onMousedown: function($item, _super, event) { |
97 | 97 | event.preventDefault() |
98 | 98 | }, |
99 | 99 | // Template for the placeholder. Can be any valid jQuery input |
|
234 | 234 |
|
235 | 235 | this.setPointer(e) |
236 | 236 |
|
237 | | - this.options.onMousedown(this.item, e, groupDefaults.onMousedown) |
| 237 | + this.options.onMousedown(this.item, groupDefaults.onMousedown, e) |
238 | 238 | } else { |
239 | 239 | this.toggleListeners('on', ['drop']) |
240 | 240 | } |
|
246 | 246 | if(!this.distanceMet(e)) |
247 | 247 | return |
248 | 248 |
|
249 | | - this.options.onDragStart(this.item, this.itemContainer, groupDefaults.onDragStart) |
| 249 | + this.options.onDragStart(this.item, this.itemContainer, groupDefaults.onDragStart, e) |
250 | 250 | this.item.before(this.placeholder) |
251 | 251 | this.dragging = true |
252 | 252 | } |
|
255 | 255 | // place item under the cursor |
256 | 256 | this.options.onDrag(this.item, |
257 | 257 | getRelativePosition(this.pointer, this.item.offsetParent()), |
258 | | - groupDefaults.onDrag) |
| 258 | + groupDefaults.onDrag, |
| 259 | + e) |
259 | 260 |
|
260 | 261 | var x = e.pageX, |
261 | 262 | y = e.pageY, |
|
276 | 277 | if(this.placeholder.closest("html")[0]) |
277 | 278 | this.placeholder.before(this.item).detach() |
278 | 279 | else |
279 | | - this.options.onCancel(this.item, this.itemContainer, groupDefaults.onCancel) |
| 280 | + this.options.onCancel(this.item, this.itemContainer, groupDefaults.onCancel, e) |
280 | 281 |
|
281 | | - this.options.onDrop(this.item, this.getContainer(this.item), groupDefaults.onDrop) |
| 282 | + this.options.onDrop(this.item, this.getContainer(this.item), groupDefaults.onDrop, e) |
282 | 283 |
|
283 | 284 | // cleanup |
284 | 285 | this.clearDimensions() |
|
0 commit comments