Revision 1374
Added by Dietmar over 13 years ago
dragdrop.js | ||
---|---|---|
36 | 36 |
return { |
37 | 37 |
/** |
38 | 38 |
* This property is used to turn on global use of the shim element on all DragDrop instances, defaults to false for backcompat. (Use: YAHOO.util.DDM.useShim = true) |
39 |
* @property useShim
|
|
40 |
* @type Boolean
|
|
41 |
* @static
|
|
39 |
* @property useShim |
|
40 |
* @type Boolean |
|
41 |
* @static |
|
42 | 42 |
*/ |
43 | 43 |
useShim: false, |
44 | 44 |
/** |
45 | 45 |
* This property is used to determine if the shim is active over the screen, default false. |
46 |
* @private
|
|
47 |
* @property _shimActive
|
|
48 |
* @type Boolean
|
|
49 |
* @static
|
|
46 |
* @private |
|
47 |
* @property _shimActive |
|
48 |
* @type Boolean |
|
49 |
* @static |
|
50 | 50 |
*/ |
51 | 51 |
_shimActive: false, |
52 | 52 |
/** |
53 | 53 |
* This property is used when useShim is set on a DragDrop object to store the current state of DDM.useShim so it can be reset when a drag operation is done. |
54 |
* @private
|
|
55 |
* @property _shimState
|
|
56 |
* @type Boolean
|
|
57 |
* @static
|
|
54 |
* @private |
|
55 |
* @property _shimState |
|
56 |
* @type Boolean |
|
57 |
* @static |
|
58 | 58 |
*/ |
59 | 59 |
_shimState: false, |
60 | 60 |
/** |
61 | 61 |
* This property is used when useShim is set to true, it will set the opacity on the shim to .5 for debugging. Use: (YAHOO.util.DDM._debugShim = true;) |
62 |
* @private
|
|
63 |
* @property _debugShim
|
|
64 |
* @type Boolean
|
|
65 |
* @static
|
|
62 |
* @private |
|
63 |
* @property _debugShim |
|
64 |
* @type Boolean |
|
65 |
* @static |
|
66 | 66 |
*/ |
67 | 67 |
_debugShim: false, |
68 | 68 |
/** |
69 | 69 |
* This method will create a shim element (giving it the id of yui-ddm-shim), it also attaches the mousemove and mouseup listeners to it and attaches a scroll listener on the window |
70 |
* @private
|
|
71 |
* @method _sizeShim
|
|
72 |
* @static
|
|
70 |
* @private |
|
71 |
* @method _sizeShim |
|
72 |
* @static |
|
73 | 73 |
*/ |
74 | 74 |
_createShim: function() { |
75 | 75 |
var s = document.createElement('div'); |
... | ... | |
91 | 91 |
}, |
92 | 92 |
/** |
93 | 93 |
* This method will size the shim, called from activate and on window scroll event |
94 |
* @private
|
|
95 |
* @method _sizeShim
|
|
96 |
* @static
|
|
94 |
* @private |
|
95 |
* @method _sizeShim |
|
96 |
* @static |
|
97 | 97 |
*/ |
98 | 98 |
_sizeShim: function() { |
99 | 99 |
if (this._shimActive) { |
... | ... | |
106 | 106 |
}, |
107 | 107 |
/** |
108 | 108 |
* This method will create the shim element if needed, then show the shim element, size the element and set the _shimActive property to true |
109 |
* @private
|
|
110 |
* @method _activateShim
|
|
111 |
* @static
|
|
109 |
* @private |
|
110 |
* @method _activateShim |
|
111 |
* @static |
|
112 | 112 |
*/ |
113 | 113 |
_activateShim: function() { |
114 | 114 |
if (this.useShim) { |
... | ... | |
128 | 128 |
}, |
129 | 129 |
/** |
130 | 130 |
* This method will hide the shim element and set the _shimActive property to false |
131 |
* @private
|
|
132 |
* @method _deactivateShim
|
|
133 |
* @static
|
|
131 |
* @private |
|
132 |
* @method _deactivateShim |
|
133 |
* @static |
|
134 | 134 |
*/ |
135 | 135 |
_deactivateShim: function() { |
136 | 136 |
this._shim.style.display = 'none'; |
... | ... | |
138 | 138 |
}, |
139 | 139 |
/** |
140 | 140 |
* The HTML element created to use as a shim over the document to track mouse movements |
141 |
* @private
|
|
142 |
* @property _shim
|
|
143 |
* @type HTMLElement
|
|
144 |
* @static
|
|
141 |
* @private |
|
142 |
* @property _shim |
|
143 |
* @type HTMLElement |
|
144 |
* @static |
|
145 | 145 |
*/ |
146 | 146 |
_shim: null, |
147 | 147 |
/** |
148 | 148 |
* Two dimensional Array of registered DragDrop objects. The first |
149 | 149 |
* dimension is the DragDrop item group, the second the DragDrop |
150 | 150 |
* object. |
151 |
* @property ids
|
|
152 |
* @type {string: string}
|
|
153 |
* @private
|
|
154 |
* @static
|
|
151 |
* @property ids |
|
152 |
* @type {string: string} |
|
153 |
* @private |
|
154 |
* @static |
|
155 | 155 |
*/ |
156 | 156 |
ids: {}, |
157 | 157 |
|
... | ... | |
159 | 159 |
* Array of element ids defined as drag handles. Used to determine |
160 | 160 |
* if the element that generated the mousedown event is actually the |
161 | 161 |
* handle and not the html element itself. |
162 |
* @property handleIds
|
|
163 |
* @type {string: string}
|
|
164 |
* @private
|
|
165 |
* @static
|
|
162 |
* @property handleIds |
|
163 |
* @type {string: string} |
|
164 |
* @private |
|
165 |
* @static |
|
166 | 166 |
*/ |
167 | 167 |
handleIds: {}, |
168 | 168 |
|
169 | 169 |
/** |
170 | 170 |
* the DragDrop object that is currently being dragged |
171 |
* @property dragCurrent
|
|
172 |
* @type DragDrop
|
|
173 |
* @private
|
|
174 |
* @static
|
|
171 |
* @property dragCurrent |
|
172 |
* @type DragDrop |
|
173 |
* @private |
|
174 |
* @static |
|
175 | 175 |
**/ |
176 | 176 |
dragCurrent: null, |
177 | 177 |
|
178 | 178 |
/** |
179 | 179 |
* the DragDrop object(s) that are being hovered over |
180 |
* @property dragOvers
|
|
181 |
* @type Array
|
|
182 |
* @private
|
|
183 |
* @static
|
|
180 |
* @property dragOvers |
|
181 |
* @type Array |
|
182 |
* @private |
|
183 |
* @static |
|
184 | 184 |
*/ |
185 | 185 |
dragOvers: {}, |
186 | 186 |
|
187 | 187 |
/** |
188 | 188 |
* the X distance between the cursor and the object being dragged |
189 |
* @property deltaX
|
|
190 |
* @type int
|
|
191 |
* @private
|
|
192 |
* @static
|
|
189 |
* @property deltaX |
|
190 |
* @type int |
|
191 |
* @private |
|
192 |
* @static |
|
193 | 193 |
*/ |
194 | 194 |
deltaX: 0, |
195 | 195 |
|
196 | 196 |
/** |
197 | 197 |
* the Y distance between the cursor and the object being dragged |
198 |
* @property deltaY
|
|
199 |
* @type int
|
|
200 |
* @private
|
|
201 |
* @static
|
|
198 |
* @property deltaY |
|
199 |
* @type int |
|
200 |
* @private |
|
201 |
* @static |
|
202 | 202 |
*/ |
203 | 203 |
deltaY: 0, |
204 | 204 |
|
... | ... | |
206 | 206 |
* Flag to determine if we should prevent the default behavior of the |
207 | 207 |
* events we define. By default this is true, but this can be set to |
208 | 208 |
* false if you need the default behavior (not recommended) |
209 |
* @property preventDefault
|
|
210 |
* @type boolean
|
|
211 |
* @static
|
|
209 |
* @property preventDefault |
|
210 |
* @type boolean |
|
211 |
* @static |
|
212 | 212 |
*/ |
213 | 213 |
preventDefault: true, |
214 | 214 |
|
... | ... | |
217 | 217 |
* we generate. This is true by default but you may want to set it to |
218 | 218 |
* false if the html element contains other features that require the |
219 | 219 |
* mouse click. |
220 |
* @property stopPropagation
|
|
221 |
* @type boolean
|
|
222 |
* @static
|
|
220 |
* @property stopPropagation |
|
221 |
* @type boolean |
|
222 |
* @static |
|
223 | 223 |
*/ |
224 | 224 |
stopPropagation: true, |
225 | 225 |
|
226 | 226 |
/** |
227 | 227 |
* Internal flag that is set to true when drag and drop has been |
228 | 228 |
* initialized |
229 |
* @property initialized
|
|
230 |
* @private
|
|
231 |
* @static
|
|
229 |
* @property initialized |
|
230 |
* @private |
|
231 |
* @static |
|
232 | 232 |
*/ |
233 | 233 |
initialized: false, |
234 | 234 |
|
235 | 235 |
/** |
236 | 236 |
* All drag and drop can be disabled. |
237 |
* @property locked
|
|
238 |
* @private
|
|
239 |
* @static
|
|
237 |
* @property locked |
|
238 |
* @private |
|
239 |
* @static |
|
240 | 240 |
*/ |
241 | 241 |
locked: false, |
242 | 242 |
|
... | ... | |
255 | 255 |
* sourceRegion: The location of the source elemtn at the time |
256 | 256 |
* of the interaction |
257 | 257 |
* validDrop: boolean |
258 |
* @property interactionInfo
|
|
259 |
* @type object
|
|
260 |
* @static
|
|
258 |
* @property interactionInfo |
|
259 |
* @type object |
|
260 |
* @static |
|
261 | 261 |
*/ |
262 | 262 |
interactionInfo: null, |
263 | 263 |
|
264 | 264 |
/** |
265 | 265 |
* Called the first time an element is registered. |
266 |
* @method init
|
|
267 |
* @private
|
|
268 |
* @static
|
|
266 |
* @method init |
|
267 |
* @private |
|
268 |
* @static |
|
269 | 269 |
*/ |
270 | 270 |
init: function() { |
271 | 271 |
this.initialized = true; |
... | ... | |
274 | 274 |
/** |
275 | 275 |
* In point mode, drag and drop interaction is defined by the |
276 | 276 |
* location of the cursor during the drag/drop |
277 |
* @property POINT
|
|
278 |
* @type int
|
|
279 |
* @static
|
|
280 |
* @final
|
|
277 |
* @property POINT |
|
278 |
* @type int |
|
279 |
* @static |
|
280 |
* @final |
|
281 | 281 |
*/ |
282 | 282 |
POINT: 0, |
283 | 283 |
|
... | ... | |
285 | 285 |
* In intersect mode, drag and drop interaction is defined by the |
286 | 286 |
* cursor position or the amount of overlap of two or more drag and |
287 | 287 |
* drop objects. |
288 |
* @property INTERSECT
|
|
289 |
* @type int
|
|
290 |
* @static
|
|
291 |
* @final
|
|
288 |
* @property INTERSECT |
|
289 |
* @type int |
|
290 |
* @static |
|
291 |
* @final |
|
292 | 292 |
*/ |
293 | 293 |
INTERSECT: 1, |
294 | 294 |
|
295 | 295 |
/** |
296 | 296 |
* In intersect mode, drag and drop interaction is defined only by the |
297 | 297 |
* overlap of two or more drag and drop objects. |
298 |
* @property STRICT_INTERSECT
|
|
299 |
* @type int
|
|
300 |
* @static
|
|
301 |
* @final
|
|
298 |
* @property STRICT_INTERSECT |
|
299 |
* @type int |
|
300 |
* @static |
|
301 |
* @final |
|
302 | 302 |
*/ |
303 | 303 |
STRICT_INTERSECT: 2, |
304 | 304 |
|
305 | 305 |
/** |
306 | 306 |
* The current drag and drop mode. Default: POINT |
307 |
* @property mode
|
|
308 |
* @type int
|
|
309 |
* @static
|
|
307 |
* @property mode |
|
308 |
* @type int |
|
309 |
* @static |
|
310 | 310 |
*/ |
311 | 311 |
mode: 0, |
312 | 312 |
|
313 | 313 |
/** |
314 | 314 |
* Runs method on all drag and drop objects |
315 |
* @method _execOnAll
|
|
316 |
* @private
|
|
317 |
* @static
|
|
315 |
* @method _execOnAll |
|
316 |
* @private |
|
317 |
* @static |
|
318 | 318 |
*/ |
319 | 319 |
_execOnAll: function(sMethod, args) { |
320 | 320 |
for (var i in this.ids) { |
... | ... | |
330 | 330 |
|
331 | 331 |
/** |
332 | 332 |
* Drag and drop initialization. Sets up the global event handlers |
333 |
* @method _onLoad
|
|
334 |
* @private
|
|
335 |
* @static
|
|
333 |
* @method _onLoad |
|
334 |
* @private |
|
335 |
* @static |
|
336 | 336 |
*/ |
337 | 337 |
_onLoad: function() { |
338 | 338 |
|
... | ... | |
348 | 348 |
|
349 | 349 |
/** |
350 | 350 |
* Reset constraints on all drag and drop objs |
351 |
* @method _onResize
|
|
352 |
* @private
|
|
353 |
* @static
|
|
351 |
* @method _onResize |
|
352 |
* @private |
|
353 |
* @static |
|
354 | 354 |
*/ |
355 | 355 |
_onResize: function(e) { |
356 | 356 |
this._execOnAll("resetConstraints", []); |
... | ... | |
358 | 358 |
|
359 | 359 |
/** |
360 | 360 |
* Lock all drag and drop functionality |
361 |
* @method lock
|
|
362 |
* @static
|
|
361 |
* @method lock |
|
362 |
* @static |
|
363 | 363 |
*/ |
364 | 364 |
lock: function() { this.locked = true; }, |
365 | 365 |
|
366 | 366 |
/** |
367 | 367 |
* Unlock all drag and drop functionality |
368 |
* @method unlock
|
|
369 |
* @static
|
|
368 |
* @method unlock |
|
369 |
* @static |
|
370 | 370 |
*/ |
371 | 371 |
unlock: function() { this.locked = false; }, |
372 | 372 |
|
373 | 373 |
/** |
374 | 374 |
* Is drag and drop locked? |
375 |
* @method isLocked
|
|
376 |
* @return {boolean} True if drag and drop is locked, false otherwise.
|
|
377 |
* @static
|
|
375 |
* @method isLocked |
|
376 |
* @return {boolean} True if drag and drop is locked, false otherwise. |
|
377 |
* @static |
|
378 | 378 |
*/ |
379 | 379 |
isLocked: function() { return this.locked; }, |
380 | 380 |
|
381 | 381 |
/** |
382 | 382 |
* Location cache that is set for all drag drop objects when a drag is |
383 | 383 |
* initiated, cleared when the drag is finished. |
384 |
* @property locationCache
|
|
385 |
* @private
|
|
386 |
* @static
|
|
384 |
* @property locationCache |
|
385 |
* @private |
|
386 |
* @static |
|
387 | 387 |
*/ |
388 | 388 |
locationCache: {}, |
389 | 389 |
|
390 | 390 |
/** |
391 | 391 |
* Set useCache to false if you want to force object the lookup of each |
392 | 392 |
* drag and drop linked element constantly during a drag. |
393 |
* @property useCache
|
|
394 |
* @type boolean
|
|
395 |
* @static
|
|
393 |
* @property useCache |
|
394 |
* @type boolean |
|
395 |
* @static |
|
396 | 396 |
*/ |
397 | 397 |
useCache: true, |
398 | 398 |
|
399 | 399 |
/** |
400 | 400 |
* The number of pixels that the mouse needs to move after the |
401 | 401 |
* mousedown before the drag is initiated. Default=3; |
402 |
* @property clickPixelThresh
|
|
403 |
* @type int
|
|
404 |
* @static
|
|
402 |
* @property clickPixelThresh |
|
403 |
* @type int |
|
404 |
* @static |
|
405 | 405 |
*/ |
406 | 406 |
clickPixelThresh: 3, |
407 | 407 |
|
408 | 408 |
/** |
409 | 409 |
* The number of milliseconds after the mousedown event to initiate the |
410 | 410 |
* drag if we don't get a mouseup event. Default=1000 |
411 |
* @property clickTimeThresh
|
|
412 |
* @type int
|
|
413 |
* @static
|
|
411 |
* @property clickTimeThresh |
|
412 |
* @type int |
|
413 |
* @static |
|
414 | 414 |
*/ |
415 | 415 |
clickTimeThresh: 1000, |
416 | 416 |
|
417 | 417 |
/** |
418 | 418 |
* Flag that indicates that either the drag pixel threshold or the |
419 | 419 |
* mousdown time threshold has been met |
420 |
* @property dragThreshMet
|
|
421 |
* @type boolean
|
|
422 |
* @private
|
|
423 |
* @static
|
|
420 |
* @property dragThreshMet |
|
421 |
* @type boolean |
|
422 |
* @private |
|
423 |
* @static |
|
424 | 424 |
*/ |
425 | 425 |
dragThreshMet: false, |
426 | 426 |
|
427 | 427 |
/** |
428 | 428 |
* Timeout used for the click time threshold |
429 |
* @property clickTimeout
|
|
430 |
* @type Object
|
|
431 |
* @private
|
|
432 |
* @static
|
|
429 |
* @property clickTimeout |
|
430 |
* @type Object |
|
431 |
* @private |
|
432 |
* @static |
|
433 | 433 |
*/ |
434 | 434 |
clickTimeout: null, |
435 | 435 |
|
436 | 436 |
/** |
437 | 437 |
* The X position of the mousedown event stored for later use when a |
438 | 438 |
* drag threshold is met. |
439 |
* @property startX
|
|
440 |
* @type int
|
|
441 |
* @private
|
|
442 |
* @static
|
|
439 |
* @property startX |
|
440 |
* @type int |
|
441 |
* @private |
|
442 |
* @static |
|
443 | 443 |
*/ |
444 | 444 |
startX: 0, |
445 | 445 |
|
446 | 446 |
/** |
447 | 447 |
* The Y position of the mousedown event stored for later use when a |
448 | 448 |
* drag threshold is met. |
449 |
* @property startY
|
|
450 |
* @type int
|
|
451 |
* @private
|
|
452 |
* @static
|
|
449 |
* @property startY |
|
450 |
* @type int |
|
451 |
* @private |
|
452 |
* @static |
|
453 | 453 |
*/ |
454 | 454 |
startY: 0, |
455 | 455 |
|
456 | 456 |
/** |
457 | 457 |
* Flag to determine if the drag event was fired from the click timeout and |
458 | 458 |
* not the mouse move threshold. |
459 |
* @property fromTimeout
|
|
460 |
* @type boolean
|
|
461 |
* @private
|
|
462 |
* @static
|
|
459 |
* @property fromTimeout |
|
460 |
* @type boolean |
|
461 |
* @private |
|
462 |
* @static |
|
463 | 463 |
*/ |
464 | 464 |
fromTimeout: false, |
465 | 465 |
|
466 | 466 |
/** |
467 | 467 |
* Each DragDrop instance must be registered with the DragDropMgr. |
468 | 468 |
* This is executed in DragDrop.init() |
469 |
* @method regDragDrop
|
|
470 |
* @param {DragDrop} oDD the DragDrop object to register
|
|
471 |
* @param {String} sGroup the name of the group this element belongs to
|
|
472 |
* @static
|
|
469 |
* @method regDragDrop |
|
470 |
* @param {DragDrop} oDD the DragDrop object to register |
|
471 |
* @param {String} sGroup the name of the group this element belongs to |
|
472 |
* @static |
|
473 | 473 |
*/ |
474 | 474 |
regDragDrop: function(oDD, sGroup) { |
475 | 475 |
if (!this.initialized) { this.init(); } |
... | ... | |
483 | 483 |
/** |
484 | 484 |
* Removes the supplied dd instance from the supplied group. Executed |
485 | 485 |
* by DragDrop.removeFromGroup, so don't call this function directly. |
486 |
* @method removeDDFromGroup
|
|
487 |
* @private
|
|
488 |
* @static
|
|
486 |
* @method removeDDFromGroup |
|
487 |
* @private |
|
488 |
* @static |
|
489 | 489 |
*/ |
490 | 490 |
removeDDFromGroup: function(oDD, sGroup) { |
491 | 491 |
if (!this.ids[sGroup]) { |
... | ... | |
501 | 501 |
/** |
502 | 502 |
* Unregisters a drag and drop item. This is executed in |
503 | 503 |
* DragDrop.unreg, use that method instead of calling this directly. |
504 |
* @method _remove
|
|
505 |
* @private
|
|
506 |
* @static
|
|
504 |
* @method _remove |
|
505 |
* @private |
|
506 |
* @static |
|
507 | 507 |
*/ |
508 | 508 |
_remove: function(oDD) { |
509 | 509 |
for (var g in oDD.groups) { |
... | ... | |
521 | 521 |
/** |
522 | 522 |
* Each DragDrop handle element must be registered. This is done |
523 | 523 |
* automatically when executing DragDrop.setHandleElId() |
524 |
* @method regHandle
|
|
525 |
* @param {String} sDDId the DragDrop id this element is a handle for
|
|
526 |
* @param {String} sHandleId the id of the element that is the drag
|
|
524 |
* @method regHandle |
|
525 |
* @param {String} sDDId the DragDrop id this element is a handle for |
|
526 |
* @param {String} sHandleId the id of the element that is the drag |
|
527 | 527 |
* handle |
528 |
* @static
|
|
528 |
* @static |
|
529 | 529 |
*/ |
530 | 530 |
regHandle: function(sDDId, sHandleId) { |
531 | 531 |
if (!this.handleIds[sDDId]) { |
... | ... | |
537 | 537 |
/** |
538 | 538 |
* Utility function to determine if a given element has been |
539 | 539 |
* registered as a drag drop item. |
540 |
* @method isDragDrop
|
|
541 |
* @param {String} id the element id to check
|
|
542 |
* @return {boolean} true if this element is a DragDrop item,
|
|
540 |
* @method isDragDrop |
|
541 |
* @param {String} id the element id to check |
|
542 |
* @return {boolean} true if this element is a DragDrop item, |
|
543 | 543 |
* false otherwise |
544 |
* @static
|
|
544 |
* @static |
|
545 | 545 |
*/ |
546 | 546 |
isDragDrop: function(id) { |
547 | 547 |
return ( this.getDDById(id) ) ? true : false; |
... | ... | |
550 | 550 |
/** |
551 | 551 |
* Returns the drag and drop instances that are in all groups the |
552 | 552 |
* passed in instance belongs to. |
553 |
* @method getRelated
|
|
554 |
* @param {DragDrop} p_oDD the obj to get related data for
|
|
555 |
* @param {boolean} bTargetsOnly if true, only return targetable objs
|
|
556 |
* @return {DragDrop[]} the related instances
|
|
557 |
* @static
|
|
553 |
* @method getRelated |
|
554 |
* @param {DragDrop} p_oDD the obj to get related data for |
|
555 |
* @param {boolean} bTargetsOnly if true, only return targetable objs |
|
556 |
* @return {DragDrop[]} the related instances |
|
557 |
* @static |
|
558 | 558 |
*/ |
559 | 559 |
getRelated: function(p_oDD, bTargetsOnly) { |
560 | 560 |
var oDDs = []; |
... | ... | |
576 | 576 |
/** |
577 | 577 |
* Returns true if the specified dd target is a legal target for |
578 | 578 |
* the specifice drag obj |
579 |
* @method isLegalTarget
|
|
580 |
* @param {DragDrop} the drag obj
|
|
581 |
* @param {DragDrop} the target
|
|
582 |
* @return {boolean} true if the target is a legal target for the
|
|
579 |
* @method isLegalTarget |
|
580 |
* @param {DragDrop} the drag obj |
|
581 |
* @param {DragDrop} the target |
|
582 |
* @return {boolean} true if the target is a legal target for the |
|
583 | 583 |
* dd obj |
584 |
* @static
|
|
584 |
* @static |
|
585 | 585 |
*/ |
586 | 586 |
isLegalTarget: function (oDD, oTargetDD) { |
587 | 587 |
var targets = this.getRelated(oDD, true); |
... | ... | |
600 | 600 |
* returns "object", oDD.constructor.toString() always returns |
601 | 601 |
* "DragDrop" and not the name of the subclass. So for now it just |
602 | 602 |
* evaluates a well-known variable in DragDrop. |
603 |
* @method isTypeOfDD
|
|
604 |
* @param {Object} the object to evaluate
|
|
605 |
* @return {boolean} true if typeof oDD = DragDrop
|
|
606 |
* @static
|
|
603 |
* @method isTypeOfDD |
|
604 |
* @param {Object} the object to evaluate |
|
605 |
* @return {boolean} true if typeof oDD = DragDrop |
|
606 |
* @static |
|
607 | 607 |
*/ |
608 | 608 |
isTypeOfDD: function (oDD) { |
609 | 609 |
return (oDD && oDD.__ygDragDrop); |
... | ... | |
612 | 612 |
/** |
613 | 613 |
* Utility function to determine if a given element has been |
614 | 614 |
* registered as a drag drop handle for the given Drag Drop object. |
615 |
* @method isHandle
|
|
616 |
* @param {String} id the element id to check
|
|
617 |
* @return {boolean} true if this element is a DragDrop handle, false
|
|
615 |
* @method isHandle |
|
616 |
* @param {String} id the element id to check |
|
617 |
* @return {boolean} true if this element is a DragDrop handle, false |
|
618 | 618 |
* otherwise |
619 |
* @static
|
|
619 |
* @static |
|
620 | 620 |
*/ |
621 | 621 |
isHandle: function(sDDId, sHandleId) { |
622 | 622 |
return ( this.handleIds[sDDId] && |
... | ... | |
625 | 625 |
|
626 | 626 |
/** |
627 | 627 |
* Returns the DragDrop instance for a given id |
628 |
* @method getDDById
|
|
629 |
* @param {String} id the id of the DragDrop object
|
|
630 |
* @return {DragDrop} the drag drop object, null if it is not found
|
|
631 |
* @static
|
|
628 |
* @method getDDById |
|
629 |
* @param {String} id the id of the DragDrop object |
|
630 |
* @return {DragDrop} the drag drop object, null if it is not found |
|
631 |
* @static |
|
632 | 632 |
*/ |
633 | 633 |
getDDById: function(id) { |
634 | 634 |
for (var i in this.ids) { |
... | ... | |
642 | 642 |
/** |
643 | 643 |
* Fired after a registered DragDrop object gets the mousedown event. |
644 | 644 |
* Sets up the events required to track the object being dragged |
645 |
* @method handleMouseDown
|
|
646 |
* @param {Event} e the event
|
|
647 |
* @param oDD the DragDrop object being dragged
|
|
648 |
* @private
|
|
649 |
* @static
|
|
645 |
* @method handleMouseDown |
|
646 |
* @param {Event} e the event |
|
647 |
* @param oDD the DragDrop object being dragged |
|
648 |
* @private |
|
649 |
* @static |
|
650 | 650 |
*/ |
651 | 651 |
handleMouseDown: function(e, oDD) { |
652 | 652 |
//this._activateShim(); |
... | ... | |
678 | 678 |
/** |
679 | 679 |
* Fired when either the drag pixel threshold or the mousedown hold |
680 | 680 |
* time threshold has been met. |
681 |
* @method startDrag
|
|
682 |
* @param x {int} the X position of the original mousedown
|
|
683 |
* @param y {int} the Y position of the original mousedown
|
|
684 |
* @static
|
|
681 |
* @method startDrag |
|
682 |
* @param x {int} the X position of the original mousedown |
|
683 |
* @param y {int} the Y position of the original mousedown |
|
684 |
* @static |
|
685 | 685 |
*/ |
686 | 686 |
startDrag: function(x, y) { |
687 | 687 |
if (this.dragCurrent && this.dragCurrent.useShim) { |
... | ... | |
705 | 705 |
/** |
706 | 706 |
* Internal function to handle the mouseup event. Will be invoked |
707 | 707 |
* from the context of the document. |
708 |
* @method handleMouseUp
|
|
709 |
* @param {Event} e the event
|
|
710 |
* @private
|
|
711 |
* @static
|
|
708 |
* @method handleMouseUp |
|
709 |
* @param {Event} e the event |
|
710 |
* @private |
|
711 |
* @static |
|
712 | 712 |
*/ |
713 | 713 |
handleMouseUp: function(e) { |
714 | 714 |
if (this.dragCurrent) { |
... | ... | |
733 | 733 |
/** |
734 | 734 |
* Utility to stop event propagation and event default, if these |
735 | 735 |
* features are turned on. |
736 |
* @method stopEvent
|
|
737 |
* @param {Event} e the event as returned by this.getEvent()
|
|
738 |
* @static
|
|
736 |
* @method stopEvent |
|
737 |
* @param {Event} e the event as returned by this.getEvent() |
|
738 |
* @static |
|
739 | 739 |
*/ |
740 | 740 |
stopEvent: function(e) { |
741 | 741 |
if (this.stopPropagation) { |
... | ... | |
757 | 757 |
* for the silent parameter so that the endDrag and onMouseUp events |
758 | 758 |
* are skipped (so no event data is needed.) |
759 | 759 |
* |
760 |
* @method stopDrag
|
|
761 |
* @param {Event} e the mouseup event, another event (or a fake event)
|
|
760 |
* @method stopDrag |
|
761 |
* @param {Event} e the mouseup event, another event (or a fake event) |
|
762 | 762 |
* with pageX and pageY defined, or nothing if the |
763 | 763 |
* silent parameter is true |
764 |
* @param {boolean} silent skips the enddrag and mouseup events if true
|
|
765 |
* @static
|
|
764 |
* @param {boolean} silent skips the enddrag and mouseup events if true |
|
765 |
* @static |
|
766 | 766 |
*/ |
767 | 767 |
stopDrag: function(e, silent) { |
768 | 768 |
var dc = this.dragCurrent; |
... | ... | |
800 | 800 |
* Internal function to handle the mousemove event. Will be invoked |
801 | 801 |
* from the context of the html element. |
802 | 802 |
* |
803 |
* @TODO figure out what we can do about mouse events lost when the
|
|
803 |
* @TODO figure out what we can do about mouse events lost when the |
|
804 | 804 |
* user drags objects beyond the window boundary. Currently we can |
805 | 805 |
* detect this in internet explorer by verifying that the mouse is |
806 | 806 |
* down during the mousemove event. Firefox doesn't give us the |
807 | 807 |
* button state on the mousemove event. |
808 |
* @method handleMouseMove
|
|
809 |
* @param {Event} e the event
|
|
810 |
* @private
|
|
811 |
* @static
|
|
808 |
* @method handleMouseMove |
|
809 |
* @param {Event} e the event |
|
810 |
* @private |
|
811 |
* @static |
|
812 | 812 |
*/ |
813 | 813 |
handleMouseMove: function(e) { |
814 | 814 |
|
... | ... | |
860 | 860 |
/** |
861 | 861 |
* Iterates over all of the DragDrop elements to find ones we are |
862 | 862 |
* hovering over or dropping on |
863 |
* @method fireEvents
|
|
864 |
* @param {Event} e the event
|
|
865 |
* @param {boolean} isDrop is this a drop op or a mouseover op?
|
|
866 |
* @private
|
|
867 |
* @static
|
|
863 |
* @method fireEvents |
|
864 |
* @param {Event} e the event |
|
865 |
* @param {boolean} isDrop is this a drop op or a mouseover op? |
|
866 |
* @private |
|
867 |
* @static |
|
868 | 868 |
*/ |
869 | 869 |
fireEvents: function(e, isDrop) { |
870 | 870 |
var dc = this.dragCurrent; |
... | ... | |
1018 | 1018 |
* in INTERSECT mode. It returns either the first object that the |
1019 | 1019 |
* cursor is over, or the object that has the greatest overlap with |
1020 | 1020 |
* the dragged element. |
1021 |
* @method getBestMatch
|
|
1022 |
* @param {DragDrop[]} dds The array of drag and drop objects
|
|
1021 |
* @method getBestMatch |
|
1022 |
* @param {DragDrop[]} dds The array of drag and drop objects |
|
1023 | 1023 |
* targeted |
1024 |
* @return {DragDrop} The best single match
|
|
1025 |
* @static
|
|
1024 |
* @return {DragDrop} The best single match |
|
1025 |
* @static |
|
1026 | 1026 |
*/ |
1027 | 1027 |
getBestMatch: function(dds) { |
1028 | 1028 |
var winner = null; |
... | ... | |
1066 | 1066 |
* <code> |
1067 | 1067 |
* YAHOO.util.DragDropMgr.refreshCache({group1:true, group2:true}); |
1068 | 1068 |
* </code> |
1069 |
* @TODO this really should be an indexed array. Alternatively this
|
|
1069 |
* @TODO this really should be an indexed array. Alternatively this |
|
1070 | 1070 |
* method could accept both. |
1071 |
* @method refreshCache
|
|
1072 |
* @param {Object} groups an associative array of groups to refresh
|
|
1073 |
* @static
|
|
1071 |
* @method refreshCache |
|
1072 |
* @param {Object} groups an associative array of groups to refresh |
|
1073 |
* @static |
|
1074 | 1074 |
*/ |
1075 | 1075 |
refreshCache: function(groups) { |
1076 | 1076 |
|
... | ... | |
1101 | 1101 |
* main purpose is to handle cases where innerHTML is used to remove |
1102 | 1102 |
* drag and drop objects from the DOM. IE provides an 'unspecified |
1103 | 1103 |
* error' when trying to access the offsetParent of such an element |
1104 |
* @method verifyEl
|
|
1105 |
* @param {HTMLElement} el the element to check
|
|
1106 |
* @return {boolean} true if the element looks usable
|
|
1107 |
* @static
|
|
1104 |
* @method verifyEl |
|
1105 |
* @param {HTMLElement} el the element to check |
|
1106 |
* @return {boolean} true if the element looks usable |
|
1107 |
* @static |
|
1108 | 1108 |
*/ |
1109 | 1109 |
verifyEl: function(el) { |
1110 | 1110 |
try { |
... | ... | |
1123 | 1123 |
/** |
1124 | 1124 |
* Returns a Region object containing the drag and drop element's position |
1125 | 1125 |
* and size, including the padding configured for it |
1126 |
* @method getLocation
|
|
1127 |
* @param {DragDrop} oDD the drag and drop object to get the
|
|
1126 |
* @method getLocation |
|
1127 |
* @param {DragDrop} oDD the drag and drop object to get the |
|
1128 | 1128 |
* location for |
1129 |
* @return {YAHOO.util.Region} a Region object representing the total area
|
|
1129 |
* @return {YAHOO.util.Region} a Region object representing the total area |
|
1130 | 1130 |
* the element occupies, including any padding |
1131 | 1131 |
* the instance is configured for. |
1132 |
* @static
|
|
1132 |
* @static |
|
1133 | 1133 |
*/ |
1134 | 1134 |
getLocation: function(oDD) { |
1135 | 1135 |
if (! this.isTypeOfDD(oDD)) { |
... | ... | |
1161 | 1161 |
|
1162 | 1162 |
/** |
1163 | 1163 |
* Checks the cursor location to see if it over the target |
1164 |
* @method isOverTarget
|
|
1165 |
* @param {YAHOO.util.Point} pt The point to evaluate
|
|
1166 |
* @param {DragDrop} oTarget the DragDrop object we are inspecting
|
|
1167 |
* @param {boolean} intersect true if we are in intersect mode
|
|
1168 |
* @param {YAHOO.util.Region} pre-cached location of the dragged element
|
|
1169 |
* @return {boolean} true if the mouse is over the target
|
|
1170 |
* @private
|
|
1171 |
* @static
|
|
1164 |
* @method isOverTarget |
|
1165 |
* @param {YAHOO.util.Point} pt The point to evaluate |
|
1166 |
* @param {DragDrop} oTarget the DragDrop object we are inspecting |
|
1167 |
* @param {boolean} intersect true if we are in intersect mode |
|
1168 |
* @param {YAHOO.util.Region} pre-cached location of the dragged element |
|
1169 |
* @return {boolean} true if the mouse is over the target |
|
1170 |
* @private |
|
1171 |
* @static |
|
1172 | 1172 |
*/ |
1173 | 1173 |
isOverTarget: function(pt, oTarget, intersect, curRegion) { |
1174 | 1174 |
// use cache if available |
... | ... | |
1228 | 1228 |
|
1229 | 1229 |
/** |
1230 | 1230 |
* unload event handler |
1231 |
* @method _onUnload
|
|
1232 |
* @private
|
|
1233 |
* @static
|
|
1231 |
* @method _onUnload |
|
1232 |
* @private |
|
1233 |
* @static |
|
1234 | 1234 |
*/ |
1235 | 1235 |
_onUnload: function(e, me) { |
1236 | 1236 |
this.unregAll(); |
... | ... | |
1238 | 1238 |
|
1239 | 1239 |
/** |
1240 | 1240 |
* Cleans up the drag and drop events and objects. |
1241 |
* @method unregAll
|
|
1242 |
* @private
|
|
1243 |
* @static
|
|
1241 |
* @method unregAll |
|
1242 |
* @private |
|
1243 |
* @static |
|
1244 | 1244 |
*/ |
1245 | 1245 |
unregAll: function() { |
1246 | 1246 |
|
... | ... | |
1261 | 1261 |
|
1262 | 1262 |
/** |
1263 | 1263 |
* A cache of DOM elements |
1264 |
* @property elementCache
|
|
1265 |
* @private
|
|
1266 |
* @static
|
|
1267 |
* @deprecated elements are not cached now
|
|
1264 |
* @property elementCache |
|
1265 |
* @private |
|
1266 |
* @static |
|
1267 |
* @deprecated elements are not cached now |
|
1268 | 1268 |
*/ |
1269 | 1269 |
elementCache: {}, |
1270 | 1270 |
|
1271 | 1271 |
/** |
1272 | 1272 |
* Get the wrapper for the DOM element specified |
1273 |
* @method getElWrapper
|
|
1274 |
* @param {String} id the id of the element to get
|
|
1275 |
* @return {YAHOO.util.DDM.ElementWrapper} the wrapped element
|
|
1276 |
* @private
|
|
1277 |
* @deprecated This wrapper isn't that useful
|
|
1278 |
* @static
|
|
1273 |
* @method getElWrapper |
|
1274 |
* @param {String} id the id of the element to get |
|
1275 |
* @return {YAHOO.util.DDM.ElementWrapper} the wrapped element |
|
1276 |
* @private |
|
1277 |
* @deprecated This wrapper isn't that useful |
|
1278 |
* @static |
|
1279 | 1279 |
*/ |
1280 | 1280 |
getElWrapper: function(id) { |
1281 | 1281 |
var oWrapper = this.elementCache[id]; |
... | ... | |
1288 | 1288 |
|
1289 | 1289 |
/** |
1290 | 1290 |
* Returns the actual DOM element |
1291 |
* @method getElement
|
|
1292 |
* @param {String} id the id of the elment to get
|
|
1293 |
* @return {Object} The element
|
|
1294 |
* @deprecated use YAHOO.util.Dom.get instead
|
|
1295 |
* @static
|
|
1291 |
* @method getElement |
|
1292 |
* @param {String} id the id of the elment to get |
|
1293 |
* @return {Object} The element |
|
1294 |
* @deprecated use YAHOO.util.Dom.get instead |
|
1295 |
* @static |
|
1296 | 1296 |
*/ |
1297 | 1297 |
getElement: function(id) { |
1298 | 1298 |
return YAHOO.util.Dom.get(id); |
... | ... | |
1301 | 1301 |
/** |
1302 | 1302 |
* Returns the style property for the DOM element (i.e., |
1303 | 1303 |
* document.getElById(id).style) |
1304 |
* @method getCss
|
|
1305 |
* @param {String} id the id of the elment to get
|
|
1306 |
* @return {Object} The style property of the element
|
|
1307 |
* @deprecated use YAHOO.util.Dom instead
|
|
1308 |
* @static
|
|
1304 |
* @method getCss |
|
1305 |
* @param {String} id the id of the elment to get |
|
1306 |
* @return {Object} The style property of the element |
|
1307 |
* @deprecated use YAHOO.util.Dom instead |
|
1308 |
* @static |
|
1309 | 1309 |
*/ |
1310 | 1310 |
getCss: function(id) { |
1311 | 1311 |
var el = YAHOO.util.Dom.get(id); |
... | ... | |
1314 | 1314 |
|
1315 | 1315 |
/** |
1316 | 1316 |
* Inner class for cached elements |
1317 |
* @class DragDropMgr.ElementWrapper
|
|
1318 |
* @for DragDropMgr
|
|
1319 |
* @private
|
|
1320 |
* @deprecated
|
|
1317 |
* @class DragDropMgr.ElementWrapper |
|
1318 |
* @for DragDropMgr |
|
1319 |
* @private |
|
1320 |
* @deprecated |
|
1321 | 1321 |
*/ |
1322 | 1322 |
ElementWrapper: function(el) { |
1323 | 1323 |
/** |
1324 | 1324 |
* The element |
1325 |
* @property el
|
|
1325 |
* @property el |
|
1326 | 1326 |
*/ |
1327 | 1327 |
this.el = el || null; |
1328 | 1328 |
/** |
1329 | 1329 |
* The element id |
1330 |
* @property id
|
|
1330 |
* @property id |
|
1331 | 1331 |
*/ |
1332 | 1332 |
this.id = this.el && el.id; |
1333 | 1333 |
/** |
1334 | 1334 |
* A reference to the style property |
1335 |
* @property css
|
|
1335 |
* @property css |
|
1336 | 1336 |
*/ |
1337 | 1337 |
this.css = this.el && el.style; |
1338 | 1338 |
}, |
1339 | 1339 |
|
1340 | 1340 |
/** |
1341 | 1341 |
* Returns the X position of an html element |
1342 |
* @method getPosX
|
|
1343 |
* @param el the element for which to get the position
|
|
1344 |
* @return {int} the X coordinate
|
|
1345 |
* @for DragDropMgr
|
|
1346 |
* @deprecated use YAHOO.util.Dom.getX instead
|
|
1347 |
* @static
|
|
1342 |
* @method getPosX |
|
1343 |
* @param el the element for which to get the position |
|
1344 |
* @return {int} the X coordinate |
|
1345 |
* @for DragDropMgr |
|
1346 |
* @deprecated use YAHOO.util.Dom.getX instead |
|
1347 |
* @static |
|
1348 | 1348 |
*/ |
1349 | 1349 |
getPosX: function(el) { |
1350 | 1350 |
return YAHOO.util.Dom.getX(el); |
... | ... | |
1352 | 1352 |
|
1353 | 1353 |
/** |
1354 | 1354 |
* Returns the Y position of an html element |
1355 |
* @method getPosY
|
|
1356 |
* @param el the element for which to get the position
|
|
1357 |
* @return {int} the Y coordinate
|
|
1358 |
* @deprecated use YAHOO.util.Dom.getY instead
|
|
1359 |
* @static
|
|
1355 |
* @method getPosY |
|
1356 |
* @param el the element for which to get the position |
|
1357 |
* @return {int} the Y coordinate |
|
1358 |
* @deprecated use YAHOO.util.Dom.getY instead |
|
1359 |
* @static |
|
1360 | 1360 |
*/ |
1361 | 1361 |
getPosY: function(el) { |
1362 | 1362 |
return YAHOO.util.Dom.getY(el); |
... | ... | |
1365 | 1365 |
/** |
1366 | 1366 |
* Swap two nodes. In IE, we use the native method, for others we |
1367 | 1367 |
* emulate the IE behavior |
1368 |
* @method swapNode
|
|
1369 |
* @param n1 the first node to swap
|
|
1370 |
* @param n2 the other node to swap
|
|
1371 |
* @static
|
|
1368 |
* @method swapNode |
|
1369 |
* @param n1 the first node to swap |
|
1370 |
* @param n2 the other node to swap |
|
1371 |
* @static |
|
1372 | 1372 |
*/ |
1373 | 1373 |
swapNode: function(n1, n2) { |
1374 | 1374 |
if (n1.swapNode) { |
... | ... | |
1390 | 1390 |
|
1391 | 1391 |
/** |
1392 | 1392 |
* Returns the current scroll position |
1393 |
* @method getScroll
|
|
1394 |
* @private
|
|
1395 |
* @static
|
|
1393 |
* @method getScroll |
|
1394 |
* @private |
|
1395 |
* @static |
|
1396 | 1396 |
*/ |
1397 | 1397 |
getScroll: function () { |
1398 | 1398 |
var t, l, dde=document.documentElement, db=document.body; |
... | ... | |
1409 | 1409 |
|
1410 | 1410 |
/** |
1411 | 1411 |
* Returns the specified element style property |
1412 |
* @method getStyle
|
|
1413 |
* @param {HTMLElement} el the element
|
|
1414 |
* @param {string} styleProp the style property
|
|
1415 |
* @return {string} The value of the style property
|
|
1416 |
* @deprecated use YAHOO.util.Dom.getStyle
|
|
1417 |
* @static
|
|
1412 |
* @method getStyle |
|
1413 |
* @param {HTMLElement} el the element |
|
1414 |
* @param {string} styleProp the style property |
|
1415 |
* @return {string} The value of the style property |
|
1416 |
* @deprecated use YAHOO.util.Dom.getStyle |
|
1417 |
* @static |
|
1418 | 1418 |
*/ |
1419 | 1419 |
getStyle: function(el, styleProp) { |
1420 | 1420 |
return YAHOO.util.Dom.getStyle(el, styleProp); |
... | ... | |
1422 | 1422 |
|
1423 | 1423 |
/** |
1424 | 1424 |
* Gets the scrollTop |
1425 |
* @method getScrollTop
|
|
1426 |
* @return {int} the document's scrollTop
|
|
1427 |
* @static
|
|
1425 |
* @method getScrollTop |
|
1426 |
* @return {int} the document's scrollTop |
|
1427 |
* @static |
|
1428 | 1428 |
*/ |
1429 | 1429 |
getScrollTop: function () { return this.getScroll().top; }, |
1430 | 1430 |
|
1431 | 1431 |
/** |
1432 | 1432 |
* Gets the scrollLeft |
1433 |
* @method getScrollLeft
|
|
1434 |
* @return {int} the document's scrollTop
|
|
1435 |
* @static
|
|
1433 |
* @method getScrollLeft |
|
1434 |
* @return {int} the document's scrollTop |
|
1435 |
* @static |
|
1436 | 1436 |
*/ |
1437 | 1437 |
getScrollLeft: function () { return this.getScroll().left; }, |
1438 | 1438 |
|
1439 | 1439 |
/** |
1440 | 1440 |
* Sets the x/y position of an element to the location of the |
1441 | 1441 |
* target element. |
1442 |
* @method moveToEl
|
|
1443 |
* @param {HTMLElement} moveEl The element to move
|
|
1444 |
* @param {HTMLElement} targetEl The position reference element
|
|
1445 |
* @static
|
|
1442 |
* @method moveToEl |
|
1443 |
* @param {HTMLElement} moveEl The element to move |
|
1444 |
* @param {HTMLElement} targetEl The position reference element |
|
1445 |
* @static |
|
1446 | 1446 |
*/ |
1447 | 1447 |
moveToEl: function (moveEl, targetEl) { |
1448 | 1448 |
var aCoord = YAHOO.util.Dom.getXY(targetEl); |
... | ... | |
1451 | 1451 |
|
1452 | 1452 |
/** |
1453 | 1453 |
* Gets the client height |
1454 |
* @method getClientHeight
|
|
1455 |
* @return {int} client height in px
|
|
1456 |
* @deprecated use YAHOO.util.Dom.getViewportHeight instead
|
|
1457 |
* @static
|
|
1454 |
* @method getClientHeight |
|
1455 |
* @return {int} client height in px |
|
1456 |
* @deprecated use YAHOO.util.Dom.getViewportHeight instead |
|
1457 |
* @static |
|
1458 | 1458 |
*/ |
1459 | 1459 |
getClientHeight: function() { |
1460 | 1460 |
return YAHOO.util.Dom.getViewportHeight(); |
... | ... | |
1462 | 1462 |
|
1463 | 1463 |
/** |
1464 | 1464 |
* Gets the client width |
1465 |
* @method getClientWidth
|
|
1466 |
* @return {int} client width in px
|
|
1467 |
* @deprecated use YAHOO.util.Dom.getViewportWidth instead
|
|
1468 |
* @static
|
|
1465 |
* @method getClientWidth |
|
1466 |
* @return {int} client width in px |
|
1467 |
* @deprecated use YAHOO.util.Dom.getViewportWidth instead |
|
1468 |
* @static |
|
1469 | 1469 |
*/ |
1470 | 1470 |
getClientWidth: function() { |
1471 | 1471 |
return YAHOO.util.Dom.getViewportWidth(); |
... | ... | |
1473 | 1473 |
|
1474 | 1474 |
/** |
1475 | 1475 |
* Numeric array sort function |
1476 |
* @method numericSort
|
|
1477 |
* @static
|
|
1476 |
* @method numericSort |
|
1477 |
* @static |
|
1478 | 1478 |
*/ |
1479 | 1479 |
numericSort: function(a, b) { return (a - b); }, |
1480 | 1480 |
|
1481 | 1481 |
/** |
1482 | 1482 |
* Internal counter |
1483 |
* @property _timeoutCount
|
|
1484 |
* @private
|
|
1485 |
* @static
|
|
1483 |
* @property _timeoutCount |
|
1484 |
* @private |
|
1485 |
* @static |
|
1486 | 1486 |
*/ |
1487 | 1487 |
_timeoutCount: 0, |
1488 | 1488 |
|
1489 | 1489 |
/** |
1490 | 1490 |
* Trying to make the load order less important. Without this we get |
1491 | 1491 |
* an error if this file is loaded before the Event Utility. |
1492 |
* @method _addListeners
|
|
1493 |
* @private
|
|
1494 |
* @static
|
|
1492 |
* @method _addListeners |
|
1493 |
* @private |
|
1494 |
* @static |
|
1495 | 1495 |
*/ |
1496 | 1496 |
_addListeners: function() { |
1497 | 1497 |
var DDM = YAHOO.util.DDM; |
... | ... | |
1512 | 1512 |
* Recursively searches the immediate parent and all child nodes for |
1513 | 1513 |
* the handle element in order to determine wheter or not it was |
1514 | 1514 |
* clicked. |
1515 |
* @method handleWasClicked
|
|
1516 |
* @param node the html element to inspect
|
|
1517 |
* @static
|
|
1515 |
* @method handleWasClicked |
|
1516 |
* @param node the html element to inspect |
|
1517 |
* @static |
|
1518 | 1518 |
*/ |
1519 | 1519 |
handleWasClicked: function(node, id) { |
1520 | 1520 |
if (this.isHandle(id, node.id)) { |
... | ... | |
1605 | 1605 |
/** |
1606 | 1606 |
* An Object Literal containing the events that we will be using: mouseDown, b4MouseDown, mouseUp, b4StartDrag, startDrag, b4EndDrag, endDrag, mouseUp, drag, b4Drag, invalidDrop, b4DragOut, dragOut, dragEnter, b4DragOver, dragOver, b4DragDrop, dragDrop |
1607 | 1607 |
* By setting any of these to false, then event will not be fired. |
1608 |
* @property events
|
|
1609 |
* @type object
|
|
1608 |
* @property events |
|
1609 |
* @type object |
|
1610 | 1610 |
*/ |
1611 | 1611 |
events: null, |
1612 | 1612 |
/** |
1613 |
* @method on
|
|
1614 |
* @description Shortcut for EventProvider.subscribe, see <a href="YAHOO.util.EventProvider.html#subscribe">YAHOO.util.EventProvider.subscribe</a>
|
|
1613 |
* @method on |
|
1614 |
* @description Shortcut for EventProvider.subscribe, see <a href="YAHOO.util.EventProvider.html#subscribe">YAHOO.util.EventProvider.subscribe</a> |
|
1615 | 1615 |
*/ |
1616 | 1616 |
on: function() { |
1617 | 1617 |
this.subscribe.apply(this, arguments); |
... | ... | |
1621 | 1621 |
* refer to as the "linked element" because the size and position of |
1622 | 1622 |
* this element is used to determine when the drag and drop objects have |
1623 | 1623 |
* interacted. |
1624 |
* @property id
|
|
1625 |
* @type String
|
|
1624 |
* @property id |
|
1625 |
* @type String |
|
1626 | 1626 |
*/ |
1627 | 1627 |
id: null, |
1628 | 1628 |
|
1629 | 1629 |
/** |
1630 | 1630 |
* Configuration attributes passed into the constructor |
1631 |
* @property config
|
|
1632 |
* @type object
|
|
1631 |
* @property config |
|
1632 |
* @type object |
|
1633 | 1633 |
*/ |
1634 | 1634 |
config: null, |
1635 | 1635 |
|
... | ... | |
1637 | 1637 |
* The id of the element that will be dragged. By default this is same |
1638 | 1638 |
* as the linked element , but could be changed to another element. Ex: |
1639 | 1639 |
* YAHOO.util.DDProxy |
1640 |
* @property dragElId
|
|
1641 |
* @type String
|
|
1642 |
* @private
|
|
1640 |
* @property dragElId |
|
1641 |
* @type String |
|
1642 |
* @private |
|
1643 | 1643 |
*/ |
1644 | 1644 |
dragElId: null, |
1645 | 1645 |
|
... | ... | |
1648 | 1648 |
* this is the linked element, but could be changed to be a child of this |
1649 | 1649 |
* element. This lets us do things like only starting the drag when the |
1650 | 1650 |
* header element within the linked html element is clicked. |
1651 |
* @property handleElId
|
|
1652 |
* @type String
|
|
1653 |
* @private
|
|
1651 |
* @property handleElId |
|
1652 |
* @type String |
|
1653 |
* @private |
|
1654 | 1654 |
*/ |
1655 | 1655 |
handleElId: null, |
1656 | 1656 |
|
1657 | 1657 |
/** |
1658 | 1658 |
* An associative array of HTML tags that will be ignored if clicked. |
1659 |
* @property invalidHandleTypes
|
|
1660 |
* @type {string: string}
|
|
1659 |
* @property invalidHandleTypes |
|
1660 |
* @type {string: string} |
|
1661 | 1661 |
*/ |
1662 | 1662 |
invalidHandleTypes: null, |
1663 | 1663 |
|
1664 | 1664 |
/** |
1665 | 1665 |
* An associative array of ids for elements that will be ignored if clicked |
1666 |
* @property invalidHandleIds
|
|
1667 |
* @type {string: string}
|
|
1666 |
* @property invalidHandleIds |
|
1667 |
* @type {string: string} |
|
1668 | 1668 |
*/ |
1669 | 1669 |
invalidHandleIds: null, |
1670 | 1670 |
|
1671 | 1671 |
/** |
1672 | 1672 |
* An indexted array of css class names for elements that will be ignored |
1673 | 1673 |
* if clicked. |
1674 |
* @property invalidHandleClasses
|
|
1675 |
* @type string[]
|
|
1674 |
* @property invalidHandleClasses |
|
1675 |
* @type string[] |
|
1676 | 1676 |
*/ |
1677 | 1677 |
invalidHandleClasses: null, |
1678 | 1678 |
|
1679 | 1679 |
/** |
1680 | 1680 |
* The linked element's absolute X position at the time the drag was |
1681 | 1681 |
* started |
1682 |
* @property startPageX
|
|
1683 |
* @type int
|
|
1684 |
* @private
|
|
1682 |
* @property startPageX |
|
1683 |
* @type int |
|
1684 |
* @private |
|
1685 | 1685 |
*/ |
1686 | 1686 |
startPageX: 0, |
1687 | 1687 |
|
1688 | 1688 |
/** |
1689 | 1689 |
* The linked element's absolute X position at the time the drag was |
1690 | 1690 |
* started |
1691 |
* @property startPageY
|
|
1692 |
* @type int
|
|
1693 |
* @private
|
|
1691 |
* @property startPageY |
|
1692 |
* @type int |
|
1693 |
* @private |
|
1694 | 1694 |
*/ |
1695 | 1695 |
startPageY: 0, |
1696 | 1696 |
|
... | ... | |
1699 | 1699 |
* related. Instances only get events when interacting with other |
1700 | 1700 |
* DragDrop object in the same group. This lets us define multiple |
1701 | 1701 |
* groups using a single DragDrop subclass if we want. |
1702 |
* @property groups
|
|
1703 |
* @type {string: string}
|
|
1702 |
* @property groups |
|
1703 |
* @type {string: string} |
|
1704 | 1704 |
*/ |
1705 | 1705 |
groups: null, |
1706 | 1706 |
|
1707 | 1707 |
/** |
1708 | 1708 |
* Individual drag/drop instances can be locked. This will prevent |
1709 | 1709 |
* onmousedown start drag. |
1710 |
* @property locked
|
|
1711 |
* @type boolean
|
|
1712 |
* @private
|
|
1710 |
* @property locked |
|
1711 |
* @type boolean |
|
1712 |
* @private |
|
1713 | 1713 |
*/ |
1714 | 1714 |
locked: false, |
1715 | 1715 |
|
1716 | 1716 |
/** |
1717 | 1717 |
* Lock this instance |
1718 |
* @method lock
|
|
1718 |
* @method lock |
|
1719 | 1719 |
*/ |
1720 | 1720 |
lock: function() { this.locked = true; }, |
1721 | 1721 |
|
1722 | 1722 |
/** |
1723 | 1723 |
* Unlock this instace |
1724 |
* @method unlock
|
|
1724 |
* @method unlock |
|
1725 | 1725 |
*/ |
1726 | 1726 |
unlock: function() { this.locked = false; }, |
1727 | 1727 |
|
1728 | 1728 |
/** |
1729 | 1729 |
* By default, all instances can be a drop target. This can be disabled by |
1730 | 1730 |
* setting isTarget to false. |
1731 |
* @property isTarget
|
|
1732 |
* @type boolean
|
|
1731 |
* @property isTarget |
|
1732 |
* @type boolean |
|
1733 | 1733 |
*/ |
1734 | 1734 |
isTarget: true, |
1735 | 1735 |
|
1736 | 1736 |
/** |
1737 | 1737 |
* The padding configured for this drag and drop object for calculating |
1738 | 1738 |
* the drop zone intersection with this object. |
1739 |
* @property padding
|
|
1740 |
* @type int[]
|
|
1739 |
* @property padding |
|
1740 |
* @type int[] |
|
1741 | 1741 |
*/ |
1742 | 1742 |
padding: null, |
1743 | 1743 |
/** |
1744 | 1744 |
* If this flag is true, do not fire drop events. The element is a drag only element (for movement not dropping) |
1745 |
* @property dragOnly
|
|
1746 |
* @type Boolean
|
|
1745 |
* @property dragOnly |
|
1746 |
* @type Boolean |
|
1747 | 1747 |
*/ |
1748 | 1748 |
dragOnly: false, |
1749 | 1749 |
|
1750 | 1750 |
/** |
1751 | 1751 |
* If this flag is true, a shim will be placed over the screen/viewable area to track mouse events. Should help with dragging elements over iframes and other controls. |
1752 |
* @property useShim
|
|
1753 |
* @type Boolean
|
|
1752 |
* @property useShim |
|
1753 |
* @type Boolean |
|
1754 | 1754 |
*/ |
1755 | 1755 |
useShim: false, |
1756 | 1756 |
|
1757 | 1757 |
/** |
1758 | 1758 |
* Cached reference to the linked element |
1759 |
* @property _domRef
|
|
1760 |
* @private
|
|
1759 |
* @property _domRef |
|
1760 |
* @private |
|
1761 | 1761 |
*/ |
1762 | 1762 |
_domRef: null, |
1763 | 1763 |
|
1764 | 1764 |
/** |
1765 | 1765 |
* Internal typeof flag |
1766 |
* @property __ygDragDrop
|
|
1767 |
* @private
|
|
1766 |
* @property __ygDragDrop |
|
1767 |
* @private |
|
1768 | 1768 |
*/ |
1769 | 1769 |
__ygDragDrop: true, |
1770 | 1770 |
|
1771 | 1771 |
/** |
1772 | 1772 |
* Set to true when horizontal contraints are applied |
1773 |
* @property constrainX
|
|
1774 |
* @type boolean
|
|
1775 |
* @private
|
|
1773 |
* @property constrainX |
|
1774 |
* @type boolean |
|
1775 |
* @private |
|
1776 | 1776 |
*/ |
1777 | 1777 |
constrainX: false, |
1778 | 1778 |
|
1779 | 1779 |
/** |
1780 | 1780 |
* Set to true when vertical contraints are applied |
1781 |
* @property constrainY
|
|
1782 |
* @type boolean
|
|
1783 |
* @private
|
|
1781 |
* @property constrainY |
|
1782 |
* @type boolean |
|
1783 |
* @private |
|
1784 | 1784 |
*/ |
1785 | 1785 |
constrainY: false, |
1786 | 1786 |
|
1787 | 1787 |
/** |
1788 | 1788 |
* The left constraint |
1789 |
* @property minX
|
|
1790 |
* @type int
|
|
1791 |
* @private
|
|
1789 |
* @property minX |
|
1790 |
* @type int |
|
1791 |
* @private |
|
1792 | 1792 |
*/ |
1793 | 1793 |
minX: 0, |
1794 | 1794 |
|
1795 | 1795 |
/** |
1796 | 1796 |
* The right constraint |
1797 |
* @property maxX
|
|
1798 |
* @type int
|
|
1799 |
* @private
|
|
1797 |
* @property maxX |
|
1798 |
* @type int |
|
1799 |
* @private |
|
1800 | 1800 |
*/ |
1801 | 1801 |
maxX: 0, |
1802 | 1802 |
|
1803 | 1803 |
/** |
1804 | 1804 |
* The up constraint |
1805 |
* @property minY
|
|
1806 |
* @type int
|
|
1807 |
* @type int
|
|
1808 |
* @private
|
|
1805 |
* @property minY |
|
1806 |
* @type int |
|
1807 |
* @type int |
|
1808 |
* @private |
|
1809 | 1809 |
*/ |
1810 | 1810 |
minY: 0, |
1811 | 1811 |
|
1812 | 1812 |
/** |
1813 | 1813 |
* The down constraint |
1814 |
* @property maxY
|
|
1815 |
* @type int
|
|
1816 |
* @private
|
|
1814 |
* @property maxY |
|
1815 |
* @type int |
|
1816 |
* @private |
|
1817 | 1817 |
*/ |
1818 | 1818 |
maxY: 0, |
1819 | 1819 |
|
1820 | 1820 |
/** |
1821 | 1821 |
* The difference between the click position and the source element's location |
1822 |
* @property deltaX
|
|
1823 |
* @type int
|
|
1824 |
* @private
|
|
1822 |
* @property deltaX |
|
1823 |
* @type int |
|
1824 |
* @private |
|
1825 | 1825 |
*/ |
1826 | 1826 |
deltaX: 0, |
1827 | 1827 |
|
1828 | 1828 |
/** |
1829 | 1829 |
* The difference between the click position and the source element's location |
1830 |
* @property deltaY |
|
1831 |
* @type int |
Also available in: Unified diff
fixed headerinfos