jquery-ui-rails 3.0.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of jquery-ui-rails might be problematic. Click here for more details.
- data/History.md +10 -0
- data/README.md +1 -1
- data/Rakefile +4 -5
- data/lib/jquery/ui/rails/version.rb +1 -1
- data/vendor/assets/javascripts/jquery.ui.accordion.js +130 -290
- data/vendor/assets/javascripts/jquery.ui.autocomplete.js +30 -18
- data/vendor/assets/javascripts/jquery.ui.button.js +9 -8
- data/vendor/assets/javascripts/jquery.ui.core.js +19 -53
- data/vendor/assets/javascripts/jquery.ui.datepicker-be.js +23 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-fr-CA.js +23 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ky.js +24 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-nb.js +22 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-nn.js +22 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker.js +1076 -878
- data/vendor/assets/javascripts/jquery.ui.dialog.js +456 -547
- data/vendor/assets/javascripts/jquery.ui.draggable.js +317 -207
- data/vendor/assets/javascripts/jquery.ui.droppable.js +177 -100
- data/vendor/assets/javascripts/jquery.ui.effect-blind.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-bounce.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-clip.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-drop.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-explode.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-fade.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-fold.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-highlight.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-pulsate.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-scale.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-shake.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-slide.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.effect-transfer.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.effect.js +91 -99
- data/vendor/assets/javascripts/jquery.ui.menu.js +20 -9
- data/vendor/assets/javascripts/jquery.ui.mouse.js +25 -25
- data/vendor/assets/javascripts/jquery.ui.position.js +39 -59
- data/vendor/assets/javascripts/jquery.ui.progressbar.js +73 -33
- data/vendor/assets/javascripts/jquery.ui.resizable.js +461 -294
- data/vendor/assets/javascripts/jquery.ui.selectable.js +67 -51
- data/vendor/assets/javascripts/jquery.ui.slider.js +100 -95
- data/vendor/assets/javascripts/jquery.ui.sortable.js +411 -257
- data/vendor/assets/javascripts/jquery.ui.spinner.js +19 -5
- data/vendor/assets/javascripts/jquery.ui.tabs.js +47 -567
- data/vendor/assets/javascripts/jquery.ui.tooltip.js +14 -10
- data/vendor/assets/javascripts/jquery.ui.widget.js +33 -40
- data/vendor/assets/stylesheets/jquery.ui.accordion.css.erb +30 -8
- data/vendor/assets/stylesheets/jquery.ui.all.css.erb +2 -2
- data/vendor/assets/stylesheets/jquery.ui.autocomplete.css.erb +2 -5
- data/vendor/assets/stylesheets/jquery.ui.base.css.erb +2 -2
- data/vendor/assets/stylesheets/jquery.ui.button.css.erb +100 -26
- data/vendor/assets/stylesheets/jquery.ui.core.css.erb +65 -12
- data/vendor/assets/stylesheets/jquery.ui.datepicker.css.erb +166 -55
- data/vendor/assets/stylesheets/jquery.ui.dialog.css.erb +61 -14
- data/vendor/assets/stylesheets/jquery.ui.menu.css.erb +61 -14
- data/vendor/assets/stylesheets/jquery.ui.progressbar.css.erb +20 -4
- data/vendor/assets/stylesheets/jquery.ui.resizable.css.erb +70 -13
- data/vendor/assets/stylesheets/jquery.ui.selectable.css.erb +7 -3
- data/vendor/assets/stylesheets/jquery.ui.slider.css.erb +63 -15
- data/vendor/assets/stylesheets/jquery.ui.spinner.css.erb +52 -10
- data/vendor/assets/stylesheets/jquery.ui.tabs.css.erb +44 -10
- data/vendor/assets/stylesheets/jquery.ui.theme.css.erb +196 -38
- data/vendor/assets/stylesheets/jquery.ui.tooltip.css.erb +4 -6
- metadata +8 -3
@@ -3,10 +3,10 @@
|
|
3
3
|
//= require jquery.ui.mouse
|
4
4
|
|
5
5
|
/*!
|
6
|
-
* jQuery UI Draggable 1.
|
6
|
+
* jQuery UI Draggable 1.10.0
|
7
7
|
* http://jqueryui.com
|
8
8
|
*
|
9
|
-
* Copyright
|
9
|
+
* Copyright 2013 jQuery Foundation and other contributors
|
10
10
|
* Released under the MIT license.
|
11
11
|
* http://jquery.org/license
|
12
12
|
*
|
@@ -20,7 +20,7 @@
|
|
20
20
|
(function( $, undefined ) {
|
21
21
|
|
22
22
|
$.widget("ui.draggable", $.ui.mouse, {
|
23
|
-
version: "1.
|
23
|
+
version: "1.10.0",
|
24
24
|
widgetEventPrefix: "drag",
|
25
25
|
options: {
|
26
26
|
addClasses: true,
|
@@ -46,15 +46,24 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
46
46
|
snapMode: "both",
|
47
47
|
snapTolerance: 20,
|
48
48
|
stack: false,
|
49
|
-
zIndex: false
|
49
|
+
zIndex: false,
|
50
|
+
|
51
|
+
// callbacks
|
52
|
+
drag: null,
|
53
|
+
start: null,
|
54
|
+
stop: null
|
50
55
|
},
|
51
56
|
_create: function() {
|
52
57
|
|
53
|
-
if (this.options.helper
|
54
|
-
this.element[0].style.position =
|
55
|
-
|
56
|
-
(this.options.addClasses
|
57
|
-
|
58
|
+
if (this.options.helper === "original" && !(/^(?:r|a|f)/).test(this.element.css("position"))) {
|
59
|
+
this.element[0].style.position = "relative";
|
60
|
+
}
|
61
|
+
if (this.options.addClasses){
|
62
|
+
this.element.addClass("ui-draggable");
|
63
|
+
}
|
64
|
+
if (this.options.disabled){
|
65
|
+
this.element.addClass("ui-draggable-disabled");
|
66
|
+
}
|
58
67
|
|
59
68
|
this._mouseInit();
|
60
69
|
|
@@ -70,16 +79,18 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
70
79
|
var o = this.options;
|
71
80
|
|
72
81
|
// among others, prevent a drag on a resizable-handle
|
73
|
-
if (this.helper || o.disabled || $(event.target).
|
82
|
+
if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) {
|
74
83
|
return false;
|
84
|
+
}
|
75
85
|
|
76
86
|
//Quit if we're not on a valid handle
|
77
87
|
this.handle = this._getHandle(event);
|
78
|
-
if (!this.handle)
|
88
|
+
if (!this.handle) {
|
79
89
|
return false;
|
90
|
+
}
|
80
91
|
|
81
92
|
$(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
|
82
|
-
$(
|
93
|
+
$("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>")
|
83
94
|
.css({
|
84
95
|
width: this.offsetWidth+"px", height: this.offsetHeight+"px",
|
85
96
|
position: "absolute", opacity: "0.001", zIndex: 1000
|
@@ -105,8 +116,9 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
105
116
|
this._cacheHelperProportions();
|
106
117
|
|
107
118
|
//If ddmanager is used for droppables, set the global draggable
|
108
|
-
if($.ui.ddmanager)
|
119
|
+
if($.ui.ddmanager) {
|
109
120
|
$.ui.ddmanager.current = this;
|
121
|
+
}
|
110
122
|
|
111
123
|
/*
|
112
124
|
* - Position generation -
|
@@ -141,12 +153,13 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
141
153
|
this.originalPageX = event.pageX;
|
142
154
|
this.originalPageY = event.pageY;
|
143
155
|
|
144
|
-
//Adjust the mouse offset relative to the helper if
|
156
|
+
//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
|
145
157
|
(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
|
146
158
|
|
147
159
|
//Set a containment if given in the options
|
148
|
-
if(o.containment)
|
160
|
+
if(o.containment) {
|
149
161
|
this._setContainment();
|
162
|
+
}
|
150
163
|
|
151
164
|
//Trigger event + callbacks
|
152
165
|
if(this._trigger("start", event) === false) {
|
@@ -158,14 +171,17 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
158
171
|
this._cacheHelperProportions();
|
159
172
|
|
160
173
|
//Prepare the droppable offsets
|
161
|
-
if ($.ui.ddmanager && !o.dropBehaviour)
|
174
|
+
if ($.ui.ddmanager && !o.dropBehaviour) {
|
162
175
|
$.ui.ddmanager.prepareOffsets(this, event);
|
176
|
+
}
|
163
177
|
|
164
178
|
|
165
179
|
this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
|
166
180
|
|
167
181
|
//If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
|
168
|
-
if ( $.ui.ddmanager )
|
182
|
+
if ( $.ui.ddmanager ) {
|
183
|
+
$.ui.ddmanager.dragStart(this, event);
|
184
|
+
}
|
169
185
|
|
170
186
|
return true;
|
171
187
|
},
|
@@ -179,16 +195,22 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
179
195
|
//Call plugins and callbacks and use the resulting position if something is returned
|
180
196
|
if (!noPropagation) {
|
181
197
|
var ui = this._uiHash();
|
182
|
-
if(this._trigger(
|
198
|
+
if(this._trigger("drag", event, ui) === false) {
|
183
199
|
this._mouseUp({});
|
184
200
|
return false;
|
185
201
|
}
|
186
202
|
this.position = ui.position;
|
187
203
|
}
|
188
204
|
|
189
|
-
if(!this.options.axis || this.options.axis
|
190
|
-
|
191
|
-
|
205
|
+
if(!this.options.axis || this.options.axis !== "y") {
|
206
|
+
this.helper[0].style.left = this.position.left+"px";
|
207
|
+
}
|
208
|
+
if(!this.options.axis || this.options.axis !== "x") {
|
209
|
+
this.helper[0].style.top = this.position.top+"px";
|
210
|
+
}
|
211
|
+
if($.ui.ddmanager) {
|
212
|
+
$.ui.ddmanager.drag(this, event);
|
213
|
+
}
|
192
214
|
|
193
215
|
return false;
|
194
216
|
},
|
@@ -196,9 +218,13 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
196
218
|
_mouseStop: function(event) {
|
197
219
|
|
198
220
|
//If we are using droppables, inform the manager about the drop
|
199
|
-
var
|
200
|
-
|
221
|
+
var element,
|
222
|
+
that = this,
|
223
|
+
elementInDom = false,
|
224
|
+
dropped = false;
|
225
|
+
if ($.ui.ddmanager && !this.options.dropBehaviour) {
|
201
226
|
dropped = $.ui.ddmanager.drop(this, event);
|
227
|
+
}
|
202
228
|
|
203
229
|
//if a drop comes from outside (a sortable)
|
204
230
|
if(this.dropped) {
|
@@ -207,17 +233,17 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
207
233
|
}
|
208
234
|
|
209
235
|
//if the original element is no longer in the DOM don't bother to continue (see #8269)
|
210
|
-
|
236
|
+
element = this.element[0];
|
211
237
|
while ( element && (element = element.parentNode) ) {
|
212
|
-
if (element
|
238
|
+
if (element === document ) {
|
213
239
|
elementInDom = true;
|
214
240
|
}
|
215
241
|
}
|
216
|
-
if ( !elementInDom && this.options.helper === "original" )
|
242
|
+
if ( !elementInDom && this.options.helper === "original" ) {
|
217
243
|
return false;
|
244
|
+
}
|
218
245
|
|
219
|
-
if((this.options.revert
|
220
|
-
var that = this;
|
246
|
+
if((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
|
221
247
|
$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
|
222
248
|
if(that._trigger("stop", event) !== false) {
|
223
249
|
that._clear();
|
@@ -239,7 +265,9 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
239
265
|
});
|
240
266
|
|
241
267
|
//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
|
242
|
-
if( $.ui.ddmanager )
|
268
|
+
if( $.ui.ddmanager ) {
|
269
|
+
$.ui.ddmanager.dragStop(this, event);
|
270
|
+
}
|
243
271
|
|
244
272
|
return $.ui.mouse.prototype._mouseUp.call(this, event);
|
245
273
|
},
|
@@ -261,9 +289,11 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
261
289
|
var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
|
262
290
|
$(this.options.handle, this.element)
|
263
291
|
.find("*")
|
264
|
-
.
|
292
|
+
.addBack()
|
265
293
|
.each(function() {
|
266
|
-
if(this
|
294
|
+
if(this === event.target) {
|
295
|
+
handle = true;
|
296
|
+
}
|
267
297
|
});
|
268
298
|
|
269
299
|
return handle;
|
@@ -272,36 +302,38 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
272
302
|
|
273
303
|
_createHelper: function(event) {
|
274
304
|
|
275
|
-
var o = this.options
|
276
|
-
|
305
|
+
var o = this.options,
|
306
|
+
helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper === "clone" ? this.element.clone().removeAttr("id") : this.element);
|
277
307
|
|
278
|
-
if(!helper.parents(
|
279
|
-
helper.appendTo((o.appendTo
|
308
|
+
if(!helper.parents("body").length) {
|
309
|
+
helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo));
|
310
|
+
}
|
280
311
|
|
281
|
-
if(helper[0]
|
312
|
+
if(helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) {
|
282
313
|
helper.css("position", "absolute");
|
314
|
+
}
|
283
315
|
|
284
316
|
return helper;
|
285
317
|
|
286
318
|
},
|
287
319
|
|
288
320
|
_adjustOffsetFromHelper: function(obj) {
|
289
|
-
if (typeof obj
|
290
|
-
obj = obj.split(
|
321
|
+
if (typeof obj === "string") {
|
322
|
+
obj = obj.split(" ");
|
291
323
|
}
|
292
324
|
if ($.isArray(obj)) {
|
293
325
|
obj = {left: +obj[0], top: +obj[1] || 0};
|
294
326
|
}
|
295
|
-
if (
|
327
|
+
if ("left" in obj) {
|
296
328
|
this.offset.click.left = obj.left + this.margins.left;
|
297
329
|
}
|
298
|
-
if (
|
330
|
+
if ("right" in obj) {
|
299
331
|
this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
|
300
332
|
}
|
301
|
-
if (
|
333
|
+
if ("top" in obj) {
|
302
334
|
this.offset.click.top = obj.top + this.margins.top;
|
303
335
|
}
|
304
|
-
if (
|
336
|
+
if ("bottom" in obj) {
|
305
337
|
this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
|
306
338
|
}
|
307
339
|
},
|
@@ -316,14 +348,17 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
316
348
|
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
|
317
349
|
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
|
318
350
|
// the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
|
319
|
-
if(this.cssPosition
|
351
|
+
if(this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
|
320
352
|
po.left += this.scrollParent.scrollLeft();
|
321
353
|
po.top += this.scrollParent.scrollTop();
|
322
354
|
}
|
323
355
|
|
324
|
-
|
325
|
-
|
356
|
+
//This needs to be actually done for all browsers, since pageX/pageY includes this information
|
357
|
+
//Ugly IE fix
|
358
|
+
if((this.offsetParent[0] === document.body) ||
|
359
|
+
(this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
|
326
360
|
po = { top: 0, left: 0 };
|
361
|
+
}
|
327
362
|
|
328
363
|
return {
|
329
364
|
top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
|
@@ -334,7 +369,7 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
334
369
|
|
335
370
|
_getRelativeOffset: function() {
|
336
371
|
|
337
|
-
if(this.cssPosition
|
372
|
+
if(this.cssPosition === "relative") {
|
338
373
|
var p = this.element.position();
|
339
374
|
return {
|
340
375
|
top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
|
@@ -364,20 +399,30 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
364
399
|
|
365
400
|
_setContainment: function() {
|
366
401
|
|
367
|
-
var
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
o.containment
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
402
|
+
var over, c, ce,
|
403
|
+
o = this.options;
|
404
|
+
|
405
|
+
if(o.containment === "parent") {
|
406
|
+
o.containment = this.helper[0].parentNode;
|
407
|
+
}
|
408
|
+
if(o.containment === "document" || o.containment === "window") {
|
409
|
+
this.containment = [
|
410
|
+
o.containment === "document" ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
|
411
|
+
o.containment === "document" ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top,
|
412
|
+
(o.containment === "document" ? 0 : $(window).scrollLeft()) + $(o.containment === "document" ? document : window).width() - this.helperProportions.width - this.margins.left,
|
413
|
+
(o.containment === "document" ? 0 : $(window).scrollTop()) + ($(o.containment === "document" ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
|
414
|
+
];
|
415
|
+
}
|
416
|
+
|
417
|
+
if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor !== Array) {
|
418
|
+
c = $(o.containment);
|
419
|
+
ce = c[0];
|
420
|
+
|
421
|
+
if(!ce) {
|
422
|
+
return;
|
423
|
+
}
|
424
|
+
|
425
|
+
over = ($(ce).css("overflow") !== "hidden");
|
381
426
|
|
382
427
|
this.containment = [
|
383
428
|
(parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0),
|
@@ -387,7 +432,7 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
387
432
|
];
|
388
433
|
this.relative_container = c;
|
389
434
|
|
390
|
-
} else if(o.containment.constructor
|
435
|
+
} else if(o.containment.constructor === Array) {
|
391
436
|
this.containment = o.containment;
|
392
437
|
}
|
393
438
|
|
@@ -395,22 +440,25 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
395
440
|
|
396
441
|
_convertPositionTo: function(d, pos) {
|
397
442
|
|
398
|
-
if(!pos)
|
399
|
-
|
400
|
-
|
443
|
+
if(!pos) {
|
444
|
+
pos = this.position;
|
445
|
+
}
|
446
|
+
|
447
|
+
var mod = d === "absolute" ? 1 : -1,
|
448
|
+
scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
|
401
449
|
|
402
450
|
return {
|
403
451
|
top: (
|
404
|
-
pos.top
|
405
|
-
|
406
|
-
|
407
|
-
|
452
|
+
pos.top + // The absolute mouse position
|
453
|
+
this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
|
454
|
+
this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
|
455
|
+
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
|
408
456
|
),
|
409
457
|
left: (
|
410
|
-
pos.left // The absolute mouse position
|
411
|
-
|
412
|
-
|
413
|
-
|
458
|
+
pos.left + // The absolute mouse position
|
459
|
+
this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
|
460
|
+
this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
|
461
|
+
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
|
414
462
|
)
|
415
463
|
};
|
416
464
|
|
@@ -418,9 +466,12 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
418
466
|
|
419
467
|
_generatePosition: function(event) {
|
420
468
|
|
421
|
-
var
|
422
|
-
|
423
|
-
|
469
|
+
var containment, co, top, left,
|
470
|
+
o = this.options,
|
471
|
+
scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
|
472
|
+
scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName),
|
473
|
+
pageX = event.pageX,
|
474
|
+
pageY = event.pageY;
|
424
475
|
|
425
476
|
/*
|
426
477
|
* - Position constraining -
|
@@ -428,10 +479,9 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
428
479
|
*/
|
429
480
|
|
430
481
|
if(this.originalPosition) { //If we are not dragging yet, we won't check for options
|
431
|
-
var containment;
|
432
482
|
if(this.containment) {
|
433
483
|
if (this.relative_container){
|
434
|
-
|
484
|
+
co = this.relative_container.offset();
|
435
485
|
containment = [ this.containment[0] + co.left,
|
436
486
|
this.containment[1] + co.top,
|
437
487
|
this.containment[2] + co.left,
|
@@ -441,37 +491,45 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
441
491
|
containment = this.containment;
|
442
492
|
}
|
443
493
|
|
444
|
-
if(event.pageX - this.offset.click.left < containment[0])
|
445
|
-
|
446
|
-
|
447
|
-
if(event.pageY - this.offset.click.top
|
494
|
+
if(event.pageX - this.offset.click.left < containment[0]) {
|
495
|
+
pageX = containment[0] + this.offset.click.left;
|
496
|
+
}
|
497
|
+
if(event.pageY - this.offset.click.top < containment[1]) {
|
498
|
+
pageY = containment[1] + this.offset.click.top;
|
499
|
+
}
|
500
|
+
if(event.pageX - this.offset.click.left > containment[2]) {
|
501
|
+
pageX = containment[2] + this.offset.click.left;
|
502
|
+
}
|
503
|
+
if(event.pageY - this.offset.click.top > containment[3]) {
|
504
|
+
pageY = containment[3] + this.offset.click.top;
|
505
|
+
}
|
448
506
|
}
|
449
507
|
|
450
508
|
if(o.grid) {
|
451
509
|
//Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
|
452
|
-
|
453
|
-
pageY = containment ? (
|
510
|
+
top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
|
511
|
+
pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
|
454
512
|
|
455
|
-
|
456
|
-
pageX = containment ? (
|
513
|
+
left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
|
514
|
+
pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
|
457
515
|
}
|
458
516
|
|
459
517
|
}
|
460
518
|
|
461
519
|
return {
|
462
520
|
top: (
|
463
|
-
pageY
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
521
|
+
pageY - // The absolute mouse position
|
522
|
+
this.offset.click.top - // Click offset (relative to the element)
|
523
|
+
this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent
|
524
|
+
this.offset.parent.top + // The offsetParent's offset without borders (offset + border)
|
525
|
+
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
|
468
526
|
),
|
469
527
|
left: (
|
470
|
-
pageX
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
528
|
+
pageX - // The absolute mouse position
|
529
|
+
this.offset.click.left - // Click offset (relative to the element)
|
530
|
+
this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent
|
531
|
+
this.offset.parent.left + // The offsetParent's offset without borders (offset + border)
|
532
|
+
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
|
475
533
|
)
|
476
534
|
};
|
477
535
|
|
@@ -479,8 +537,9 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
479
537
|
|
480
538
|
_clear: function() {
|
481
539
|
this.helper.removeClass("ui-draggable-dragging");
|
482
|
-
if(this.helper[0]
|
483
|
-
|
540
|
+
if(this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
|
541
|
+
this.helper.remove();
|
542
|
+
}
|
484
543
|
this.helper = null;
|
485
544
|
this.cancelHelperRemoval = false;
|
486
545
|
},
|
@@ -490,13 +549,16 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
490
549
|
_trigger: function(type, event, ui) {
|
491
550
|
ui = ui || this._uiHash();
|
492
551
|
$.ui.plugin.call(this, type, [event, ui]);
|
493
|
-
|
552
|
+
//The absolute position has to be recalculated after plugins
|
553
|
+
if(type === "drag") {
|
554
|
+
this.positionAbs = this._convertPositionTo("absolute");
|
555
|
+
}
|
494
556
|
return $.Widget.prototype._trigger.call(this, type, event, ui);
|
495
557
|
},
|
496
558
|
|
497
559
|
plugins: {},
|
498
560
|
|
499
|
-
_uiHash: function(
|
561
|
+
_uiHash: function() {
|
500
562
|
return {
|
501
563
|
helper: this.helper,
|
502
564
|
position: this.position,
|
@@ -510,11 +572,11 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|
510
572
|
$.ui.plugin.add("draggable", "connectToSortable", {
|
511
573
|
start: function(event, ui) {
|
512
574
|
|
513
|
-
var inst = $(this).data("draggable"), o = inst.options,
|
575
|
+
var inst = $(this).data("ui-draggable"), o = inst.options,
|
514
576
|
uiSortable = $.extend({}, ui, { item: inst.element });
|
515
577
|
inst.sortables = [];
|
516
578
|
$(o.connectToSortable).each(function() {
|
517
|
-
var sortable = $.data(this,
|
579
|
+
var sortable = $.data(this, "ui-sortable");
|
518
580
|
if (sortable && !sortable.options.disabled) {
|
519
581
|
inst.sortables.push({
|
520
582
|
instance: sortable,
|
@@ -529,7 +591,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
|
529
591
|
stop: function(event, ui) {
|
530
592
|
|
531
593
|
//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
|
532
|
-
var inst = $(this).data("draggable"),
|
594
|
+
var inst = $(this).data("ui-draggable"),
|
533
595
|
uiSortable = $.extend({}, ui, { item: inst.element });
|
534
596
|
|
535
597
|
$.each(inst.sortables, function() {
|
@@ -540,8 +602,10 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
|
540
602
|
inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
|
541
603
|
this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
|
542
604
|
|
543
|
-
//The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert:
|
544
|
-
if(this.shouldRevert)
|
605
|
+
//The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: "valid/invalid"
|
606
|
+
if(this.shouldRevert) {
|
607
|
+
this.instance.options.revert = true;
|
608
|
+
}
|
545
609
|
|
546
610
|
//Trigger the stop of the sortable
|
547
611
|
this.instance._mouseStop(event);
|
@@ -549,8 +613,9 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
|
549
613
|
this.instance.options.helper = this.instance.options._helper;
|
550
614
|
|
551
615
|
//If the helper has been the original item, restore properties in the sortable
|
552
|
-
if(inst.options.helper
|
553
|
-
this.instance.currentItem.css({ top:
|
616
|
+
if(inst.options.helper === "original") {
|
617
|
+
this.instance.currentItem.css({ top: "auto", left: "auto" });
|
618
|
+
}
|
554
619
|
|
555
620
|
} else {
|
556
621
|
this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
|
@@ -562,21 +627,13 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
|
562
627
|
},
|
563
628
|
drag: function(event, ui) {
|
564
629
|
|
565
|
-
var inst = $(this).data("draggable"), that = this;
|
566
|
-
|
567
|
-
var checkPos = function(o) {
|
568
|
-
var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
|
569
|
-
var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
|
570
|
-
var itemHeight = o.height, itemWidth = o.width;
|
571
|
-
var itemTop = o.top, itemLeft = o.left;
|
630
|
+
var inst = $(this).data("ui-draggable"), that = this;
|
572
631
|
|
573
|
-
|
574
|
-
};
|
632
|
+
$.each(inst.sortables, function() {
|
575
633
|
|
576
|
-
|
634
|
+
var innermostIntersecting = false,
|
635
|
+
thisSortable = this;
|
577
636
|
|
578
|
-
var innermostIntersecting = false;
|
579
|
-
var thisSortable = this;
|
580
637
|
//Copy over some variables to allow calling the sortable's native _intersectsWith
|
581
638
|
this.instance.positionAbs = inst.positionAbs;
|
582
639
|
this.instance.helperProportions = inst.helperProportions;
|
@@ -588,11 +645,13 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
|
588
645
|
this.instance.positionAbs = inst.positionAbs;
|
589
646
|
this.instance.helperProportions = inst.helperProportions;
|
590
647
|
this.instance.offset.click = inst.offset.click;
|
591
|
-
if
|
592
|
-
|
593
|
-
|
648
|
+
if (this !== thisSortable &&
|
649
|
+
this.instance._intersectsWith(this.instance.containerCache) &&
|
650
|
+
$.ui.contains(thisSortable.instance.element[0], this.instance.element[0])
|
651
|
+
) {
|
594
652
|
innermostIntersecting = false;
|
595
|
-
|
653
|
+
}
|
654
|
+
return innermostIntersecting;
|
596
655
|
});
|
597
656
|
}
|
598
657
|
|
@@ -605,7 +664,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
|
605
664
|
//Now we fake the start of dragging for the sortable instance,
|
606
665
|
//by cloning the list group item, appending it to the sortable and using it as inst.currentItem
|
607
666
|
//We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
|
608
|
-
this.instance.currentItem = $(that).clone().removeAttr(
|
667
|
+
this.instance.currentItem = $(that).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item", true);
|
609
668
|
this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
|
610
669
|
this.instance.options.helper = function() { return ui.helper[0]; };
|
611
670
|
|
@@ -628,7 +687,9 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
|
628
687
|
}
|
629
688
|
|
630
689
|
//Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
|
631
|
-
if(this.instance.currentItem)
|
690
|
+
if(this.instance.currentItem) {
|
691
|
+
this.instance._mouseDrag(event);
|
692
|
+
}
|
632
693
|
|
633
694
|
} else {
|
634
695
|
|
@@ -643,20 +704,22 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
|
643
704
|
this.instance.options.revert = false;
|
644
705
|
|
645
706
|
// The out event needs to be triggered independently
|
646
|
-
this.instance._trigger(
|
707
|
+
this.instance._trigger("out", event, this.instance._uiHash(this.instance));
|
647
708
|
|
648
709
|
this.instance._mouseStop(event, true);
|
649
710
|
this.instance.options.helper = this.instance.options._helper;
|
650
711
|
|
651
712
|
//Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
|
652
713
|
this.instance.currentItem.remove();
|
653
|
-
if(this.instance.placeholder)
|
714
|
+
if(this.instance.placeholder) {
|
715
|
+
this.instance.placeholder.remove();
|
716
|
+
}
|
654
717
|
|
655
718
|
inst._trigger("fromSortable", event);
|
656
719
|
inst.dropped = false; //draggable revert needs that
|
657
720
|
}
|
658
721
|
|
659
|
-
}
|
722
|
+
}
|
660
723
|
|
661
724
|
});
|
662
725
|
|
@@ -664,158 +727,201 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
|
664
727
|
});
|
665
728
|
|
666
729
|
$.ui.plugin.add("draggable", "cursor", {
|
667
|
-
start: function(
|
668
|
-
var t = $(
|
669
|
-
if (t.css("cursor"))
|
730
|
+
start: function() {
|
731
|
+
var t = $("body"), o = $(this).data("ui-draggable").options;
|
732
|
+
if (t.css("cursor")) {
|
733
|
+
o._cursor = t.css("cursor");
|
734
|
+
}
|
670
735
|
t.css("cursor", o.cursor);
|
671
736
|
},
|
672
|
-
stop: function(
|
673
|
-
var o = $(this).data(
|
674
|
-
if (o._cursor)
|
737
|
+
stop: function() {
|
738
|
+
var o = $(this).data("ui-draggable").options;
|
739
|
+
if (o._cursor) {
|
740
|
+
$("body").css("cursor", o._cursor);
|
741
|
+
}
|
675
742
|
}
|
676
743
|
});
|
677
744
|
|
678
745
|
$.ui.plugin.add("draggable", "opacity", {
|
679
746
|
start: function(event, ui) {
|
680
|
-
var t = $(ui.helper), o = $(this).data(
|
681
|
-
if(t.css("opacity"))
|
682
|
-
|
747
|
+
var t = $(ui.helper), o = $(this).data("ui-draggable").options;
|
748
|
+
if(t.css("opacity")) {
|
749
|
+
o._opacity = t.css("opacity");
|
750
|
+
}
|
751
|
+
t.css("opacity", o.opacity);
|
683
752
|
},
|
684
753
|
stop: function(event, ui) {
|
685
|
-
var o = $(this).data(
|
686
|
-
if(o._opacity)
|
754
|
+
var o = $(this).data("ui-draggable").options;
|
755
|
+
if(o._opacity) {
|
756
|
+
$(ui.helper).css("opacity", o._opacity);
|
757
|
+
}
|
687
758
|
}
|
688
759
|
});
|
689
760
|
|
690
761
|
$.ui.plugin.add("draggable", "scroll", {
|
691
|
-
start: function(
|
692
|
-
var i = $(this).data("draggable");
|
693
|
-
if(i.scrollParent[0]
|
762
|
+
start: function() {
|
763
|
+
var i = $(this).data("ui-draggable");
|
764
|
+
if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") {
|
765
|
+
i.overflowOffset = i.scrollParent.offset();
|
766
|
+
}
|
694
767
|
},
|
695
|
-
drag: function(event
|
768
|
+
drag: function( event ) {
|
696
769
|
|
697
|
-
var i = $(this).data("draggable"), o = i.options, scrolled = false;
|
770
|
+
var i = $(this).data("ui-draggable"), o = i.options, scrolled = false;
|
698
771
|
|
699
|
-
if(i.scrollParent[0]
|
772
|
+
if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") {
|
700
773
|
|
701
|
-
if(!o.axis || o.axis
|
702
|
-
if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
|
774
|
+
if(!o.axis || o.axis !== "x") {
|
775
|
+
if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
|
703
776
|
i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
|
704
|
-
else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
|
777
|
+
} else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) {
|
705
778
|
i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
|
779
|
+
}
|
706
780
|
}
|
707
781
|
|
708
|
-
if(!o.axis || o.axis
|
709
|
-
if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
|
782
|
+
if(!o.axis || o.axis !== "y") {
|
783
|
+
if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
|
710
784
|
i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
|
711
|
-
else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)
|
785
|
+
} else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) {
|
712
786
|
i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
|
787
|
+
}
|
713
788
|
}
|
714
789
|
|
715
790
|
} else {
|
716
791
|
|
717
|
-
if(!o.axis || o.axis
|
718
|
-
if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
|
792
|
+
if(!o.axis || o.axis !== "x") {
|
793
|
+
if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
|
719
794
|
scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
|
720
|
-
else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
|
795
|
+
} else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
|
721
796
|
scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
|
797
|
+
}
|
722
798
|
}
|
723
799
|
|
724
|
-
if(!o.axis || o.axis
|
725
|
-
if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
|
800
|
+
if(!o.axis || o.axis !== "y") {
|
801
|
+
if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
|
726
802
|
scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
|
727
|
-
else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
|
803
|
+
} else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
|
728
804
|
scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
|
805
|
+
}
|
729
806
|
}
|
730
807
|
|
731
808
|
}
|
732
809
|
|
733
|
-
if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
|
810
|
+
if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
|
734
811
|
$.ui.ddmanager.prepareOffsets(i, event);
|
812
|
+
}
|
735
813
|
|
736
814
|
}
|
737
815
|
});
|
738
816
|
|
739
817
|
$.ui.plugin.add("draggable", "snap", {
|
740
|
-
start: function(
|
818
|
+
start: function() {
|
819
|
+
|
820
|
+
var i = $(this).data("ui-draggable"),
|
821
|
+
o = i.options;
|
741
822
|
|
742
|
-
var i = $(this).data("draggable"), o = i.options;
|
743
823
|
i.snapElements = [];
|
744
824
|
|
745
|
-
$(o.snap.constructor
|
746
|
-
var $t = $(this)
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
825
|
+
$(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() {
|
826
|
+
var $t = $(this),
|
827
|
+
$o = $t.offset();
|
828
|
+
if(this !== i.element[0]) {
|
829
|
+
i.snapElements.push({
|
830
|
+
item: this,
|
831
|
+
width: $t.outerWidth(), height: $t.outerHeight(),
|
832
|
+
top: $o.top, left: $o.left
|
833
|
+
});
|
834
|
+
}
|
752
835
|
});
|
753
836
|
|
754
837
|
},
|
755
838
|
drag: function(event, ui) {
|
756
839
|
|
757
|
-
var
|
758
|
-
|
759
|
-
|
760
|
-
|
840
|
+
var ts, bs, ls, rs, l, r, t, b, i, first,
|
841
|
+
inst = $(this).data("ui-draggable"),
|
842
|
+
o = inst.options,
|
843
|
+
d = o.snapTolerance,
|
844
|
+
x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
|
761
845
|
y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
|
762
846
|
|
763
|
-
for (
|
847
|
+
for (i = inst.snapElements.length - 1; i >= 0; i--){
|
764
848
|
|
765
|
-
|
766
|
-
|
849
|
+
l = inst.snapElements[i].left;
|
850
|
+
r = l + inst.snapElements[i].width;
|
851
|
+
t = inst.snapElements[i].top;
|
852
|
+
b = t + inst.snapElements[i].height;
|
767
853
|
|
768
854
|
//Yes, I know, this is insane ;)
|
769
855
|
if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
|
770
|
-
if(inst.snapElements[i].snapping)
|
856
|
+
if(inst.snapElements[i].snapping) {
|
857
|
+
(inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
|
858
|
+
}
|
771
859
|
inst.snapElements[i].snapping = false;
|
772
860
|
continue;
|
773
861
|
}
|
774
862
|
|
775
|
-
if(o.snapMode
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
if(ts)
|
781
|
-
|
782
|
-
|
783
|
-
if(
|
863
|
+
if(o.snapMode !== "inner") {
|
864
|
+
ts = Math.abs(t - y2) <= d;
|
865
|
+
bs = Math.abs(b - y1) <= d;
|
866
|
+
ls = Math.abs(l - x2) <= d;
|
867
|
+
rs = Math.abs(r - x1) <= d;
|
868
|
+
if(ts) {
|
869
|
+
ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
|
870
|
+
}
|
871
|
+
if(bs) {
|
872
|
+
ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
|
873
|
+
}
|
874
|
+
if(ls) {
|
875
|
+
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
|
876
|
+
}
|
877
|
+
if(rs) {
|
878
|
+
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
|
879
|
+
}
|
784
880
|
}
|
785
881
|
|
786
|
-
|
787
|
-
|
788
|
-
if(o.snapMode
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
if(ts)
|
794
|
-
|
795
|
-
|
796
|
-
if(
|
882
|
+
first = (ts || bs || ls || rs);
|
883
|
+
|
884
|
+
if(o.snapMode !== "outer") {
|
885
|
+
ts = Math.abs(t - y1) <= d;
|
886
|
+
bs = Math.abs(b - y2) <= d;
|
887
|
+
ls = Math.abs(l - x1) <= d;
|
888
|
+
rs = Math.abs(r - x2) <= d;
|
889
|
+
if(ts) {
|
890
|
+
ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
|
891
|
+
}
|
892
|
+
if(bs) {
|
893
|
+
ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
|
894
|
+
}
|
895
|
+
if(ls) {
|
896
|
+
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
|
897
|
+
}
|
898
|
+
if(rs) {
|
899
|
+
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
|
900
|
+
}
|
797
901
|
}
|
798
902
|
|
799
|
-
if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
|
903
|
+
if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
|
800
904
|
(inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
|
905
|
+
}
|
801
906
|
inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
|
802
907
|
|
803
|
-
}
|
908
|
+
}
|
804
909
|
|
805
910
|
}
|
806
911
|
});
|
807
912
|
|
808
913
|
$.ui.plugin.add("draggable", "stack", {
|
809
|
-
start: function(
|
914
|
+
start: function() {
|
810
915
|
|
811
|
-
var
|
916
|
+
var min,
|
917
|
+
o = $(this).data("ui-draggable").options,
|
918
|
+
group = $.makeArray($(o.stack)).sort(function(a,b) {
|
919
|
+
return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
|
920
|
+
});
|
812
921
|
|
813
|
-
var group = $.makeArray($(o.stack)).sort(function(a,b) {
|
814
|
-
return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
|
815
|
-
});
|
816
922
|
if (!group.length) { return; }
|
817
923
|
|
818
|
-
|
924
|
+
min = parseInt(group[0].style.zIndex, 10) || 0;
|
819
925
|
$(group).each(function(i) {
|
820
926
|
this.style.zIndex = min + i;
|
821
927
|
});
|
@@ -827,13 +933,17 @@ $.ui.plugin.add("draggable", "stack", {
|
|
827
933
|
|
828
934
|
$.ui.plugin.add("draggable", "zIndex", {
|
829
935
|
start: function(event, ui) {
|
830
|
-
var t = $(ui.helper), o = $(this).data("draggable").options;
|
831
|
-
if(t.css("zIndex"))
|
832
|
-
|
936
|
+
var t = $(ui.helper), o = $(this).data("ui-draggable").options;
|
937
|
+
if(t.css("zIndex")) {
|
938
|
+
o._zIndex = t.css("zIndex");
|
939
|
+
}
|
940
|
+
t.css("zIndex", o.zIndex);
|
833
941
|
},
|
834
942
|
stop: function(event, ui) {
|
835
|
-
var o = $(this).data("draggable").options;
|
836
|
-
if(o._zIndex)
|
943
|
+
var o = $(this).data("ui-draggable").options;
|
944
|
+
if(o._zIndex) {
|
945
|
+
$(ui.helper).css("zIndex", o._zIndex);
|
946
|
+
}
|
837
947
|
}
|
838
948
|
});
|
839
949
|
|