|
102 | 102 | },
|
103 | 103 |
|
104 | 104 | interactables = [], // all set interactables
|
105 |
| - dropzones = [], // all dropzone element interactables |
106 | 105 |
|
107 | 106 | activeDrops = {
|
108 | 107 | dropzones: [], // the dropzones that are mentioned below
|
|
1131 | 1130 | element = element || target._element;
|
1132 | 1131 |
|
1133 | 1132 | // collect all dropzones and their elements which qualify for a drop
|
1134 |
| - for (i = 0; i < dropzones.length; i++) { |
1135 |
| - var current = dropzones[i]; |
| 1133 | + for (i = 0; i < interactables.length; i++) { |
| 1134 | + if (!interactables[i].options.dropzone) { continue; } |
| 1135 | + |
| 1136 | + var current = interactables[i]; |
1136 | 1137 |
|
1137 | 1138 | // test the draggable element against the dropzone's accept setting
|
1138 | 1139 | if ((isElement(current.options.accept) && current.options.accept !== element)
|
|
3043 | 3044 | return delegateListener.call(this, event, true);
|
3044 | 3045 | }
|
3045 | 3046 |
|
3046 |
| - interactables.indexOfElement = dropzones.indexOfElement = function indexOfElement (element, context) { |
| 3047 | + interactables.indexOfElement = function indexOfElement (element, context) { |
3047 | 3048 | for (var i = 0; i < this.length; i++) {
|
3048 | 3049 | var interactable = this[i];
|
3049 | 3050 |
|
|
3058 | 3059 | return -1;
|
3059 | 3060 | };
|
3060 | 3061 |
|
3061 |
| - interactables.get = dropzones.get = function interactableGet (element, options) { |
| 3062 | + interactables.get = function interactableGet (element, options) { |
3062 | 3063 | return this[this.indexOfElement(element, options && options.context)];
|
3063 | 3064 | };
|
3064 | 3065 |
|
|
3303 | 3304 | }
|
3304 | 3305 |
|
3305 | 3306 | this._dropElements = this.selector? null: [this._element];
|
3306 |
| - dropzones.push(this); |
3307 | 3307 |
|
3308 | 3308 | return this;
|
3309 | 3309 | }
|
3310 | 3310 |
|
3311 | 3311 | if (isBool(options)) {
|
3312 | 3312 | if (options) {
|
3313 | 3313 | this._dropElements = this.selector? null: [this._element];
|
3314 |
| - dropzones.push(this); |
3315 |
| - } |
3316 |
| - else { |
3317 |
| - var index = indexOf(dropzones, this); |
3318 |
| - |
3319 |
| - if (index !== -1) { |
3320 |
| - dropzones.splice(index, 1); |
3321 |
| - } |
3322 | 3314 | }
|
3323 | 3315 |
|
3324 | 3316 | this.options.dropzone = options;
|
|
4836 | 4828 | Interactable : Interactable,
|
4837 | 4829 | IOptions : IOptions,
|
4838 | 4830 | interactables : interactables,
|
4839 |
| - dropzones : dropzones, |
4840 | 4831 | pointerIsDown : pointerIsDown,
|
4841 | 4832 | defaultOptions : defaultOptions,
|
4842 | 4833 | defaultActionChecker : defaultActionChecker,
|
|
5109 | 5100 | if (dragging) {
|
5110 | 5101 | activeDrops.dropzones = activeDrops.elements = activeDrops.rects = null;
|
5111 | 5102 |
|
5112 |
| - for (var i = 0; i < dropzones.length; i++) { |
5113 |
| - if (dropzones[i].selector) { |
5114 |
| - dropzones[i]._dropElements = null; |
| 5103 | + for (var i = 0; i < interactables.length; i++) { |
| 5104 | + if (interactables[i].dropzone && interactables[i].selector) { |
| 5105 | + interactables[i]._dropElements = null; |
5115 | 5106 | }
|
5116 | 5107 | }
|
5117 | 5108 | }
|
|
0 commit comments