jquery-ui-rails 4.0.0 → 5.0.4
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/.travis.yml +0 -1
- data/Gemfile +1 -1
- data/History.md +62 -0
- data/README.md +86 -74
- data/Rakefile +69 -37
- data/VERSIONS.md +36 -0
- data/{vendor → app}/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/{vendor → app}/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/{vendor → app}/assets/images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/{vendor → app}/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/{vendor → app}/assets/images/jquery-ui/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/{vendor → app}/assets/images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/{vendor → app}/assets/images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/{vendor → app}/assets/images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/{vendor → app}/assets/images/jquery-ui/ui-icons_222222_256x240.png +0 -0
- data/{vendor → app}/assets/images/jquery-ui/ui-icons_2e83ff_256x240.png +0 -0
- data/{vendor → app}/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
- data/{vendor → app}/assets/images/jquery-ui/ui-icons_888888_256x240.png +0 -0
- data/{vendor → app}/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png +0 -0
- data/{vendor/assets/javascripts/jquery.ui.accordion.js → app/assets/javascripts/jquery-ui/accordion.js} +90 -74
- data/{vendor/assets/javascripts/jquery.ui.autocomplete.js → app/assets/javascripts/jquery-ui/autocomplete.js} +105 -91
- data/{vendor/assets/javascripts/jquery.ui.button.js → app/assets/javascripts/jquery-ui/button.js} +60 -68
- data/{vendor/assets/javascripts/jquery.ui.core.js → app/assets/javascripts/jquery-ui/core.js} +112 -132
- data/app/assets/javascripts/jquery-ui/datepicker-af.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ar-DZ.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ar.js +38 -0
- data/app/assets/javascripts/jquery-ui/datepicker-az.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-be.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-bg.js +38 -0
- data/app/assets/javascripts/jquery-ui/datepicker-bs.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ca.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-cs.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-cy-GB.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-da.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-de.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-el.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-en-AU.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-en-GB.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-en-NZ.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-eo.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-es.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-et.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-eu.js +36 -0
- data/app/assets/javascripts/jquery-ui/datepicker-fa.js +73 -0
- data/app/assets/javascripts/jquery-ui/datepicker-fi.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-fo.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-fr-CA.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-fr-CH.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-fr.js +39 -0
- data/app/assets/javascripts/jquery-ui/datepicker-gl.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-he.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-hi.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-hr.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-hu.js +36 -0
- data/app/assets/javascripts/jquery-ui/datepicker-hy.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-id.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-is.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-it-CH.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-it.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ja.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ka.js +35 -0
- data/app/assets/javascripts/jquery-ui/datepicker-kk.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-km.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ko.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ky.js +38 -0
- data/app/assets/javascripts/jquery-ui/datepicker-lb.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-lt.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-lv.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-mk.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ml.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ms.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-nb.js +36 -0
- data/app/assets/javascripts/jquery-ui/datepicker-nl-BE.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-nl.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-nn.js +36 -0
- data/app/assets/javascripts/jquery-ui/datepicker-no.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-pl.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-pt-BR.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-pt.js +36 -0
- data/app/assets/javascripts/jquery-ui/datepicker-rm.js +35 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ro.js +40 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ru.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-sk.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-sl.js +38 -0
- data/app/assets/javascripts/jquery-ui/datepicker-sq.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-sr-SR.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-sr.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-sv.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-ta.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-th.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-tj.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-tr.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-uk.js +38 -0
- data/app/assets/javascripts/jquery-ui/datepicker-vi.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-zh-CN.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-zh-HK.js +37 -0
- data/app/assets/javascripts/jquery-ui/datepicker-zh-TW.js +37 -0
- data/{vendor/assets/javascripts/jquery.ui.datepicker.js → app/assets/javascripts/jquery-ui/datepicker.js} +120 -80
- data/{vendor/assets/javascripts/jquery.ui.dialog.js → app/assets/javascripts/jquery-ui/dialog.js} +298 -190
- data/app/assets/javascripts/jquery-ui/draggable.js +1132 -0
- data/app/assets/javascripts/jquery-ui/droppable.js +418 -0
- data/{vendor/assets/javascripts/jquery.ui.effect-blind.js → app/assets/javascripts/jquery-ui/effect-blind.js} +21 -13
- data/{vendor/assets/javascripts/jquery.ui.effect-bounce.js → app/assets/javascripts/jquery-ui/effect-bounce.js} +19 -9
- data/{vendor/assets/javascripts/jquery.ui.effect-clip.js → app/assets/javascripts/jquery-ui/effect-clip.js} +19 -9
- data/{vendor/assets/javascripts/jquery.ui.effect-drop.js → app/assets/javascripts/jquery-ui/effect-drop.js} +20 -10
- data/{vendor/assets/javascripts/jquery.ui.effect-explode.js → app/assets/javascripts/jquery-ui/effect-explode.js} +21 -11
- data/app/assets/javascripts/jquery-ui/effect-fade.js +42 -0
- data/{vendor/assets/javascripts/jquery.ui.effect-fold.js → app/assets/javascripts/jquery-ui/effect-fold.js} +19 -9
- data/{vendor/assets/javascripts/jquery.ui.effect-highlight.js → app/assets/javascripts/jquery-ui/effect-highlight.js} +19 -9
- data/app/assets/javascripts/jquery-ui/effect-puff.js +63 -0
- data/{vendor/assets/javascripts/jquery.ui.effect-pulsate.js → app/assets/javascripts/jquery-ui/effect-pulsate.js} +19 -9
- data/app/assets/javascripts/jquery-ui/effect-scale.js +92 -0
- data/{vendor/assets/javascripts/jquery.ui.effect-shake.js → app/assets/javascripts/jquery-ui/effect-shake.js} +20 -10
- data/{vendor/assets/javascripts/jquery.ui.effect-scale.js → app/assets/javascripts/jquery-ui/effect-size.js} +20 -105
- data/{vendor/assets/javascripts/jquery.ui.effect-slide.js → app/assets/javascripts/jquery-ui/effect-slide.js} +19 -9
- data/{vendor/assets/javascripts/jquery.ui.effect-transfer.js → app/assets/javascripts/jquery-ui/effect-transfer.js} +23 -13
- data/app/assets/javascripts/jquery-ui/effect.all.js +16 -0
- data/{vendor/assets/javascripts/jquery.ui.effect.js → app/assets/javascripts/jquery-ui/effect.js} +125 -92
- data/{vendor/assets/javascripts/jquery.ui.menu.js → app/assets/javascripts/jquery-ui/menu.js} +127 -102
- data/{vendor/assets/javascripts/jquery.ui.mouse.js → app/assets/javascripts/jquery-ui/mouse.js} +57 -27
- data/{vendor/assets/javascripts/jquery.ui.position.js → app/assets/javascripts/jquery-ui/position.js} +47 -27
- data/{vendor/assets/javascripts/jquery.ui.progressbar.js → app/assets/javascripts/jquery-ui/progressbar.js} +27 -13
- data/{vendor/assets/javascripts/jquery.ui.resizable.js → app/assets/javascripts/jquery-ui/resizable.js} +454 -243
- data/{vendor/assets/javascripts/jquery.ui.selectable.js → app/assets/javascripts/jquery-ui/selectable.js} +26 -16
- data/app/assets/javascripts/jquery-ui/selectmenu.js +620 -0
- data/{vendor/assets/javascripts/jquery.ui.slider.js → app/assets/javascripts/jquery-ui/slider.js} +159 -91
- data/{vendor/assets/javascripts/jquery.ui.sortable.js → app/assets/javascripts/jquery-ui/sortable.js} +168 -114
- data/{vendor/assets/javascripts/jquery.ui.spinner.js → app/assets/javascripts/jquery-ui/spinner.js} +54 -32
- data/{vendor/assets/javascripts/jquery.ui.tabs.js → app/assets/javascripts/jquery-ui/tabs.js} +108 -73
- data/{vendor/assets/javascripts/jquery.ui.tooltip.js → app/assets/javascripts/jquery-ui/tooltip.js} +134 -75
- data/{vendor/assets/javascripts/jquery.ui.widget.js → app/assets/javascripts/jquery-ui/widget.js} +81 -44
- data/app/assets/javascripts/jquery-ui.js +37 -0
- data/{vendor/assets/stylesheets/jquery.ui.accordion.css.erb → app/assets/stylesheets/jquery-ui/accordion.css} +7 -9
- data/app/assets/stylesheets/jquery-ui/all.css +14 -0
- data/app/assets/stylesheets/jquery-ui/autocomplete.css +21 -0
- data/app/assets/stylesheets/jquery-ui/base.css +30 -0
- data/{vendor/assets/stylesheets/jquery.ui.button.css.erb → app/assets/stylesheets/jquery-ui/button.css} +5 -5
- data/{vendor/assets/stylesheets/jquery.ui.core.css.erb → app/assets/stylesheets/jquery-ui/core.css} +8 -4
- data/{vendor/assets/stylesheets/jquery.ui.datepicker.css.erb → app/assets/stylesheets/jquery-ui/datepicker.css} +6 -9
- data/{vendor/assets/stylesheets/jquery.ui.dialog.css.erb → app/assets/stylesheets/jquery-ui/dialog.css} +10 -8
- data/app/assets/stylesheets/jquery-ui/draggable.css +16 -0
- data/app/assets/stylesheets/jquery-ui/menu.css +67 -0
- data/app/assets/stylesheets/jquery-ui/progressbar.css +32 -0
- data/{vendor/assets/stylesheets/jquery.ui.resizable.css.erb → app/assets/stylesheets/jquery-ui/resizable.css} +6 -6
- data/app/assets/stylesheets/jquery-ui/selectable.css +21 -0
- data/app/assets/stylesheets/jquery-ui/selectmenu.css +64 -0
- data/{vendor/assets/stylesheets/jquery.ui.slider.css.erb → app/assets/stylesheets/jquery-ui/slider.css} +8 -6
- data/app/assets/stylesheets/jquery-ui/sortable.css +16 -0
- data/{vendor/assets/stylesheets/jquery.ui.spinner.css.erb → app/assets/stylesheets/jquery-ui/spinner.css} +8 -8
- data/{vendor/assets/stylesheets/jquery.ui.tabs.css.erb → app/assets/stylesheets/jquery-ui/tabs.css} +11 -12
- data/{vendor/assets/stylesheets/jquery.ui.theme.css.erb → app/assets/stylesheets/jquery-ui/theme.css.erb} +29 -11
- data/{vendor/assets/stylesheets/jquery.ui.tooltip.css.erb → app/assets/stylesheets/jquery-ui/tooltip.css} +6 -4
- data/app/assets/stylesheets/jquery-ui.css +1 -0
- data/lib/jquery/ui/rails/version.rb +2 -1
- metadata +155 -161
- data/vendor/assets/javascripts/jquery.ui.all.js +0 -34
- data/vendor/assets/javascripts/jquery.ui.datepicker-af.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-ar-DZ.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-ar.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-az.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-be.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-bg.js +0 -24
- data/vendor/assets/javascripts/jquery.ui.datepicker-bs.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-ca.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-cs.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-cy-GB.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-da.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-de.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-el.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-en-AU.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-en-GB.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-en-NZ.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-eo.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-es.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-et.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-eu.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-fa.js +0 -59
- data/vendor/assets/javascripts/jquery.ui.datepicker-fi.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-fo.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-fr-CA.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-fr-CH.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-fr.js +0 -25
- data/vendor/assets/javascripts/jquery.ui.datepicker-gl.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-he.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-hi.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-hr.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-hu.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-hy.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-id.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-is.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-it.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-ja.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-ka.js +0 -21
- data/vendor/assets/javascripts/jquery.ui.datepicker-kk.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-km.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-ko.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-ky.js +0 -24
- data/vendor/assets/javascripts/jquery.ui.datepicker-lb.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-lt.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-lv.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-mk.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-ml.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-ms.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-nb.js +0 -22
- data/vendor/assets/javascripts/jquery.ui.datepicker-nl-BE.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-nl.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-nn.js +0 -22
- data/vendor/assets/javascripts/jquery.ui.datepicker-no.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-pl.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-pt-BR.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-pt.js +0 -22
- data/vendor/assets/javascripts/jquery.ui.datepicker-rm.js +0 -21
- data/vendor/assets/javascripts/jquery.ui.datepicker-ro.js +0 -26
- data/vendor/assets/javascripts/jquery.ui.datepicker-ru.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-sk.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-sl.js +0 -24
- data/vendor/assets/javascripts/jquery.ui.datepicker-sq.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-sr-SR.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-sr.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-sv.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-ta.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-th.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-tj.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-tr.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-uk.js +0 -24
- data/vendor/assets/javascripts/jquery.ui.datepicker-vi.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-zh-CN.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-zh-HK.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.datepicker-zh-TW.js +0 -23
- data/vendor/assets/javascripts/jquery.ui.draggable.js +0 -950
- data/vendor/assets/javascripts/jquery.ui.droppable.js +0 -376
- data/vendor/assets/javascripts/jquery.ui.effect-fade.js +0 -32
- data/vendor/assets/javascripts/jquery.ui.effect.all.js +0 -14
- data/vendor/assets/stylesheets/jquery.ui.all.css.erb +0 -14
- data/vendor/assets/stylesheets/jquery.ui.autocomplete.css.erb +0 -21
- data/vendor/assets/stylesheets/jquery.ui.base.css.erb +0 -27
- data/vendor/assets/stylesheets/jquery.ui.menu.css.erb +0 -81
- data/vendor/assets/stylesheets/jquery.ui.progressbar.css.erb +0 -32
- data/vendor/assets/stylesheets/jquery.ui.selectable.css.erb +0 -19
@@ -0,0 +1,1132 @@
|
|
1
|
+
//= require jquery-ui/core
|
2
|
+
//= require jquery-ui/widget
|
3
|
+
//= require jquery-ui/mouse
|
4
|
+
|
5
|
+
/*!
|
6
|
+
* jQuery UI Draggable 1.11.3
|
7
|
+
* http://jqueryui.com
|
8
|
+
*
|
9
|
+
* Copyright jQuery Foundation and other contributors
|
10
|
+
* Released under the MIT license.
|
11
|
+
* http://jquery.org/license
|
12
|
+
*
|
13
|
+
* http://api.jqueryui.com/draggable/
|
14
|
+
*/
|
15
|
+
(function( factory ) {
|
16
|
+
if ( typeof define === "function" && define.amd ) {
|
17
|
+
|
18
|
+
// AMD. Register as an anonymous module.
|
19
|
+
define([
|
20
|
+
"jquery",
|
21
|
+
"./core",
|
22
|
+
"./mouse",
|
23
|
+
"./widget"
|
24
|
+
], factory );
|
25
|
+
} else {
|
26
|
+
|
27
|
+
// Browser globals
|
28
|
+
factory( jQuery );
|
29
|
+
}
|
30
|
+
}(function( $ ) {
|
31
|
+
|
32
|
+
$.widget("ui.draggable", $.ui.mouse, {
|
33
|
+
version: "1.11.3",
|
34
|
+
widgetEventPrefix: "drag",
|
35
|
+
options: {
|
36
|
+
addClasses: true,
|
37
|
+
appendTo: "parent",
|
38
|
+
axis: false,
|
39
|
+
connectToSortable: false,
|
40
|
+
containment: false,
|
41
|
+
cursor: "auto",
|
42
|
+
cursorAt: false,
|
43
|
+
grid: false,
|
44
|
+
handle: false,
|
45
|
+
helper: "original",
|
46
|
+
iframeFix: false,
|
47
|
+
opacity: false,
|
48
|
+
refreshPositions: false,
|
49
|
+
revert: false,
|
50
|
+
revertDuration: 500,
|
51
|
+
scope: "default",
|
52
|
+
scroll: true,
|
53
|
+
scrollSensitivity: 20,
|
54
|
+
scrollSpeed: 20,
|
55
|
+
snap: false,
|
56
|
+
snapMode: "both",
|
57
|
+
snapTolerance: 20,
|
58
|
+
stack: false,
|
59
|
+
zIndex: false,
|
60
|
+
|
61
|
+
// callbacks
|
62
|
+
drag: null,
|
63
|
+
start: null,
|
64
|
+
stop: null
|
65
|
+
},
|
66
|
+
_create: function() {
|
67
|
+
|
68
|
+
if ( this.options.helper === "original" ) {
|
69
|
+
this._setPositionRelative();
|
70
|
+
}
|
71
|
+
if (this.options.addClasses){
|
72
|
+
this.element.addClass("ui-draggable");
|
73
|
+
}
|
74
|
+
if (this.options.disabled){
|
75
|
+
this.element.addClass("ui-draggable-disabled");
|
76
|
+
}
|
77
|
+
this._setHandleClassName();
|
78
|
+
|
79
|
+
this._mouseInit();
|
80
|
+
},
|
81
|
+
|
82
|
+
_setOption: function( key, value ) {
|
83
|
+
this._super( key, value );
|
84
|
+
if ( key === "handle" ) {
|
85
|
+
this._removeHandleClassName();
|
86
|
+
this._setHandleClassName();
|
87
|
+
}
|
88
|
+
},
|
89
|
+
|
90
|
+
_destroy: function() {
|
91
|
+
if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {
|
92
|
+
this.destroyOnClear = true;
|
93
|
+
return;
|
94
|
+
}
|
95
|
+
this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
|
96
|
+
this._removeHandleClassName();
|
97
|
+
this._mouseDestroy();
|
98
|
+
},
|
99
|
+
|
100
|
+
_mouseCapture: function(event) {
|
101
|
+
var o = this.options;
|
102
|
+
|
103
|
+
this._blurActiveElement( event );
|
104
|
+
|
105
|
+
// among others, prevent a drag on a resizable-handle
|
106
|
+
if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) {
|
107
|
+
return false;
|
108
|
+
}
|
109
|
+
|
110
|
+
//Quit if we're not on a valid handle
|
111
|
+
this.handle = this._getHandle(event);
|
112
|
+
if (!this.handle) {
|
113
|
+
return false;
|
114
|
+
}
|
115
|
+
|
116
|
+
this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );
|
117
|
+
|
118
|
+
return true;
|
119
|
+
|
120
|
+
},
|
121
|
+
|
122
|
+
_blockFrames: function( selector ) {
|
123
|
+
this.iframeBlocks = this.document.find( selector ).map(function() {
|
124
|
+
var iframe = $( this );
|
125
|
+
|
126
|
+
return $( "<div>" )
|
127
|
+
.css( "position", "absolute" )
|
128
|
+
.appendTo( iframe.parent() )
|
129
|
+
.outerWidth( iframe.outerWidth() )
|
130
|
+
.outerHeight( iframe.outerHeight() )
|
131
|
+
.offset( iframe.offset() )[ 0 ];
|
132
|
+
});
|
133
|
+
},
|
134
|
+
|
135
|
+
_unblockFrames: function() {
|
136
|
+
if ( this.iframeBlocks ) {
|
137
|
+
this.iframeBlocks.remove();
|
138
|
+
delete this.iframeBlocks;
|
139
|
+
}
|
140
|
+
},
|
141
|
+
|
142
|
+
_blurActiveElement: function( event ) {
|
143
|
+
var document = this.document[ 0 ];
|
144
|
+
|
145
|
+
// Only need to blur if the event occurred on the draggable itself, see #10527
|
146
|
+
if ( !this.handleElement.is( event.target ) ) {
|
147
|
+
return;
|
148
|
+
}
|
149
|
+
|
150
|
+
// support: IE9
|
151
|
+
// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
|
152
|
+
try {
|
153
|
+
|
154
|
+
// Support: IE9, IE10
|
155
|
+
// If the <body> is blurred, IE will switch windows, see #9520
|
156
|
+
if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== "body" ) {
|
157
|
+
|
158
|
+
// Blur any element that currently has focus, see #4261
|
159
|
+
$( document.activeElement ).blur();
|
160
|
+
}
|
161
|
+
} catch ( error ) {}
|
162
|
+
},
|
163
|
+
|
164
|
+
_mouseStart: function(event) {
|
165
|
+
|
166
|
+
var o = this.options;
|
167
|
+
|
168
|
+
//Create and append the visible helper
|
169
|
+
this.helper = this._createHelper(event);
|
170
|
+
|
171
|
+
this.helper.addClass("ui-draggable-dragging");
|
172
|
+
|
173
|
+
//Cache the helper size
|
174
|
+
this._cacheHelperProportions();
|
175
|
+
|
176
|
+
//If ddmanager is used for droppables, set the global draggable
|
177
|
+
if ($.ui.ddmanager) {
|
178
|
+
$.ui.ddmanager.current = this;
|
179
|
+
}
|
180
|
+
|
181
|
+
/*
|
182
|
+
* - Position generation -
|
183
|
+
* This block generates everything position related - it's the core of draggables.
|
184
|
+
*/
|
185
|
+
|
186
|
+
//Cache the margins of the original element
|
187
|
+
this._cacheMargins();
|
188
|
+
|
189
|
+
//Store the helper's css position
|
190
|
+
this.cssPosition = this.helper.css( "position" );
|
191
|
+
this.scrollParent = this.helper.scrollParent( true );
|
192
|
+
this.offsetParent = this.helper.offsetParent();
|
193
|
+
this.hasFixedAncestor = this.helper.parents().filter(function() {
|
194
|
+
return $( this ).css( "position" ) === "fixed";
|
195
|
+
}).length > 0;
|
196
|
+
|
197
|
+
//The element's absolute position on the page minus margins
|
198
|
+
this.positionAbs = this.element.offset();
|
199
|
+
this._refreshOffsets( event );
|
200
|
+
|
201
|
+
//Generate the original position
|
202
|
+
this.originalPosition = this.position = this._generatePosition( event, false );
|
203
|
+
this.originalPageX = event.pageX;
|
204
|
+
this.originalPageY = event.pageY;
|
205
|
+
|
206
|
+
//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
|
207
|
+
(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
|
208
|
+
|
209
|
+
//Set a containment if given in the options
|
210
|
+
this._setContainment();
|
211
|
+
|
212
|
+
//Trigger event + callbacks
|
213
|
+
if (this._trigger("start", event) === false) {
|
214
|
+
this._clear();
|
215
|
+
return false;
|
216
|
+
}
|
217
|
+
|
218
|
+
//Recache the helper size
|
219
|
+
this._cacheHelperProportions();
|
220
|
+
|
221
|
+
//Prepare the droppable offsets
|
222
|
+
if ($.ui.ddmanager && !o.dropBehaviour) {
|
223
|
+
$.ui.ddmanager.prepareOffsets(this, event);
|
224
|
+
}
|
225
|
+
|
226
|
+
// Reset helper's right/bottom css if they're set and set explicit width/height instead
|
227
|
+
// as this prevents resizing of elements with right/bottom set (see #7772)
|
228
|
+
this._normalizeRightBottom();
|
229
|
+
|
230
|
+
this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
|
231
|
+
|
232
|
+
//If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
|
233
|
+
if ( $.ui.ddmanager ) {
|
234
|
+
$.ui.ddmanager.dragStart(this, event);
|
235
|
+
}
|
236
|
+
|
237
|
+
return true;
|
238
|
+
},
|
239
|
+
|
240
|
+
_refreshOffsets: function( event ) {
|
241
|
+
this.offset = {
|
242
|
+
top: this.positionAbs.top - this.margins.top,
|
243
|
+
left: this.positionAbs.left - this.margins.left,
|
244
|
+
scroll: false,
|
245
|
+
parent: this._getParentOffset(),
|
246
|
+
relative: this._getRelativeOffset()
|
247
|
+
};
|
248
|
+
|
249
|
+
this.offset.click = {
|
250
|
+
left: event.pageX - this.offset.left,
|
251
|
+
top: event.pageY - this.offset.top
|
252
|
+
};
|
253
|
+
},
|
254
|
+
|
255
|
+
_mouseDrag: function(event, noPropagation) {
|
256
|
+
// reset any necessary cached properties (see #5009)
|
257
|
+
if ( this.hasFixedAncestor ) {
|
258
|
+
this.offset.parent = this._getParentOffset();
|
259
|
+
}
|
260
|
+
|
261
|
+
//Compute the helpers position
|
262
|
+
this.position = this._generatePosition( event, true );
|
263
|
+
this.positionAbs = this._convertPositionTo("absolute");
|
264
|
+
|
265
|
+
//Call plugins and callbacks and use the resulting position if something is returned
|
266
|
+
if (!noPropagation) {
|
267
|
+
var ui = this._uiHash();
|
268
|
+
if (this._trigger("drag", event, ui) === false) {
|
269
|
+
this._mouseUp({});
|
270
|
+
return false;
|
271
|
+
}
|
272
|
+
this.position = ui.position;
|
273
|
+
}
|
274
|
+
|
275
|
+
this.helper[ 0 ].style.left = this.position.left + "px";
|
276
|
+
this.helper[ 0 ].style.top = this.position.top + "px";
|
277
|
+
|
278
|
+
if ($.ui.ddmanager) {
|
279
|
+
$.ui.ddmanager.drag(this, event);
|
280
|
+
}
|
281
|
+
|
282
|
+
return false;
|
283
|
+
},
|
284
|
+
|
285
|
+
_mouseStop: function(event) {
|
286
|
+
|
287
|
+
//If we are using droppables, inform the manager about the drop
|
288
|
+
var that = this,
|
289
|
+
dropped = false;
|
290
|
+
if ($.ui.ddmanager && !this.options.dropBehaviour) {
|
291
|
+
dropped = $.ui.ddmanager.drop(this, event);
|
292
|
+
}
|
293
|
+
|
294
|
+
//if a drop comes from outside (a sortable)
|
295
|
+
if (this.dropped) {
|
296
|
+
dropped = this.dropped;
|
297
|
+
this.dropped = false;
|
298
|
+
}
|
299
|
+
|
300
|
+
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))) {
|
301
|
+
$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
|
302
|
+
if (that._trigger("stop", event) !== false) {
|
303
|
+
that._clear();
|
304
|
+
}
|
305
|
+
});
|
306
|
+
} else {
|
307
|
+
if (this._trigger("stop", event) !== false) {
|
308
|
+
this._clear();
|
309
|
+
}
|
310
|
+
}
|
311
|
+
|
312
|
+
return false;
|
313
|
+
},
|
314
|
+
|
315
|
+
_mouseUp: function( event ) {
|
316
|
+
this._unblockFrames();
|
317
|
+
|
318
|
+
//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
|
319
|
+
if ( $.ui.ddmanager ) {
|
320
|
+
$.ui.ddmanager.dragStop(this, event);
|
321
|
+
}
|
322
|
+
|
323
|
+
// Only need to focus if the event occurred on the draggable itself, see #10527
|
324
|
+
if ( this.handleElement.is( event.target ) ) {
|
325
|
+
// The interaction is over; whether or not the click resulted in a drag, focus the element
|
326
|
+
this.element.focus();
|
327
|
+
}
|
328
|
+
|
329
|
+
return $.ui.mouse.prototype._mouseUp.call(this, event);
|
330
|
+
},
|
331
|
+
|
332
|
+
cancel: function() {
|
333
|
+
|
334
|
+
if (this.helper.is(".ui-draggable-dragging")) {
|
335
|
+
this._mouseUp({});
|
336
|
+
} else {
|
337
|
+
this._clear();
|
338
|
+
}
|
339
|
+
|
340
|
+
return this;
|
341
|
+
|
342
|
+
},
|
343
|
+
|
344
|
+
_getHandle: function(event) {
|
345
|
+
return this.options.handle ?
|
346
|
+
!!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
|
347
|
+
true;
|
348
|
+
},
|
349
|
+
|
350
|
+
_setHandleClassName: function() {
|
351
|
+
this.handleElement = this.options.handle ?
|
352
|
+
this.element.find( this.options.handle ) : this.element;
|
353
|
+
this.handleElement.addClass( "ui-draggable-handle" );
|
354
|
+
},
|
355
|
+
|
356
|
+
_removeHandleClassName: function() {
|
357
|
+
this.handleElement.removeClass( "ui-draggable-handle" );
|
358
|
+
},
|
359
|
+
|
360
|
+
_createHelper: function(event) {
|
361
|
+
|
362
|
+
var o = this.options,
|
363
|
+
helperIsFunction = $.isFunction( o.helper ),
|
364
|
+
helper = helperIsFunction ?
|
365
|
+
$( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
|
366
|
+
( o.helper === "clone" ?
|
367
|
+
this.element.clone().removeAttr( "id" ) :
|
368
|
+
this.element );
|
369
|
+
|
370
|
+
if (!helper.parents("body").length) {
|
371
|
+
helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo));
|
372
|
+
}
|
373
|
+
|
374
|
+
// http://bugs.jqueryui.com/ticket/9446
|
375
|
+
// a helper function can return the original element
|
376
|
+
// which wouldn't have been set to relative in _create
|
377
|
+
if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {
|
378
|
+
this._setPositionRelative();
|
379
|
+
}
|
380
|
+
|
381
|
+
if (helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) {
|
382
|
+
helper.css("position", "absolute");
|
383
|
+
}
|
384
|
+
|
385
|
+
return helper;
|
386
|
+
|
387
|
+
},
|
388
|
+
|
389
|
+
_setPositionRelative: function() {
|
390
|
+
if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {
|
391
|
+
this.element[ 0 ].style.position = "relative";
|
392
|
+
}
|
393
|
+
},
|
394
|
+
|
395
|
+
_adjustOffsetFromHelper: function(obj) {
|
396
|
+
if (typeof obj === "string") {
|
397
|
+
obj = obj.split(" ");
|
398
|
+
}
|
399
|
+
if ($.isArray(obj)) {
|
400
|
+
obj = { left: +obj[0], top: +obj[1] || 0 };
|
401
|
+
}
|
402
|
+
if ("left" in obj) {
|
403
|
+
this.offset.click.left = obj.left + this.margins.left;
|
404
|
+
}
|
405
|
+
if ("right" in obj) {
|
406
|
+
this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
|
407
|
+
}
|
408
|
+
if ("top" in obj) {
|
409
|
+
this.offset.click.top = obj.top + this.margins.top;
|
410
|
+
}
|
411
|
+
if ("bottom" in obj) {
|
412
|
+
this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
|
413
|
+
}
|
414
|
+
},
|
415
|
+
|
416
|
+
_isRootNode: function( element ) {
|
417
|
+
return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];
|
418
|
+
},
|
419
|
+
|
420
|
+
_getParentOffset: function() {
|
421
|
+
|
422
|
+
//Get the offsetParent and cache its position
|
423
|
+
var po = this.offsetParent.offset(),
|
424
|
+
document = this.document[ 0 ];
|
425
|
+
|
426
|
+
// This is a special case where we need to modify a offset calculated on start, since the following happened:
|
427
|
+
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
|
428
|
+
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
|
429
|
+
// the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
|
430
|
+
if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
|
431
|
+
po.left += this.scrollParent.scrollLeft();
|
432
|
+
po.top += this.scrollParent.scrollTop();
|
433
|
+
}
|
434
|
+
|
435
|
+
if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {
|
436
|
+
po = { top: 0, left: 0 };
|
437
|
+
}
|
438
|
+
|
439
|
+
return {
|
440
|
+
top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
|
441
|
+
left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
|
442
|
+
};
|
443
|
+
|
444
|
+
},
|
445
|
+
|
446
|
+
_getRelativeOffset: function() {
|
447
|
+
if ( this.cssPosition !== "relative" ) {
|
448
|
+
return { top: 0, left: 0 };
|
449
|
+
}
|
450
|
+
|
451
|
+
var p = this.element.position(),
|
452
|
+
scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
|
453
|
+
|
454
|
+
return {
|
455
|
+
top: p.top - ( parseInt(this.helper.css( "top" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),
|
456
|
+
left: p.left - ( parseInt(this.helper.css( "left" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 )
|
457
|
+
};
|
458
|
+
|
459
|
+
},
|
460
|
+
|
461
|
+
_cacheMargins: function() {
|
462
|
+
this.margins = {
|
463
|
+
left: (parseInt(this.element.css("marginLeft"), 10) || 0),
|
464
|
+
top: (parseInt(this.element.css("marginTop"), 10) || 0),
|
465
|
+
right: (parseInt(this.element.css("marginRight"), 10) || 0),
|
466
|
+
bottom: (parseInt(this.element.css("marginBottom"), 10) || 0)
|
467
|
+
};
|
468
|
+
},
|
469
|
+
|
470
|
+
_cacheHelperProportions: function() {
|
471
|
+
this.helperProportions = {
|
472
|
+
width: this.helper.outerWidth(),
|
473
|
+
height: this.helper.outerHeight()
|
474
|
+
};
|
475
|
+
},
|
476
|
+
|
477
|
+
_setContainment: function() {
|
478
|
+
|
479
|
+
var isUserScrollable, c, ce,
|
480
|
+
o = this.options,
|
481
|
+
document = this.document[ 0 ];
|
482
|
+
|
483
|
+
this.relativeContainer = null;
|
484
|
+
|
485
|
+
if ( !o.containment ) {
|
486
|
+
this.containment = null;
|
487
|
+
return;
|
488
|
+
}
|
489
|
+
|
490
|
+
if ( o.containment === "window" ) {
|
491
|
+
this.containment = [
|
492
|
+
$( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
|
493
|
+
$( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
|
494
|
+
$( window ).scrollLeft() + $( window ).width() - this.helperProportions.width - this.margins.left,
|
495
|
+
$( window ).scrollTop() + ( $( window ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
|
496
|
+
];
|
497
|
+
return;
|
498
|
+
}
|
499
|
+
|
500
|
+
if ( o.containment === "document") {
|
501
|
+
this.containment = [
|
502
|
+
0,
|
503
|
+
0,
|
504
|
+
$( document ).width() - this.helperProportions.width - this.margins.left,
|
505
|
+
( $( document ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
|
506
|
+
];
|
507
|
+
return;
|
508
|
+
}
|
509
|
+
|
510
|
+
if ( o.containment.constructor === Array ) {
|
511
|
+
this.containment = o.containment;
|
512
|
+
return;
|
513
|
+
}
|
514
|
+
|
515
|
+
if ( o.containment === "parent" ) {
|
516
|
+
o.containment = this.helper[ 0 ].parentNode;
|
517
|
+
}
|
518
|
+
|
519
|
+
c = $( o.containment );
|
520
|
+
ce = c[ 0 ];
|
521
|
+
|
522
|
+
if ( !ce ) {
|
523
|
+
return;
|
524
|
+
}
|
525
|
+
|
526
|
+
isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );
|
527
|
+
|
528
|
+
this.containment = [
|
529
|
+
( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
|
530
|
+
( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
|
531
|
+
( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
|
532
|
+
( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -
|
533
|
+
( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -
|
534
|
+
this.helperProportions.width -
|
535
|
+
this.margins.left -
|
536
|
+
this.margins.right,
|
537
|
+
( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
|
538
|
+
( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -
|
539
|
+
( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -
|
540
|
+
this.helperProportions.height -
|
541
|
+
this.margins.top -
|
542
|
+
this.margins.bottom
|
543
|
+
];
|
544
|
+
this.relativeContainer = c;
|
545
|
+
},
|
546
|
+
|
547
|
+
_convertPositionTo: function(d, pos) {
|
548
|
+
|
549
|
+
if (!pos) {
|
550
|
+
pos = this.position;
|
551
|
+
}
|
552
|
+
|
553
|
+
var mod = d === "absolute" ? 1 : -1,
|
554
|
+
scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
|
555
|
+
|
556
|
+
return {
|
557
|
+
top: (
|
558
|
+
pos.top + // The absolute mouse position
|
559
|
+
this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
|
560
|
+
this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
|
561
|
+
( ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod)
|
562
|
+
),
|
563
|
+
left: (
|
564
|
+
pos.left + // The absolute mouse position
|
565
|
+
this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
|
566
|
+
this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
|
567
|
+
( ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod)
|
568
|
+
)
|
569
|
+
};
|
570
|
+
|
571
|
+
},
|
572
|
+
|
573
|
+
_generatePosition: function( event, constrainPosition ) {
|
574
|
+
|
575
|
+
var containment, co, top, left,
|
576
|
+
o = this.options,
|
577
|
+
scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),
|
578
|
+
pageX = event.pageX,
|
579
|
+
pageY = event.pageY;
|
580
|
+
|
581
|
+
// Cache the scroll
|
582
|
+
if ( !scrollIsRootNode || !this.offset.scroll ) {
|
583
|
+
this.offset.scroll = {
|
584
|
+
top: this.scrollParent.scrollTop(),
|
585
|
+
left: this.scrollParent.scrollLeft()
|
586
|
+
};
|
587
|
+
}
|
588
|
+
|
589
|
+
/*
|
590
|
+
* - Position constraining -
|
591
|
+
* Constrain the position to a mix of grid, containment.
|
592
|
+
*/
|
593
|
+
|
594
|
+
// If we are not dragging yet, we won't check for options
|
595
|
+
if ( constrainPosition ) {
|
596
|
+
if ( this.containment ) {
|
597
|
+
if ( this.relativeContainer ){
|
598
|
+
co = this.relativeContainer.offset();
|
599
|
+
containment = [
|
600
|
+
this.containment[ 0 ] + co.left,
|
601
|
+
this.containment[ 1 ] + co.top,
|
602
|
+
this.containment[ 2 ] + co.left,
|
603
|
+
this.containment[ 3 ] + co.top
|
604
|
+
];
|
605
|
+
} else {
|
606
|
+
containment = this.containment;
|
607
|
+
}
|
608
|
+
|
609
|
+
if (event.pageX - this.offset.click.left < containment[0]) {
|
610
|
+
pageX = containment[0] + this.offset.click.left;
|
611
|
+
}
|
612
|
+
if (event.pageY - this.offset.click.top < containment[1]) {
|
613
|
+
pageY = containment[1] + this.offset.click.top;
|
614
|
+
}
|
615
|
+
if (event.pageX - this.offset.click.left > containment[2]) {
|
616
|
+
pageX = containment[2] + this.offset.click.left;
|
617
|
+
}
|
618
|
+
if (event.pageY - this.offset.click.top > containment[3]) {
|
619
|
+
pageY = containment[3] + this.offset.click.top;
|
620
|
+
}
|
621
|
+
}
|
622
|
+
|
623
|
+
if (o.grid) {
|
624
|
+
//Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
|
625
|
+
top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
|
626
|
+
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;
|
627
|
+
|
628
|
+
left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
|
629
|
+
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;
|
630
|
+
}
|
631
|
+
|
632
|
+
if ( o.axis === "y" ) {
|
633
|
+
pageX = this.originalPageX;
|
634
|
+
}
|
635
|
+
|
636
|
+
if ( o.axis === "x" ) {
|
637
|
+
pageY = this.originalPageY;
|
638
|
+
}
|
639
|
+
}
|
640
|
+
|
641
|
+
return {
|
642
|
+
top: (
|
643
|
+
pageY - // The absolute mouse position
|
644
|
+
this.offset.click.top - // Click offset (relative to the element)
|
645
|
+
this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent
|
646
|
+
this.offset.parent.top + // The offsetParent's offset without borders (offset + border)
|
647
|
+
( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) )
|
648
|
+
),
|
649
|
+
left: (
|
650
|
+
pageX - // The absolute mouse position
|
651
|
+
this.offset.click.left - // Click offset (relative to the element)
|
652
|
+
this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent
|
653
|
+
this.offset.parent.left + // The offsetParent's offset without borders (offset + border)
|
654
|
+
( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) )
|
655
|
+
)
|
656
|
+
};
|
657
|
+
|
658
|
+
},
|
659
|
+
|
660
|
+
_clear: function() {
|
661
|
+
this.helper.removeClass("ui-draggable-dragging");
|
662
|
+
if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
|
663
|
+
this.helper.remove();
|
664
|
+
}
|
665
|
+
this.helper = null;
|
666
|
+
this.cancelHelperRemoval = false;
|
667
|
+
if ( this.destroyOnClear ) {
|
668
|
+
this.destroy();
|
669
|
+
}
|
670
|
+
},
|
671
|
+
|
672
|
+
_normalizeRightBottom: function() {
|
673
|
+
if ( this.options.axis !== "y" && this.helper.css( "right" ) !== "auto" ) {
|
674
|
+
this.helper.width( this.helper.width() );
|
675
|
+
this.helper.css( "right", "auto" );
|
676
|
+
}
|
677
|
+
if ( this.options.axis !== "x" && this.helper.css( "bottom" ) !== "auto" ) {
|
678
|
+
this.helper.height( this.helper.height() );
|
679
|
+
this.helper.css( "bottom", "auto" );
|
680
|
+
}
|
681
|
+
},
|
682
|
+
|
683
|
+
// From now on bulk stuff - mainly helpers
|
684
|
+
|
685
|
+
_trigger: function( type, event, ui ) {
|
686
|
+
ui = ui || this._uiHash();
|
687
|
+
$.ui.plugin.call( this, type, [ event, ui, this ], true );
|
688
|
+
|
689
|
+
// Absolute position and offset (see #6884 ) have to be recalculated after plugins
|
690
|
+
if ( /^(drag|start|stop)/.test( type ) ) {
|
691
|
+
this.positionAbs = this._convertPositionTo( "absolute" );
|
692
|
+
ui.offset = this.positionAbs;
|
693
|
+
}
|
694
|
+
return $.Widget.prototype._trigger.call( this, type, event, ui );
|
695
|
+
},
|
696
|
+
|
697
|
+
plugins: {},
|
698
|
+
|
699
|
+
_uiHash: function() {
|
700
|
+
return {
|
701
|
+
helper: this.helper,
|
702
|
+
position: this.position,
|
703
|
+
originalPosition: this.originalPosition,
|
704
|
+
offset: this.positionAbs
|
705
|
+
};
|
706
|
+
}
|
707
|
+
|
708
|
+
});
|
709
|
+
|
710
|
+
$.ui.plugin.add( "draggable", "connectToSortable", {
|
711
|
+
start: function( event, ui, draggable ) {
|
712
|
+
var uiSortable = $.extend( {}, ui, {
|
713
|
+
item: draggable.element
|
714
|
+
});
|
715
|
+
|
716
|
+
draggable.sortables = [];
|
717
|
+
$( draggable.options.connectToSortable ).each(function() {
|
718
|
+
var sortable = $( this ).sortable( "instance" );
|
719
|
+
|
720
|
+
if ( sortable && !sortable.options.disabled ) {
|
721
|
+
draggable.sortables.push( sortable );
|
722
|
+
|
723
|
+
// refreshPositions is called at drag start to refresh the containerCache
|
724
|
+
// which is used in drag. This ensures it's initialized and synchronized
|
725
|
+
// with any changes that might have happened on the page since initialization.
|
726
|
+
sortable.refreshPositions();
|
727
|
+
sortable._trigger("activate", event, uiSortable);
|
728
|
+
}
|
729
|
+
});
|
730
|
+
},
|
731
|
+
stop: function( event, ui, draggable ) {
|
732
|
+
var uiSortable = $.extend( {}, ui, {
|
733
|
+
item: draggable.element
|
734
|
+
});
|
735
|
+
|
736
|
+
draggable.cancelHelperRemoval = false;
|
737
|
+
|
738
|
+
$.each( draggable.sortables, function() {
|
739
|
+
var sortable = this;
|
740
|
+
|
741
|
+
if ( sortable.isOver ) {
|
742
|
+
sortable.isOver = 0;
|
743
|
+
|
744
|
+
// Allow this sortable to handle removing the helper
|
745
|
+
draggable.cancelHelperRemoval = true;
|
746
|
+
sortable.cancelHelperRemoval = false;
|
747
|
+
|
748
|
+
// Use _storedCSS To restore properties in the sortable,
|
749
|
+
// as this also handles revert (#9675) since the draggable
|
750
|
+
// may have modified them in unexpected ways (#8809)
|
751
|
+
sortable._storedCSS = {
|
752
|
+
position: sortable.placeholder.css( "position" ),
|
753
|
+
top: sortable.placeholder.css( "top" ),
|
754
|
+
left: sortable.placeholder.css( "left" )
|
755
|
+
};
|
756
|
+
|
757
|
+
sortable._mouseStop(event);
|
758
|
+
|
759
|
+
// Once drag has ended, the sortable should return to using
|
760
|
+
// its original helper, not the shared helper from draggable
|
761
|
+
sortable.options.helper = sortable.options._helper;
|
762
|
+
} else {
|
763
|
+
// Prevent this Sortable from removing the helper.
|
764
|
+
// However, don't set the draggable to remove the helper
|
765
|
+
// either as another connected Sortable may yet handle the removal.
|
766
|
+
sortable.cancelHelperRemoval = true;
|
767
|
+
|
768
|
+
sortable._trigger( "deactivate", event, uiSortable );
|
769
|
+
}
|
770
|
+
});
|
771
|
+
},
|
772
|
+
drag: function( event, ui, draggable ) {
|
773
|
+
$.each( draggable.sortables, function() {
|
774
|
+
var innermostIntersecting = false,
|
775
|
+
sortable = this;
|
776
|
+
|
777
|
+
// Copy over variables that sortable's _intersectsWith uses
|
778
|
+
sortable.positionAbs = draggable.positionAbs;
|
779
|
+
sortable.helperProportions = draggable.helperProportions;
|
780
|
+
sortable.offset.click = draggable.offset.click;
|
781
|
+
|
782
|
+
if ( sortable._intersectsWith( sortable.containerCache ) ) {
|
783
|
+
innermostIntersecting = true;
|
784
|
+
|
785
|
+
$.each( draggable.sortables, function() {
|
786
|
+
// Copy over variables that sortable's _intersectsWith uses
|
787
|
+
this.positionAbs = draggable.positionAbs;
|
788
|
+
this.helperProportions = draggable.helperProportions;
|
789
|
+
this.offset.click = draggable.offset.click;
|
790
|
+
|
791
|
+
if ( this !== sortable &&
|
792
|
+
this._intersectsWith( this.containerCache ) &&
|
793
|
+
$.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {
|
794
|
+
innermostIntersecting = false;
|
795
|
+
}
|
796
|
+
|
797
|
+
return innermostIntersecting;
|
798
|
+
});
|
799
|
+
}
|
800
|
+
|
801
|
+
if ( innermostIntersecting ) {
|
802
|
+
// If it intersects, we use a little isOver variable and set it once,
|
803
|
+
// so that the move-in stuff gets fired only once.
|
804
|
+
if ( !sortable.isOver ) {
|
805
|
+
sortable.isOver = 1;
|
806
|
+
|
807
|
+
sortable.currentItem = ui.helper
|
808
|
+
.appendTo( sortable.element )
|
809
|
+
.data( "ui-sortable-item", true );
|
810
|
+
|
811
|
+
// Store helper option to later restore it
|
812
|
+
sortable.options._helper = sortable.options.helper;
|
813
|
+
|
814
|
+
sortable.options.helper = function() {
|
815
|
+
return ui.helper[ 0 ];
|
816
|
+
};
|
817
|
+
|
818
|
+
// Fire the start events of the sortable with our passed browser event,
|
819
|
+
// and our own helper (so it doesn't create a new one)
|
820
|
+
event.target = sortable.currentItem[ 0 ];
|
821
|
+
sortable._mouseCapture( event, true );
|
822
|
+
sortable._mouseStart( event, true, true );
|
823
|
+
|
824
|
+
// Because the browser event is way off the new appended portlet,
|
825
|
+
// modify necessary variables to reflect the changes
|
826
|
+
sortable.offset.click.top = draggable.offset.click.top;
|
827
|
+
sortable.offset.click.left = draggable.offset.click.left;
|
828
|
+
sortable.offset.parent.left -= draggable.offset.parent.left -
|
829
|
+
sortable.offset.parent.left;
|
830
|
+
sortable.offset.parent.top -= draggable.offset.parent.top -
|
831
|
+
sortable.offset.parent.top;
|
832
|
+
|
833
|
+
draggable._trigger( "toSortable", event );
|
834
|
+
|
835
|
+
// Inform draggable that the helper is in a valid drop zone,
|
836
|
+
// used solely in the revert option to handle "valid/invalid".
|
837
|
+
draggable.dropped = sortable.element;
|
838
|
+
|
839
|
+
// Need to refreshPositions of all sortables in the case that
|
840
|
+
// adding to one sortable changes the location of the other sortables (#9675)
|
841
|
+
$.each( draggable.sortables, function() {
|
842
|
+
this.refreshPositions();
|
843
|
+
});
|
844
|
+
|
845
|
+
// hack so receive/update callbacks work (mostly)
|
846
|
+
draggable.currentItem = draggable.element;
|
847
|
+
sortable.fromOutside = draggable;
|
848
|
+
}
|
849
|
+
|
850
|
+
if ( sortable.currentItem ) {
|
851
|
+
sortable._mouseDrag( event );
|
852
|
+
// Copy the sortable's position because the draggable's can potentially reflect
|
853
|
+
// a relative position, while sortable is always absolute, which the dragged
|
854
|
+
// element has now become. (#8809)
|
855
|
+
ui.position = sortable.position;
|
856
|
+
}
|
857
|
+
} else {
|
858
|
+
// If it doesn't intersect with the sortable, and it intersected before,
|
859
|
+
// we fake the drag stop of the sortable, but make sure it doesn't remove
|
860
|
+
// the helper by using cancelHelperRemoval.
|
861
|
+
if ( sortable.isOver ) {
|
862
|
+
|
863
|
+
sortable.isOver = 0;
|
864
|
+
sortable.cancelHelperRemoval = true;
|
865
|
+
|
866
|
+
// Calling sortable's mouseStop would trigger a revert,
|
867
|
+
// so revert must be temporarily false until after mouseStop is called.
|
868
|
+
sortable.options._revert = sortable.options.revert;
|
869
|
+
sortable.options.revert = false;
|
870
|
+
|
871
|
+
sortable._trigger( "out", event, sortable._uiHash( sortable ) );
|
872
|
+
sortable._mouseStop( event, true );
|
873
|
+
|
874
|
+
// restore sortable behaviors that were modfied
|
875
|
+
// when the draggable entered the sortable area (#9481)
|
876
|
+
sortable.options.revert = sortable.options._revert;
|
877
|
+
sortable.options.helper = sortable.options._helper;
|
878
|
+
|
879
|
+
if ( sortable.placeholder ) {
|
880
|
+
sortable.placeholder.remove();
|
881
|
+
}
|
882
|
+
|
883
|
+
// Recalculate the draggable's offset considering the sortable
|
884
|
+
// may have modified them in unexpected ways (#8809)
|
885
|
+
draggable._refreshOffsets( event );
|
886
|
+
ui.position = draggable._generatePosition( event, true );
|
887
|
+
|
888
|
+
draggable._trigger( "fromSortable", event );
|
889
|
+
|
890
|
+
// Inform draggable that the helper is no longer in a valid drop zone
|
891
|
+
draggable.dropped = false;
|
892
|
+
|
893
|
+
// Need to refreshPositions of all sortables just in case removing
|
894
|
+
// from one sortable changes the location of other sortables (#9675)
|
895
|
+
$.each( draggable.sortables, function() {
|
896
|
+
this.refreshPositions();
|
897
|
+
});
|
898
|
+
}
|
899
|
+
}
|
900
|
+
});
|
901
|
+
}
|
902
|
+
});
|
903
|
+
|
904
|
+
$.ui.plugin.add("draggable", "cursor", {
|
905
|
+
start: function( event, ui, instance ) {
|
906
|
+
var t = $( "body" ),
|
907
|
+
o = instance.options;
|
908
|
+
|
909
|
+
if (t.css("cursor")) {
|
910
|
+
o._cursor = t.css("cursor");
|
911
|
+
}
|
912
|
+
t.css("cursor", o.cursor);
|
913
|
+
},
|
914
|
+
stop: function( event, ui, instance ) {
|
915
|
+
var o = instance.options;
|
916
|
+
if (o._cursor) {
|
917
|
+
$("body").css("cursor", o._cursor);
|
918
|
+
}
|
919
|
+
}
|
920
|
+
});
|
921
|
+
|
922
|
+
$.ui.plugin.add("draggable", "opacity", {
|
923
|
+
start: function( event, ui, instance ) {
|
924
|
+
var t = $( ui.helper ),
|
925
|
+
o = instance.options;
|
926
|
+
if (t.css("opacity")) {
|
927
|
+
o._opacity = t.css("opacity");
|
928
|
+
}
|
929
|
+
t.css("opacity", o.opacity);
|
930
|
+
},
|
931
|
+
stop: function( event, ui, instance ) {
|
932
|
+
var o = instance.options;
|
933
|
+
if (o._opacity) {
|
934
|
+
$(ui.helper).css("opacity", o._opacity);
|
935
|
+
}
|
936
|
+
}
|
937
|
+
});
|
938
|
+
|
939
|
+
$.ui.plugin.add("draggable", "scroll", {
|
940
|
+
start: function( event, ui, i ) {
|
941
|
+
if ( !i.scrollParentNotHidden ) {
|
942
|
+
i.scrollParentNotHidden = i.helper.scrollParent( false );
|
943
|
+
}
|
944
|
+
|
945
|
+
if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {
|
946
|
+
i.overflowOffset = i.scrollParentNotHidden.offset();
|
947
|
+
}
|
948
|
+
},
|
949
|
+
drag: function( event, ui, i ) {
|
950
|
+
|
951
|
+
var o = i.options,
|
952
|
+
scrolled = false,
|
953
|
+
scrollParent = i.scrollParentNotHidden[ 0 ],
|
954
|
+
document = i.document[ 0 ];
|
955
|
+
|
956
|
+
if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {
|
957
|
+
if ( !o.axis || o.axis !== "x" ) {
|
958
|
+
if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < o.scrollSensitivity ) {
|
959
|
+
scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
|
960
|
+
} else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {
|
961
|
+
scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
|
962
|
+
}
|
963
|
+
}
|
964
|
+
|
965
|
+
if ( !o.axis || o.axis !== "y" ) {
|
966
|
+
if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < o.scrollSensitivity ) {
|
967
|
+
scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
|
968
|
+
} else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {
|
969
|
+
scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
|
970
|
+
}
|
971
|
+
}
|
972
|
+
|
973
|
+
} else {
|
974
|
+
|
975
|
+
if (!o.axis || o.axis !== "x") {
|
976
|
+
if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
|
977
|
+
scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
|
978
|
+
} else if ($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
|
979
|
+
scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
|
980
|
+
}
|
981
|
+
}
|
982
|
+
|
983
|
+
if (!o.axis || o.axis !== "y") {
|
984
|
+
if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
|
985
|
+
scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
|
986
|
+
} else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
|
987
|
+
scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
|
988
|
+
}
|
989
|
+
}
|
990
|
+
|
991
|
+
}
|
992
|
+
|
993
|
+
if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
|
994
|
+
$.ui.ddmanager.prepareOffsets(i, event);
|
995
|
+
}
|
996
|
+
|
997
|
+
}
|
998
|
+
});
|
999
|
+
|
1000
|
+
$.ui.plugin.add("draggable", "snap", {
|
1001
|
+
start: function( event, ui, i ) {
|
1002
|
+
|
1003
|
+
var o = i.options;
|
1004
|
+
|
1005
|
+
i.snapElements = [];
|
1006
|
+
|
1007
|
+
$(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() {
|
1008
|
+
var $t = $(this),
|
1009
|
+
$o = $t.offset();
|
1010
|
+
if (this !== i.element[0]) {
|
1011
|
+
i.snapElements.push({
|
1012
|
+
item: this,
|
1013
|
+
width: $t.outerWidth(), height: $t.outerHeight(),
|
1014
|
+
top: $o.top, left: $o.left
|
1015
|
+
});
|
1016
|
+
}
|
1017
|
+
});
|
1018
|
+
|
1019
|
+
},
|
1020
|
+
drag: function( event, ui, inst ) {
|
1021
|
+
|
1022
|
+
var ts, bs, ls, rs, l, r, t, b, i, first,
|
1023
|
+
o = inst.options,
|
1024
|
+
d = o.snapTolerance,
|
1025
|
+
x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
|
1026
|
+
y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
|
1027
|
+
|
1028
|
+
for (i = inst.snapElements.length - 1; i >= 0; i--){
|
1029
|
+
|
1030
|
+
l = inst.snapElements[i].left - inst.margins.left;
|
1031
|
+
r = l + inst.snapElements[i].width;
|
1032
|
+
t = inst.snapElements[i].top - inst.margins.top;
|
1033
|
+
b = t + inst.snapElements[i].height;
|
1034
|
+
|
1035
|
+
if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) {
|
1036
|
+
if (inst.snapElements[i].snapping) {
|
1037
|
+
(inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
|
1038
|
+
}
|
1039
|
+
inst.snapElements[i].snapping = false;
|
1040
|
+
continue;
|
1041
|
+
}
|
1042
|
+
|
1043
|
+
if (o.snapMode !== "inner") {
|
1044
|
+
ts = Math.abs(t - y2) <= d;
|
1045
|
+
bs = Math.abs(b - y1) <= d;
|
1046
|
+
ls = Math.abs(l - x2) <= d;
|
1047
|
+
rs = Math.abs(r - x1) <= d;
|
1048
|
+
if (ts) {
|
1049
|
+
ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top;
|
1050
|
+
}
|
1051
|
+
if (bs) {
|
1052
|
+
ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top;
|
1053
|
+
}
|
1054
|
+
if (ls) {
|
1055
|
+
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;
|
1056
|
+
}
|
1057
|
+
if (rs) {
|
1058
|
+
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left;
|
1059
|
+
}
|
1060
|
+
}
|
1061
|
+
|
1062
|
+
first = (ts || bs || ls || rs);
|
1063
|
+
|
1064
|
+
if (o.snapMode !== "outer") {
|
1065
|
+
ts = Math.abs(t - y1) <= d;
|
1066
|
+
bs = Math.abs(b - y2) <= d;
|
1067
|
+
ls = Math.abs(l - x1) <= d;
|
1068
|
+
rs = Math.abs(r - x2) <= d;
|
1069
|
+
if (ts) {
|
1070
|
+
ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top;
|
1071
|
+
}
|
1072
|
+
if (bs) {
|
1073
|
+
ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top;
|
1074
|
+
}
|
1075
|
+
if (ls) {
|
1076
|
+
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left;
|
1077
|
+
}
|
1078
|
+
if (rs) {
|
1079
|
+
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;
|
1080
|
+
}
|
1081
|
+
}
|
1082
|
+
|
1083
|
+
if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
|
1084
|
+
(inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
|
1085
|
+
}
|
1086
|
+
inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
|
1087
|
+
|
1088
|
+
}
|
1089
|
+
|
1090
|
+
}
|
1091
|
+
});
|
1092
|
+
|
1093
|
+
$.ui.plugin.add("draggable", "stack", {
|
1094
|
+
start: function( event, ui, instance ) {
|
1095
|
+
var min,
|
1096
|
+
o = instance.options,
|
1097
|
+
group = $.makeArray($(o.stack)).sort(function(a, b) {
|
1098
|
+
return (parseInt($(a).css("zIndex"), 10) || 0) - (parseInt($(b).css("zIndex"), 10) || 0);
|
1099
|
+
});
|
1100
|
+
|
1101
|
+
if (!group.length) { return; }
|
1102
|
+
|
1103
|
+
min = parseInt($(group[0]).css("zIndex"), 10) || 0;
|
1104
|
+
$(group).each(function(i) {
|
1105
|
+
$(this).css("zIndex", min + i);
|
1106
|
+
});
|
1107
|
+
this.css("zIndex", (min + group.length));
|
1108
|
+
}
|
1109
|
+
});
|
1110
|
+
|
1111
|
+
$.ui.plugin.add("draggable", "zIndex", {
|
1112
|
+
start: function( event, ui, instance ) {
|
1113
|
+
var t = $( ui.helper ),
|
1114
|
+
o = instance.options;
|
1115
|
+
|
1116
|
+
if (t.css("zIndex")) {
|
1117
|
+
o._zIndex = t.css("zIndex");
|
1118
|
+
}
|
1119
|
+
t.css("zIndex", o.zIndex);
|
1120
|
+
},
|
1121
|
+
stop: function( event, ui, instance ) {
|
1122
|
+
var o = instance.options;
|
1123
|
+
|
1124
|
+
if (o._zIndex) {
|
1125
|
+
$(ui.helper).css("zIndex", o._zIndex);
|
1126
|
+
}
|
1127
|
+
}
|
1128
|
+
});
|
1129
|
+
|
1130
|
+
return $.ui.draggable;
|
1131
|
+
|
1132
|
+
}));
|