Revision 1374
Added by Dietmar over 13 years ago
dragdrop-debug.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 |
YAHOO.log('Creating Shim Element', 'info', 'DragDropMgr'); |
... | ... | |
92 | 92 |
}, |
93 | 93 |
/** |
94 | 94 |
* This method will size the shim, called from activate and on window scroll event |
95 |
* @private
|
|
96 |
* @method _sizeShim
|
|
97 |
* @static
|
|
95 |
* @private |
|
96 |
* @method _sizeShim |
|
97 |
* @static |
|
98 | 98 |
*/ |
99 | 99 |
_sizeShim: function() { |
100 | 100 |
if (this._shimActive) { |
... | ... | |
108 | 108 |
}, |
109 | 109 |
/** |
110 | 110 |
* This method will create the shim element if needed, then show the shim element, size the element and set the _shimActive property to true |
111 |
* @private
|
|
112 |
* @method _activateShim
|
|
113 |
* @static
|
|
111 |
* @private |
|
112 |
* @method _activateShim |
|
113 |
* @static |
|
114 | 114 |
*/ |
115 | 115 |
_activateShim: function() { |
116 | 116 |
if (this.useShim) { |
... | ... | |
131 | 131 |
}, |
132 | 132 |
/** |
133 | 133 |
* This method will hide the shim element and set the _shimActive property to false |
134 |
* @private
|
|
135 |
* @method _deactivateShim
|
|
136 |
* @static
|
|
134 |
* @private |
|
135 |
* @method _deactivateShim |
|
136 |
* @static |
|
137 | 137 |
*/ |
138 | 138 |
_deactivateShim: function() { |
139 | 139 |
YAHOO.log('Deactivating Shim', 'info', 'DragDropMgr'); |
... | ... | |
142 | 142 |
}, |
143 | 143 |
/** |
144 | 144 |
* The HTML element created to use as a shim over the document to track mouse movements |
145 |
* @private
|
|
146 |
* @property _shim
|
|
147 |
* @type HTMLElement
|
|
148 |
* @static
|
|
145 |
* @private |
|
146 |
* @property _shim |
|
147 |
* @type HTMLElement |
|
148 |
* @static |
|
149 | 149 |
*/ |
150 | 150 |
_shim: null, |
151 | 151 |
/** |
152 | 152 |
* Two dimensional Array of registered DragDrop objects. The first |
153 | 153 |
* dimension is the DragDrop item group, the second the DragDrop |
154 | 154 |
* object. |
155 |
* @property ids
|
|
156 |
* @type {string: string}
|
|
157 |
* @private
|
|
158 |
* @static
|
|
155 |
* @property ids |
|
156 |
* @type {string: string} |
|
157 |
* @private |
|
158 |
* @static |
|
159 | 159 |
*/ |
160 | 160 |
ids: {}, |
161 | 161 |
|
... | ... | |
163 | 163 |
* Array of element ids defined as drag handles. Used to determine |
164 | 164 |
* if the element that generated the mousedown event is actually the |
165 | 165 |
* handle and not the html element itself. |
166 |
* @property handleIds
|
|
167 |
* @type {string: string}
|
|
168 |
* @private
|
|
169 |
* @static
|
|
166 |
* @property handleIds |
|
167 |
* @type {string: string} |
|
168 |
* @private |
|
169 |
* @static |
|
170 | 170 |
*/ |
171 | 171 |
handleIds: {}, |
172 | 172 |
|
173 | 173 |
/** |
174 | 174 |
* the DragDrop object that is currently being dragged |
175 |
* @property dragCurrent
|
|
176 |
* @type DragDrop
|
|
177 |
* @private
|
|
178 |
* @static
|
|
175 |
* @property dragCurrent |
|
176 |
* @type DragDrop |
|
177 |
* @private |
|
178 |
* @static |
|
179 | 179 |
**/ |
180 | 180 |
dragCurrent: null, |
181 | 181 |
|
182 | 182 |
/** |
183 | 183 |
* the DragDrop object(s) that are being hovered over |
184 |
* @property dragOvers
|
|
185 |
* @type Array
|
|
186 |
* @private
|
|
187 |
* @static
|
|
184 |
* @property dragOvers |
|
185 |
* @type Array |
|
186 |
* @private |
|
187 |
* @static |
|
188 | 188 |
*/ |
189 | 189 |
dragOvers: {}, |
190 | 190 |
|
191 | 191 |
/** |
192 | 192 |
* the X distance between the cursor and the object being dragged |
193 |
* @property deltaX
|
|
194 |
* @type int
|
|
195 |
* @private
|
|
196 |
* @static
|
|
193 |
* @property deltaX |
|
194 |
* @type int |
|
195 |
* @private |
|
196 |
* @static |
|
197 | 197 |
*/ |
198 | 198 |
deltaX: 0, |
199 | 199 |
|
200 | 200 |
/** |
201 | 201 |
* the Y distance between the cursor and the object being dragged |
202 |
* @property deltaY
|
|
203 |
* @type int
|
|
204 |
* @private
|
|
205 |
* @static
|
|
202 |
* @property deltaY |
|
203 |
* @type int |
|
204 |
* @private |
|
205 |
* @static |
|
206 | 206 |
*/ |
207 | 207 |
deltaY: 0, |
208 | 208 |
|
... | ... | |
210 | 210 |
* Flag to determine if we should prevent the default behavior of the |
211 | 211 |
* events we define. By default this is true, but this can be set to |
212 | 212 |
* false if you need the default behavior (not recommended) |
213 |
* @property preventDefault
|
|
214 |
* @type boolean
|
|
215 |
* @static
|
|
213 |
* @property preventDefault |
|
214 |
* @type boolean |
|
215 |
* @static |
|
216 | 216 |
*/ |
217 | 217 |
preventDefault: true, |
218 | 218 |
|
... | ... | |
221 | 221 |
* we generate. This is true by default but you may want to set it to |
222 | 222 |
* false if the html element contains other features that require the |
223 | 223 |
* mouse click. |
224 |
* @property stopPropagation
|
|
225 |
* @type boolean
|
|
226 |
* @static
|
|
224 |
* @property stopPropagation |
|
225 |
* @type boolean |
|
226 |
* @static |
|
227 | 227 |
*/ |
228 | 228 |
stopPropagation: true, |
229 | 229 |
|
230 | 230 |
/** |
231 | 231 |
* Internal flag that is set to true when drag and drop has been |
232 | 232 |
* initialized |
233 |
* @property initialized
|
|
234 |
* @private
|
|
235 |
* @static
|
|
233 |
* @property initialized |
|
234 |
* @private |
|
235 |
* @static |
|
236 | 236 |
*/ |
237 | 237 |
initialized: false, |
238 | 238 |
|
239 | 239 |
/** |
240 | 240 |
* All drag and drop can be disabled. |
241 |
* @property locked
|
|
242 |
* @private
|
|
243 |
* @static
|
|
241 |
* @property locked |
|
242 |
* @private |
|
243 |
* @static |
|
244 | 244 |
*/ |
245 | 245 |
locked: false, |
246 | 246 |
|
... | ... | |
259 | 259 |
* sourceRegion: The location of the source elemtn at the time |
260 | 260 |
* of the interaction |
261 | 261 |
* validDrop: boolean |
262 |
* @property interactionInfo
|
|
263 |
* @type object
|
|
264 |
* @static
|
|
262 |
* @property interactionInfo |
|
263 |
* @type object |
|
264 |
* @static |
|
265 | 265 |
*/ |
266 | 266 |
interactionInfo: null, |
267 | 267 |
|
268 | 268 |
/** |
269 | 269 |
* Called the first time an element is registered. |
270 |
* @method init
|
|
271 |
* @private
|
|
272 |
* @static
|
|
270 |
* @method init |
|
271 |
* @private |
|
272 |
* @static |
|
273 | 273 |
*/ |
274 | 274 |
init: function() { |
275 | 275 |
this.initialized = true; |
... | ... | |
278 | 278 |
/** |
279 | 279 |
* In point mode, drag and drop interaction is defined by the |
280 | 280 |
* location of the cursor during the drag/drop |
281 |
* @property POINT
|
|
282 |
* @type int
|
|
283 |
* @static
|
|
284 |
* @final
|
|
281 |
* @property POINT |
|
282 |
* @type int |
|
283 |
* @static |
|
284 |
* @final |
|
285 | 285 |
*/ |
286 | 286 |
POINT: 0, |
287 | 287 |
|
... | ... | |
289 | 289 |
* In intersect mode, drag and drop interaction is defined by the |
290 | 290 |
* cursor position or the amount of overlap of two or more drag and |
291 | 291 |
* drop objects. |
292 |
* @property INTERSECT
|
|
293 |
* @type int
|
|
294 |
* @static
|
|
295 |
* @final
|
|
292 |
* @property INTERSECT |
|
293 |
* @type int |
|
294 |
* @static |
|
295 |
* @final |
|
296 | 296 |
*/ |
297 | 297 |
INTERSECT: 1, |
298 | 298 |
|
299 | 299 |
/** |
300 | 300 |
* In intersect mode, drag and drop interaction is defined only by the |
301 | 301 |
* overlap of two or more drag and drop objects. |
302 |
* @property STRICT_INTERSECT
|
|
303 |
* @type int
|
|
304 |
* @static
|
|
305 |
* @final
|
|
302 |
* @property STRICT_INTERSECT |
|
303 |
* @type int |
|
304 |
* @static |
|
305 |
* @final |
|
306 | 306 |
*/ |
307 | 307 |
STRICT_INTERSECT: 2, |
308 | 308 |
|
309 | 309 |
/** |
310 | 310 |
* The current drag and drop mode. Default: POINT |
311 |
* @property mode
|
|
312 |
* @type int
|
|
313 |
* @static
|
|
311 |
* @property mode |
|
312 |
* @type int |
|
313 |
* @static |
|
314 | 314 |
*/ |
315 | 315 |
mode: 0, |
316 | 316 |
|
317 | 317 |
/** |
318 | 318 |
* Runs method on all drag and drop objects |
319 |
* @method _execOnAll
|
|
320 |
* @private
|
|
321 |
* @static
|
|
319 |
* @method _execOnAll |
|
320 |
* @private |
|
321 |
* @static |
|
322 | 322 |
*/ |
323 | 323 |
_execOnAll: function(sMethod, args) { |
324 | 324 |
for (var i in this.ids) { |
... | ... | |
334 | 334 |
|
335 | 335 |
/** |
336 | 336 |
* Drag and drop initialization. Sets up the global event handlers |
337 |
* @method _onLoad
|
|
338 |
* @private
|
|
339 |
* @static
|
|
337 |
* @method _onLoad |
|
338 |
* @private |
|
339 |
* @static |
|
340 | 340 |
*/ |
341 | 341 |
_onLoad: function() { |
342 | 342 |
|
... | ... | |
353 | 353 |
|
354 | 354 |
/** |
355 | 355 |
* Reset constraints on all drag and drop objs |
356 |
* @method _onResize
|
|
357 |
* @private
|
|
358 |
* @static
|
|
356 |
* @method _onResize |
|
357 |
* @private |
|
358 |
* @static |
|
359 | 359 |
*/ |
360 | 360 |
_onResize: function(e) { |
361 | 361 |
YAHOO.log("window resize", "info", "DragDropMgr"); |
... | ... | |
364 | 364 |
|
365 | 365 |
/** |
366 | 366 |
* Lock all drag and drop functionality |
367 |
* @method lock
|
|
368 |
* @static
|
|
367 |
* @method lock |
|
368 |
* @static |
|
369 | 369 |
*/ |
370 | 370 |
lock: function() { this.locked = true; }, |
371 | 371 |
|
372 | 372 |
/** |
373 | 373 |
* Unlock all drag and drop functionality |
374 |
* @method unlock
|
|
375 |
* @static
|
|
374 |
* @method unlock |
|
375 |
* @static |
|
376 | 376 |
*/ |
377 | 377 |
unlock: function() { this.locked = false; }, |
378 | 378 |
|
379 | 379 |
/** |
380 | 380 |
* Is drag and drop locked? |
381 |
* @method isLocked
|
|
382 |
* @return {boolean} True if drag and drop is locked, false otherwise.
|
|
383 |
* @static
|
|
381 |
* @method isLocked |
|
382 |
* @return {boolean} True if drag and drop is locked, false otherwise. |
|
383 |
* @static |
|
384 | 384 |
*/ |
385 | 385 |
isLocked: function() { return this.locked; }, |
386 | 386 |
|
387 | 387 |
/** |
388 | 388 |
* Location cache that is set for all drag drop objects when a drag is |
389 | 389 |
* initiated, cleared when the drag is finished. |
390 |
* @property locationCache
|
|
391 |
* @private
|
|
392 |
* @static
|
|
390 |
* @property locationCache |
|
391 |
* @private |
|
392 |
* @static |
|
393 | 393 |
*/ |
394 | 394 |
locationCache: {}, |
395 | 395 |
|
396 | 396 |
/** |
397 | 397 |
* Set useCache to false if you want to force object the lookup of each |
398 | 398 |
* drag and drop linked element constantly during a drag. |
399 |
* @property useCache
|
|
400 |
* @type boolean
|
|
401 |
* @static
|
|
399 |
* @property useCache |
|
400 |
* @type boolean |
|
401 |
* @static |
|
402 | 402 |
*/ |
403 | 403 |
useCache: true, |
404 | 404 |
|
405 | 405 |
/** |
406 | 406 |
* The number of pixels that the mouse needs to move after the |
407 | 407 |
* mousedown before the drag is initiated. Default=3; |
408 |
* @property clickPixelThresh
|
|
409 |
* @type int
|
|
410 |
* @static
|
|
408 |
* @property clickPixelThresh |
|
409 |
* @type int |
|
410 |
* @static |
|
411 | 411 |
*/ |
412 | 412 |
clickPixelThresh: 3, |
413 | 413 |
|
414 | 414 |
/** |
415 | 415 |
* The number of milliseconds after the mousedown event to initiate the |
416 | 416 |
* drag if we don't get a mouseup event. Default=1000 |
417 |
* @property clickTimeThresh
|
|
418 |
* @type int
|
|
419 |
* @static
|
|
417 |
* @property clickTimeThresh |
|
418 |
* @type int |
|
419 |
* @static |
|
420 | 420 |
*/ |
421 | 421 |
clickTimeThresh: 1000, |
422 | 422 |
|
423 | 423 |
/** |
424 | 424 |
* Flag that indicates that either the drag pixel threshold or the |
425 | 425 |
* mousdown time threshold has been met |
426 |
* @property dragThreshMet
|
|
427 |
* @type boolean
|
|
428 |
* @private
|
|
429 |
* @static
|
|
426 |
* @property dragThreshMet |
|
427 |
* @type boolean |
|
428 |
* @private |
|
429 |
* @static |
|
430 | 430 |
*/ |
431 | 431 |
dragThreshMet: false, |
432 | 432 |
|
433 | 433 |
/** |
434 | 434 |
* Timeout used for the click time threshold |
435 |
* @property clickTimeout
|
|
436 |
* @type Object
|
|
437 |
* @private
|
|
438 |
* @static
|
|
435 |
* @property clickTimeout |
|
436 |
* @type Object |
|
437 |
* @private |
|
438 |
* @static |
|
439 | 439 |
*/ |
440 | 440 |
clickTimeout: null, |
441 | 441 |
|
442 | 442 |
/** |
443 | 443 |
* The X position of the mousedown event stored for later use when a |
444 | 444 |
* drag threshold is met. |
445 |
* @property startX
|
|
446 |
* @type int
|
|
447 |
* @private
|
|
448 |
* @static
|
|
445 |
* @property startX |
|
446 |
* @type int |
|
447 |
* @private |
|
448 |
* @static |
|
449 | 449 |
*/ |
450 | 450 |
startX: 0, |
451 | 451 |
|
452 | 452 |
/** |
453 | 453 |
* The Y position of the mousedown event stored for later use when a |
454 | 454 |
* drag threshold is met. |
455 |
* @property startY
|
|
456 |
* @type int
|
|
457 |
* @private
|
|
458 |
* @static
|
|
455 |
* @property startY |
|
456 |
* @type int |
|
457 |
* @private |
|
458 |
* @static |
|
459 | 459 |
*/ |
460 | 460 |
startY: 0, |
461 | 461 |
|
462 | 462 |
/** |
463 | 463 |
* Flag to determine if the drag event was fired from the click timeout and |
464 | 464 |
* not the mouse move threshold. |
465 |
* @property fromTimeout
|
|
466 |
* @type boolean
|
|
467 |
* @private
|
|
468 |
* @static
|
|
465 |
* @property fromTimeout |
|
466 |
* @type boolean |
|
467 |
* @private |
|
468 |
* @static |
|
469 | 469 |
*/ |
470 | 470 |
fromTimeout: false, |
471 | 471 |
|
472 | 472 |
/** |
473 | 473 |
* Each DragDrop instance must be registered with the DragDropMgr. |
474 | 474 |
* This is executed in DragDrop.init() |
475 |
* @method regDragDrop
|
|
476 |
* @param {DragDrop} oDD the DragDrop object to register
|
|
477 |
* @param {String} sGroup the name of the group this element belongs to
|
|
478 |
* @static
|
|
475 |
* @method regDragDrop |
|
476 |
* @param {DragDrop} oDD the DragDrop object to register |
|
477 |
* @param {String} sGroup the name of the group this element belongs to |
|
478 |
* @static |
|
479 | 479 |
*/ |
480 | 480 |
regDragDrop: function(oDD, sGroup) { |
481 | 481 |
if (!this.initialized) { this.init(); } |
... | ... | |
489 | 489 |
/** |
490 | 490 |
* Removes the supplied dd instance from the supplied group. Executed |
491 | 491 |
* by DragDrop.removeFromGroup, so don't call this function directly. |
492 |
* @method removeDDFromGroup
|
|
493 |
* @private
|
|
494 |
* @static
|
|
492 |
* @method removeDDFromGroup |
|
493 |
* @private |
|
494 |
* @static |
|
495 | 495 |
*/ |
496 | 496 |
removeDDFromGroup: function(oDD, sGroup) { |
497 | 497 |
if (!this.ids[sGroup]) { |
... | ... | |
507 | 507 |
/** |
508 | 508 |
* Unregisters a drag and drop item. This is executed in |
509 | 509 |
* DragDrop.unreg, use that method instead of calling this directly. |
510 |
* @method _remove
|
|
511 |
* @private
|
|
512 |
* @static
|
|
510 |
* @method _remove |
|
511 |
* @private |
|
512 |
* @static |
|
513 | 513 |
*/ |
514 | 514 |
_remove: function(oDD) { |
515 | 515 |
for (var g in oDD.groups) { |
... | ... | |
527 | 527 |
/** |
528 | 528 |
* Each DragDrop handle element must be registered. This is done |
529 | 529 |
* automatically when executing DragDrop.setHandleElId() |
530 |
* @method regHandle
|
|
531 |
* @param {String} sDDId the DragDrop id this element is a handle for
|
|
532 |
* @param {String} sHandleId the id of the element that is the drag
|
|
530 |
* @method regHandle |
|
531 |
* @param {String} sDDId the DragDrop id this element is a handle for |
|
532 |
* @param {String} sHandleId the id of the element that is the drag |
|
533 | 533 |
* handle |
534 |
* @static
|
|
534 |
* @static |
|
535 | 535 |
*/ |
536 | 536 |
regHandle: function(sDDId, sHandleId) { |
537 | 537 |
if (!this.handleIds[sDDId]) { |
... | ... | |
543 | 543 |
/** |
544 | 544 |
* Utility function to determine if a given element has been |
545 | 545 |
* registered as a drag drop item. |
546 |
* @method isDragDrop
|
|
547 |
* @param {String} id the element id to check
|
|
548 |
* @return {boolean} true if this element is a DragDrop item,
|
|
546 |
* @method isDragDrop |
|
547 |
* @param {String} id the element id to check |
|
548 |
* @return {boolean} true if this element is a DragDrop item, |
|
549 | 549 |
* false otherwise |
550 |
* @static
|
|
550 |
* @static |
|
551 | 551 |
*/ |
552 | 552 |
isDragDrop: function(id) { |
553 | 553 |
return ( this.getDDById(id) ) ? true : false; |
... | ... | |
556 | 556 |
/** |
557 | 557 |
* Returns the drag and drop instances that are in all groups the |
558 | 558 |
* passed in instance belongs to. |
559 |
* @method getRelated
|
|
560 |
* @param {DragDrop} p_oDD the obj to get related data for
|
|
561 |
* @param {boolean} bTargetsOnly if true, only return targetable objs
|
|
562 |
* @return {DragDrop[]} the related instances
|
|
563 |
* @static
|
|
559 |
* @method getRelated |
|
560 |
* @param {DragDrop} p_oDD the obj to get related data for |
|
561 |
* @param {boolean} bTargetsOnly if true, only return targetable objs |
|
562 |
* @return {DragDrop[]} the related instances |
|
563 |
* @static |
|
564 | 564 |
*/ |
565 | 565 |
getRelated: function(p_oDD, bTargetsOnly) { |
566 | 566 |
var oDDs = []; |
... | ... | |
582 | 582 |
/** |
583 | 583 |
* Returns true if the specified dd target is a legal target for |
584 | 584 |
* the specifice drag obj |
585 |
* @method isLegalTarget
|
|
586 |
* @param {DragDrop} the drag obj
|
|
587 |
* @param {DragDrop} the target
|
|
588 |
* @return {boolean} true if the target is a legal target for the
|
|
585 |
* @method isLegalTarget |
|
586 |
* @param {DragDrop} the drag obj |
|
587 |
* @param {DragDrop} the target |
|
588 |
* @return {boolean} true if the target is a legal target for the |
|
589 | 589 |
* dd obj |
590 |
* @static
|
|
590 |
* @static |
|
591 | 591 |
*/ |
592 | 592 |
isLegalTarget: function (oDD, oTargetDD) { |
593 | 593 |
var targets = this.getRelated(oDD, true); |
... | ... | |
606 | 606 |
* returns "object", oDD.constructor.toString() always returns |
607 | 607 |
* "DragDrop" and not the name of the subclass. So for now it just |
608 | 608 |
* evaluates a well-known variable in DragDrop. |
609 |
* @method isTypeOfDD
|
|
610 |
* @param {Object} the object to evaluate
|
|
611 |
* @return {boolean} true if typeof oDD = DragDrop
|
|
612 |
* @static
|
|
609 |
* @method isTypeOfDD |
|
610 |
* @param {Object} the object to evaluate |
|
611 |
* @return {boolean} true if typeof oDD = DragDrop |
|
612 |
* @static |
|
613 | 613 |
*/ |
614 | 614 |
isTypeOfDD: function (oDD) { |
615 | 615 |
return (oDD && oDD.__ygDragDrop); |
... | ... | |
618 | 618 |
/** |
619 | 619 |
* Utility function to determine if a given element has been |
620 | 620 |
* registered as a drag drop handle for the given Drag Drop object. |
621 |
* @method isHandle
|
|
622 |
* @param {String} id the element id to check
|
|
623 |
* @return {boolean} true if this element is a DragDrop handle, false
|
|
621 |
* @method isHandle |
|
622 |
* @param {String} id the element id to check |
|
623 |
* @return {boolean} true if this element is a DragDrop handle, false |
|
624 | 624 |
* otherwise |
625 |
* @static
|
|
625 |
* @static |
|
626 | 626 |
*/ |
627 | 627 |
isHandle: function(sDDId, sHandleId) { |
628 | 628 |
return ( this.handleIds[sDDId] && |
... | ... | |
631 | 631 |
|
632 | 632 |
/** |
633 | 633 |
* Returns the DragDrop instance for a given id |
634 |
* @method getDDById
|
|
635 |
* @param {String} id the id of the DragDrop object
|
|
636 |
* @return {DragDrop} the drag drop object, null if it is not found
|
|
637 |
* @static
|
|
634 |
* @method getDDById |
|
635 |
* @param {String} id the id of the DragDrop object |
|
636 |
* @return {DragDrop} the drag drop object, null if it is not found |
|
637 |
* @static |
|
638 | 638 |
*/ |
639 | 639 |
getDDById: function(id) { |
640 | 640 |
for (var i in this.ids) { |
... | ... | |
648 | 648 |
/** |
649 | 649 |
* Fired after a registered DragDrop object gets the mousedown event. |
650 | 650 |
* Sets up the events required to track the object being dragged |
651 |
* @method handleMouseDown
|
|
652 |
* @param {Event} e the event
|
|
653 |
* @param oDD the DragDrop object being dragged
|
|
654 |
* @private
|
|
655 |
* @static
|
|
651 |
* @method handleMouseDown |
|
652 |
* @param {Event} e the event |
|
653 |
* @param oDD the DragDrop object being dragged |
|
654 |
* @private |
|
655 |
* @static |
|
656 | 656 |
*/ |
657 | 657 |
handleMouseDown: function(e, oDD) { |
658 | 658 |
//this._activateShim(); |
... | ... | |
684 | 684 |
/** |
685 | 685 |
* Fired when either the drag pixel threshold or the mousedown hold |
686 | 686 |
* time threshold has been met. |
687 |
* @method startDrag
|
|
688 |
* @param x {int} the X position of the original mousedown
|
|
689 |
* @param y {int} the Y position of the original mousedown
|
|
690 |
* @static
|
|
687 |
* @method startDrag |
|
688 |
* @param x {int} the X position of the original mousedown |
|
689 |
* @param y {int} the Y position of the original mousedown |
|
690 |
* @static |
|
691 | 691 |
*/ |
692 | 692 |
startDrag: function(x, y) { |
693 | 693 |
if (this.dragCurrent && this.dragCurrent.useShim) { |
... | ... | |
712 | 712 |
/** |
713 | 713 |
* Internal function to handle the mouseup event. Will be invoked |
714 | 714 |
* from the context of the document. |
715 |
* @method handleMouseUp
|
|
716 |
* @param {Event} e the event
|
|
717 |
* @private
|
|
718 |
* @static
|
|
715 |
* @method handleMouseUp |
|
716 |
* @param {Event} e the event |
|
717 |
* @private |
|
718 |
* @static |
|
719 | 719 |
*/ |
720 | 720 |
handleMouseUp: function(e) { |
721 | 721 |
if (this.dragCurrent) { |
... | ... | |
743 | 743 |
/** |
744 | 744 |
* Utility to stop event propagation and event default, if these |
745 | 745 |
* features are turned on. |
746 |
* @method stopEvent
|
|
747 |
* @param {Event} e the event as returned by this.getEvent()
|
|
748 |
* @static
|
|
746 |
* @method stopEvent |
|
747 |
* @param {Event} e the event as returned by this.getEvent() |
|
748 |
* @static |
|
749 | 749 |
*/ |
750 | 750 |
stopEvent: function(e) { |
751 | 751 |
if (this.stopPropagation) { |
... | ... | |
767 | 767 |
* for the silent parameter so that the endDrag and onMouseUp events |
768 | 768 |
* are skipped (so no event data is needed.) |
769 | 769 |
* |
770 |
* @method stopDrag
|
|
771 |
* @param {Event} e the mouseup event, another event (or a fake event)
|
|
770 |
* @method stopDrag |
|
771 |
* @param {Event} e the mouseup event, another event (or a fake event) |
|
772 | 772 |
* with pageX and pageY defined, or nothing if the |
773 | 773 |
* silent parameter is true |
774 |
* @param {boolean} silent skips the enddrag and mouseup events if true
|
|
775 |
* @static
|
|
774 |
* @param {boolean} silent skips the enddrag and mouseup events if true |
|
775 |
* @static |
|
776 | 776 |
*/ |
777 | 777 |
stopDrag: function(e, silent) { |
778 | 778 |
// YAHOO.log("mouseup - removing event handlers"); |
... | ... | |
813 | 813 |
* Internal function to handle the mousemove event. Will be invoked |
814 | 814 |
* from the context of the html element. |
815 | 815 |
* |
816 |
* @TODO figure out what we can do about mouse events lost when the
|
|
816 |
* @TODO figure out what we can do about mouse events lost when the |
|
817 | 817 |
* user drags objects beyond the window boundary. Currently we can |
818 | 818 |
* detect this in internet explorer by verifying that the mouse is |
819 | 819 |
* down during the mousemove event. Firefox doesn't give us the |
820 | 820 |
* button state on the mousemove event. |
821 |
* @method handleMouseMove
|
|
822 |
* @param {Event} e the event
|
|
823 |
* @private
|
|
824 |
* @static
|
|
821 |
* @method handleMouseMove |
|
822 |
* @param {Event} e the event |
|
823 |
* @private |
|
824 |
* @static |
|
825 | 825 |
*/ |
826 | 826 |
handleMouseMove: function(e) { |
827 | 827 |
//YAHOO.log("handlemousemove"); |
... | ... | |
880 | 880 |
/** |
881 | 881 |
* Iterates over all of the DragDrop elements to find ones we are |
882 | 882 |
* hovering over or dropping on |
883 |
* @method fireEvents
|
|
884 |
* @param {Event} e the event
|
|
885 |
* @param {boolean} isDrop is this a drop op or a mouseover op?
|
|
886 |
* @private
|
|
887 |
* @static
|
|
883 |
* @method fireEvents |
|
884 |
* @param {Event} e the event |
|
885 |
* @param {boolean} isDrop is this a drop op or a mouseover op? |
|
886 |
* @private |
|
887 |
* @static |
|
888 | 888 |
*/ |
889 | 889 |
fireEvents: function(e, isDrop) { |
890 | 890 |
var dc = this.dragCurrent; |
... | ... | |
1042 | 1042 |
* in INTERSECT mode. It returns either the first object that the |
1043 | 1043 |
* cursor is over, or the object that has the greatest overlap with |
1044 | 1044 |
* the dragged element. |
1045 |
* @method getBestMatch
|
|
1046 |
* @param {DragDrop[]} dds The array of drag and drop objects
|
|
1045 |
* @method getBestMatch |
|
1046 |
* @param {DragDrop[]} dds The array of drag and drop objects |
|
1047 | 1047 |
* targeted |
1048 |
* @return {DragDrop} The best single match
|
|
1049 |
* @static
|
|
1048 |
* @return {DragDrop} The best single match |
|
1049 |
* @static |
|
1050 | 1050 |
*/ |
1051 | 1051 |
getBestMatch: function(dds) { |
1052 | 1052 |
var winner = null; |
... | ... | |
1090 | 1090 |
* <code> |
1091 | 1091 |
* YAHOO.util.DragDropMgr.refreshCache({group1:true, group2:true}); |
1092 | 1092 |
* </code> |
1093 |
* @TODO this really should be an indexed array. Alternatively this
|
|
1093 |
* @TODO this really should be an indexed array. Alternatively this |
|
1094 | 1094 |
* method could accept both. |
1095 |
* @method refreshCache
|
|
1096 |
* @param {Object} groups an associative array of groups to refresh
|
|
1097 |
* @static
|
|
1095 |
* @method refreshCache |
|
1096 |
* @param {Object} groups an associative array of groups to refresh |
|
1097 |
* @static |
|
1098 | 1098 |
*/ |
1099 | 1099 |
refreshCache: function(groups) { |
1100 | 1100 |
YAHOO.log("refreshing element location cache", "info", "DragDropMgr"); |
... | ... | |
1127 | 1127 |
* main purpose is to handle cases where innerHTML is used to remove |
1128 | 1128 |
* drag and drop objects from the DOM. IE provides an 'unspecified |
1129 | 1129 |
* error' when trying to access the offsetParent of such an element |
1130 |
* @method verifyEl
|
|
1131 |
* @param {HTMLElement} el the element to check
|
|
1132 |
* @return {boolean} true if the element looks usable
|
|
1133 |
* @static
|
|
1130 |
* @method verifyEl |
|
1131 |
* @param {HTMLElement} el the element to check |
|
1132 |
* @return {boolean} true if the element looks usable |
|
1133 |
* @static |
|
1134 | 1134 |
*/ |
1135 | 1135 |
verifyEl: function(el) { |
1136 | 1136 |
try { |
... | ... | |
1150 | 1150 |
/** |
1151 | 1151 |
* Returns a Region object containing the drag and drop element's position |
1152 | 1152 |
* and size, including the padding configured for it |
1153 |
* @method getLocation
|
|
1154 |
* @param {DragDrop} oDD the drag and drop object to get the
|
|
1153 |
* @method getLocation |
|
1154 |
* @param {DragDrop} oDD the drag and drop object to get the |
|
1155 | 1155 |
* location for |
1156 |
* @return {YAHOO.util.Region} a Region object representing the total area
|
|
1156 |
* @return {YAHOO.util.Region} a Region object representing the total area |
|
1157 | 1157 |
* the element occupies, including any padding |
1158 | 1158 |
* the instance is configured for. |
1159 |
* @static
|
|
1159 |
* @static |
|
1160 | 1160 |
*/ |
1161 | 1161 |
getLocation: function(oDD) { |
1162 | 1162 |
if (! this.isTypeOfDD(oDD)) { |
... | ... | |
1190 | 1190 |
|
1191 | 1191 |
/** |
1192 | 1192 |
* Checks the cursor location to see if it over the target |
1193 |
* @method isOverTarget
|
|
1194 |
* @param {YAHOO.util.Point} pt The point to evaluate
|
|
1195 |
* @param {DragDrop} oTarget the DragDrop object we are inspecting
|
|
1196 |
* @param {boolean} intersect true if we are in intersect mode
|
|
1197 |
* @param {YAHOO.util.Region} pre-cached location of the dragged element
|
|
1198 |
* @return {boolean} true if the mouse is over the target
|
|
1199 |
* @private
|
|
1200 |
* @static
|
|
1193 |
* @method isOverTarget |
|
1194 |
* @param {YAHOO.util.Point} pt The point to evaluate |
|
1195 |
* @param {DragDrop} oTarget the DragDrop object we are inspecting |
|
1196 |
* @param {boolean} intersect true if we are in intersect mode |
|
1197 |
* @param {YAHOO.util.Region} pre-cached location of the dragged element |
|
1198 |
* @return {boolean} true if the mouse is over the target |
|
1199 |
* @private |
|
1200 |
* @static |
|
1201 | 1201 |
*/ |
1202 | 1202 |
isOverTarget: function(pt, oTarget, intersect, curRegion) { |
1203 | 1203 |
// use cache if available |
... | ... | |
1262 | 1262 |
|
1263 | 1263 |
/** |
1264 | 1264 |
* unload event handler |
1265 |
* @method _onUnload
|
|
1266 |
* @private
|
|
1267 |
* @static
|
|
1265 |
* @method _onUnload |
|
1266 |
* @private |
|
1267 |
* @static |
|
1268 | 1268 |
*/ |
1269 | 1269 |
_onUnload: function(e, me) { |
1270 | 1270 |
this.unregAll(); |
... | ... | |
1272 | 1272 |
|
1273 | 1273 |
/** |
1274 | 1274 |
* Cleans up the drag and drop events and objects. |
1275 |
* @method unregAll
|
|
1276 |
* @private
|
|
1277 |
* @static
|
|
1275 |
* @method unregAll |
|
1276 |
* @private |
|
1277 |
* @static |
|
1278 | 1278 |
*/ |
1279 | 1279 |
unregAll: function() { |
1280 | 1280 |
YAHOO.log("unregister all", "info", "DragDropMgr"); |
... | ... | |
1296 | 1296 |
|
1297 | 1297 |
/** |
1298 | 1298 |
* A cache of DOM elements |
1299 |
* @property elementCache
|
|
1300 |
* @private
|
|
1301 |
* @static
|
|
1302 |
* @deprecated elements are not cached now
|
|
1299 |
* @property elementCache |
|
1300 |
* @private |
|
1301 |
* @static |
|
1302 |
* @deprecated elements are not cached now |
|
1303 | 1303 |
*/ |
1304 | 1304 |
elementCache: {}, |
1305 | 1305 |
|
1306 | 1306 |
/** |
1307 | 1307 |
* Get the wrapper for the DOM element specified |
1308 |
* @method getElWrapper
|
|
1309 |
* @param {String} id the id of the element to get
|
|
1310 |
* @return {YAHOO.util.DDM.ElementWrapper} the wrapped element
|
|
1311 |
* @private
|
|
1312 |
* @deprecated This wrapper isn't that useful
|
|
1313 |
* @static
|
|
1308 |
* @method getElWrapper |
|
1309 |
* @param {String} id the id of the element to get |
|
1310 |
* @return {YAHOO.util.DDM.ElementWrapper} the wrapped element |
|
1311 |
* @private |
|
1312 |
* @deprecated This wrapper isn't that useful |
|
1313 |
* @static |
|
1314 | 1314 |
*/ |
1315 | 1315 |
getElWrapper: function(id) { |
1316 | 1316 |
var oWrapper = this.elementCache[id]; |
... | ... | |
1323 | 1323 |
|
1324 | 1324 |
/** |
1325 | 1325 |
* Returns the actual DOM element |
1326 |
* @method getElement
|
|
1327 |
* @param {String} id the id of the elment to get
|
|
1328 |
* @return {Object} The element
|
|
1329 |
* @deprecated use YAHOO.util.Dom.get instead
|
|
1330 |
* @static
|
|
1326 |
* @method getElement |
|
1327 |
* @param {String} id the id of the elment to get |
|
1328 |
* @return {Object} The element |
|
1329 |
* @deprecated use YAHOO.util.Dom.get instead |
|
1330 |
* @static |
|
1331 | 1331 |
*/ |
1332 | 1332 |
getElement: function(id) { |
1333 | 1333 |
return YAHOO.util.Dom.get(id); |
... | ... | |
1336 | 1336 |
/** |
1337 | 1337 |
* Returns the style property for the DOM element (i.e., |
1338 | 1338 |
* document.getElById(id).style) |
1339 |
* @method getCss
|
|
1340 |
* @param {String} id the id of the elment to get
|
|
1341 |
* @return {Object} The style property of the element
|
|
1342 |
* @deprecated use YAHOO.util.Dom instead
|
|
1343 |
* @static
|
|
1339 |
* @method getCss |
|
1340 |
* @param {String} id the id of the elment to get |
|
1341 |
* @return {Object} The style property of the element |
|
1342 |
* @deprecated use YAHOO.util.Dom instead |
|
1343 |
* @static |
|
1344 | 1344 |
*/ |
1345 | 1345 |
getCss: function(id) { |
1346 | 1346 |
var el = YAHOO.util.Dom.get(id); |
... | ... | |
1349 | 1349 |
|
1350 | 1350 |
/** |
1351 | 1351 |
* Inner class for cached elements |
1352 |
* @class DragDropMgr.ElementWrapper
|
|
1353 |
* @for DragDropMgr
|
|
1354 |
* @private
|
|
1355 |
* @deprecated
|
|
1352 |
* @class DragDropMgr.ElementWrapper |
|
1353 |
* @for DragDropMgr |
|
1354 |
* @private |
|
1355 |
* @deprecated |
|
1356 | 1356 |
*/ |
1357 | 1357 |
ElementWrapper: function(el) { |
1358 | 1358 |
/** |
1359 | 1359 |
* The element |
1360 |
* @property el
|
|
1360 |
* @property el |
|
1361 | 1361 |
*/ |
1362 | 1362 |
this.el = el || null; |
1363 | 1363 |
/** |
1364 | 1364 |
* The element id |
1365 |
* @property id
|
|
1365 |
* @property id |
|
1366 | 1366 |
*/ |
1367 | 1367 |
this.id = this.el && el.id; |
1368 | 1368 |
/** |
1369 | 1369 |
* A reference to the style property |
1370 |
* @property css
|
|
1370 |
* @property css |
|
1371 | 1371 |
*/ |
1372 | 1372 |
this.css = this.el && el.style; |
1373 | 1373 |
}, |
1374 | 1374 |
|
1375 | 1375 |
/** |
1376 | 1376 |
* Returns the X position of an html element |
1377 |
* @method getPosX
|
|
1378 |
* @param el the element for which to get the position
|
|
1379 |
* @return {int} the X coordinate
|
|
1380 |
* @for DragDropMgr
|
|
1381 |
* @deprecated use YAHOO.util.Dom.getX instead
|
|
1382 |
* @static
|
|
1377 |
* @method getPosX |
|
1378 |
* @param el the element for which to get the position |
|
1379 |
* @return {int} the X coordinate |
|
1380 |
* @for DragDropMgr |
|
1381 |
* @deprecated use YAHOO.util.Dom.getX instead |
|
1382 |
* @static |
|
1383 | 1383 |
*/ |
1384 | 1384 |
getPosX: function(el) { |
1385 | 1385 |
return YAHOO.util.Dom.getX(el); |
... | ... | |
1387 | 1387 |
|
1388 | 1388 |
/** |
1389 | 1389 |
* Returns the Y position of an html element |
1390 |
* @method getPosY
|
|
1391 |
* @param el the element for which to get the position
|
|
1392 |
* @return {int} the Y coordinate
|
|
1393 |
* @deprecated use YAHOO.util.Dom.getY instead
|
|
1394 |
* @static
|
|
1390 |
* @method getPosY |
|
1391 |
* @param el the element for which to get the position |
|
1392 |
* @return {int} the Y coordinate |
|
1393 |
* @deprecated use YAHOO.util.Dom.getY instead |
|
1394 |
* @static |
|
1395 | 1395 |
*/ |
1396 | 1396 |
getPosY: function(el) { |
1397 | 1397 |
return YAHOO.util.Dom.getY(el); |
... | ... | |
1400 | 1400 |
/** |
1401 | 1401 |
* Swap two nodes. In IE, we use the native method, for others we |
1402 | 1402 |
* emulate the IE behavior |
1403 |
* @method swapNode
|
|
1404 |
* @param n1 the first node to swap
|
|
1405 |
* @param n2 the other node to swap
|
|
1406 |
* @static
|
|
1403 |
* @method swapNode |
|
1404 |
* @param n1 the first node to swap |
|
1405 |
* @param n2 the other node to swap |
|
1406 |
* @static |
|
1407 | 1407 |
*/ |
1408 | 1408 |
swapNode: function(n1, n2) { |
1409 | 1409 |
if (n1.swapNode) { |
... | ... | |
1425 | 1425 |
|
1426 | 1426 |
/** |
1427 | 1427 |
* Returns the current scroll position |
1428 |
* @method getScroll
|
|
1429 |
* @private
|
|
1430 |
* @static
|
|
1428 |
* @method getScroll |
|
1429 |
* @private |
|
1430 |
* @static |
|
1431 | 1431 |
*/ |
1432 | 1432 |
getScroll: function () { |
1433 | 1433 |
var t, l, dde=document.documentElement, db=document.body; |
... | ... | |
1445 | 1445 |
|
1446 | 1446 |
/** |
1447 | 1447 |
* Returns the specified element style property |
1448 |
* @method getStyle
|
|
1449 |
* @param {HTMLElement} el the element
|
|
1450 |
* @param {string} styleProp the style property
|
|
1451 |
* @return {string} The value of the style property
|
|
1452 |
* @deprecated use YAHOO.util.Dom.getStyle
|
|
1453 |
* @static
|
|
1448 |
* @method getStyle |
|
1449 |
* @param {HTMLElement} el the element |
|
1450 |
* @param {string} styleProp the style property |
|
1451 |
* @return {string} The value of the style property |
|
1452 |
* @deprecated use YAHOO.util.Dom.getStyle |
|
1453 |
* @static |
|
1454 | 1454 |
*/ |
1455 | 1455 |
getStyle: function(el, styleProp) { |
1456 | 1456 |
return YAHOO.util.Dom.getStyle(el, styleProp); |
... | ... | |
1458 | 1458 |
|
1459 | 1459 |
/** |
1460 | 1460 |
* Gets the scrollTop |
1461 |
* @method getScrollTop
|
|
1462 |
* @return {int} the document's scrollTop
|
|
1463 |
* @static
|
|
1461 |
* @method getScrollTop |
|
1462 |
* @return {int} the document's scrollTop |
|
1463 |
* @static |
|
1464 | 1464 |
*/ |
1465 | 1465 |
getScrollTop: function () { return this.getScroll().top; }, |
1466 | 1466 |
|
1467 | 1467 |
/** |
1468 | 1468 |
* Gets the scrollLeft |
1469 |
* @method getScrollLeft
|
|
1470 |
* @return {int} the document's scrollTop
|
|
1471 |
* @static
|
|
1469 |
* @method getScrollLeft |
|
1470 |
* @return {int} the document's scrollTop |
|
1471 |
* @static |
|
1472 | 1472 |
*/ |
1473 | 1473 |
getScrollLeft: function () { return this.getScroll().left; }, |
1474 | 1474 |
|
1475 | 1475 |
/** |
1476 | 1476 |
* Sets the x/y position of an element to the location of the |
1477 | 1477 |
* target element. |
1478 |
* @method moveToEl
|
|
1479 |
* @param {HTMLElement} moveEl The element to move
|
|
1480 |
* @param {HTMLElement} targetEl The position reference element
|
|
1481 |
* @static
|
|
1478 |
* @method moveToEl |
|
1479 |
* @param {HTMLElement} moveEl The element to move |
|
1480 |
* @param {HTMLElement} targetEl The position reference element |
|
1481 |
* @static |
|
1482 | 1482 |
*/ |
1483 | 1483 |
moveToEl: function (moveEl, targetEl) { |
1484 | 1484 |
var aCoord = YAHOO.util.Dom.getXY(targetEl); |
... | ... | |
1488 | 1488 |
|
1489 | 1489 |
/** |
1490 | 1490 |
* Gets the client height |
1491 |
* @method getClientHeight
|
|
1492 |
* @return {int} client height in px
|
|
1493 |
* @deprecated use YAHOO.util.Dom.getViewportHeight instead
|
|
1494 |
* @static
|
|
1491 |
* @method getClientHeight |
|
1492 |
* @return {int} client height in px |
|
1493 |
* @deprecated use YAHOO.util.Dom.getViewportHeight instead |
|
1494 |
* @static |
|
1495 | 1495 |
*/ |
1496 | 1496 |
getClientHeight: function() { |
1497 | 1497 |
return YAHOO.util.Dom.getViewportHeight(); |
... | ... | |
1499 | 1499 |
|
1500 | 1500 |
/** |
1501 | 1501 |
* Gets the client width |
1502 |
* @method getClientWidth
|
|
1503 |
* @return {int} client width in px
|
|
1504 |
* @deprecated use YAHOO.util.Dom.getViewportWidth instead
|
|
1505 |
* @static
|
|
1502 |
* @method getClientWidth |
|
1503 |
* @return {int} client width in px |
|
1504 |
* @deprecated use YAHOO.util.Dom.getViewportWidth instead |
|
1505 |
* @static |
|
1506 | 1506 |
*/ |
1507 | 1507 |
getClientWidth: function() { |
1508 | 1508 |
return YAHOO.util.Dom.getViewportWidth(); |
... | ... | |
1510 | 1510 |
|
1511 | 1511 |
/** |
1512 | 1512 |
* Numeric array sort function |
1513 |
* @method numericSort
|
|
1514 |
* @static
|
|
1513 |
* @method numericSort |
|
1514 |
* @static |
|
1515 | 1515 |
*/ |
1516 | 1516 |
numericSort: function(a, b) { return (a - b); }, |
1517 | 1517 |
|
1518 | 1518 |
/** |
1519 | 1519 |
* Internal counter |
1520 |
* @property _timeoutCount
|
|
1521 |
* @private
|
|
1522 |
* @static
|
|
1520 |
* @property _timeoutCount |
|
1521 |
* @private |
|
1522 |
* @static |
|
1523 | 1523 |
*/ |
1524 | 1524 |
_timeoutCount: 0, |
1525 | 1525 |
|
1526 | 1526 |
/** |
1527 | 1527 |
* Trying to make the load order less important. Without this we get |
1528 | 1528 |
* an error if this file is loaded before the Event Utility. |
1529 |
* @method _addListeners
|
|
1530 |
* @private
|
|
1531 |
* @static
|
|
1529 |
* @method _addListeners |
|
1530 |
* @private |
|
1531 |
* @static |
|
1532 | 1532 |
*/ |
1533 | 1533 |
_addListeners: function() { |
1534 | 1534 |
var DDM = YAHOO.util.DDM; |
... | ... | |
1550 | 1550 |
* Recursively searches the immediate parent and all child nodes for |
1551 | 1551 |
* the handle element in order to determine wheter or not it was |
1552 | 1552 |
* clicked. |
1553 |
* @method handleWasClicked
|
|
1554 |
* @param node the html element to inspect
|
|
1555 |
* @static
|
|
1553 |
* @method handleWasClicked |
|
1554 |
* @param node the html element to inspect |
|
1555 |
* @static |
|
1556 | 1556 |
*/ |
1557 | 1557 |
handleWasClicked: function(node, id) { |
1558 | 1558 |
if (this.isHandle(id, node.id)) { |
... | ... | |
1646 | 1646 |
/** |
1647 | 1647 |
* 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 |
1648 | 1648 |
* By setting any of these to false, then event will not be fired. |
1649 |
* @property events
|
|
1650 |
* @type object
|
|
1649 |
* @property events |
|
1650 |
* @type object |
|
1651 | 1651 |
*/ |
1652 | 1652 |
events: null, |
1653 | 1653 |
/** |
1654 |
* @method on
|
|
1655 |
* @description Shortcut for EventProvider.subscribe, see <a href="YAHOO.util.EventProvider.html#subscribe">YAHOO.util.EventProvider.subscribe</a>
|
|
1654 |
* @method on |
|
1655 |
* @description Shortcut for EventProvider.subscribe, see <a href="YAHOO.util.EventProvider.html#subscribe">YAHOO.util.EventProvider.subscribe</a> |
|
1656 | 1656 |
*/ |
1657 | 1657 |
on: function() { |
1658 | 1658 |
this.subscribe.apply(this, arguments); |
... | ... | |
1662 | 1662 |
* refer to as the "linked element" because the size and position of |
1663 | 1663 |
* this element is used to determine when the drag and drop objects have |
1664 | 1664 |
* interacted. |
1665 |
* @property id
|
|
1666 |
* @type String
|
|
1665 |
* @property id |
|
1666 |
* @type String |
|
1667 | 1667 |
*/ |
1668 | 1668 |
id: null, |
1669 | 1669 |
|
1670 | 1670 |
/** |
1671 | 1671 |
* Configuration attributes passed into the constructor |
1672 |
* @property config
|
|
1673 |
* @type object
|
|
1672 |
* @property config |
|
1673 |
* @type object |
|
1674 | 1674 |
*/ |
1675 | 1675 |
config: null, |
1676 | 1676 |
|
... | ... | |
1678 | 1678 |
* The id of the element that will be dragged. By default this is same |
1679 | 1679 |
* as the linked element , but could be changed to another element. Ex: |
1680 | 1680 |
* YAHOO.util.DDProxy |
1681 |
* @property dragElId
|
|
1682 |
* @type String
|
|
1683 |
* @private
|
|
1681 |
* @property dragElId |
|
1682 |
* @type String |
|
1683 |
* @private |
|
1684 | 1684 |
*/ |
1685 | 1685 |
dragElId: null, |
1686 | 1686 |
|
... | ... | |
1689 | 1689 |
* this is the linked element, but could be changed to be a child of this |
1690 | 1690 |
* element. This lets us do things like only starting the drag when the |
1691 | 1691 |
* header element within the linked html element is clicked. |
1692 |
* @property handleElId
|
|
1693 |
* @type String
|
|
1694 |
* @private
|
|
1692 |
* @property handleElId |
|
1693 |
* @type String |
|
1694 |
* @private |
|
1695 | 1695 |
*/ |
1696 | 1696 |
handleElId: null, |
1697 | 1697 |
|
1698 | 1698 |
/** |
1699 | 1699 |
* An associative array of HTML tags that will be ignored if clicked. |
1700 |
* @property invalidHandleTypes
|
|
1701 |
* @type {string: string}
|
|
1700 |
* @property invalidHandleTypes |
|
1701 |
* @type {string: string} |
|
1702 | 1702 |
*/ |
1703 | 1703 |
invalidHandleTypes: null, |
1704 | 1704 |
|
1705 | 1705 |
/** |
1706 | 1706 |
* An associative array of ids for elements that will be ignored if clicked |
1707 |
* @property invalidHandleIds
|
|
1708 |
* @type {string: string}
|
|
1707 |
* @property invalidHandleIds |
|
1708 |
* @type {string: string} |
|
1709 | 1709 |
*/ |
1710 | 1710 |
invalidHandleIds: null, |
1711 | 1711 |
|
1712 | 1712 |
/** |
1713 | 1713 |
* An indexted array of css class names for elements that will be ignored |
1714 | 1714 |
* if clicked. |
1715 |
* @property invalidHandleClasses
|
|
1716 |
* @type string[]
|
|
1715 |
* @property invalidHandleClasses |
|
1716 |
* @type string[] |
|
1717 | 1717 |
*/ |
1718 | 1718 |
invalidHandleClasses: null, |
1719 | 1719 |
|
1720 | 1720 |
/** |
1721 | 1721 |
* The linked element's absolute X position at the time the drag was |
1722 | 1722 |
* started |
1723 |
* @property startPageX
|
|
1724 |
* @type int
|
|
1725 |
* @private
|
|
1723 |
* @property startPageX |
|
1724 |
* @type int |
|
1725 |
* @private |
|
1726 | 1726 |
*/ |
1727 | 1727 |
startPageX: 0, |
1728 | 1728 |
|
1729 | 1729 |
/** |
1730 | 1730 |
* The linked element's absolute X position at the time the drag was |
1731 | 1731 |
* started |
1732 |
* @property startPageY
|
|
1733 |
* @type int
|
|
1734 |
* @private
|
|
1732 |
* @property startPageY |
|
1733 |
* @type int |
|
1734 |
* @private |
|
1735 | 1735 |
*/ |
1736 | 1736 |
startPageY: 0, |
1737 | 1737 |
|
... | ... | |
1740 | 1740 |
* related. Instances only get events when interacting with other |
1741 | 1741 |
* DragDrop object in the same group. This lets us define multiple |
1742 | 1742 |
* groups using a single DragDrop subclass if we want. |
1743 |
* @property groups
|
|
1744 |
* @type {string: string}
|
|
1743 |
* @property groups |
|
1744 |
* @type {string: string} |
|
1745 | 1745 |
*/ |
1746 | 1746 |
groups: null, |
1747 | 1747 |
|
1748 | 1748 |
/** |
1749 | 1749 |
* Individual drag/drop instances can be locked. This will prevent |
1750 | 1750 |
* onmousedown start drag. |
1751 |
* @property locked
|
|
1752 |
* @type boolean
|
|
1753 |
* @private
|
|
1751 |
* @property locked |
|
1752 |
* @type boolean |
|
1753 |
* @private |
|
1754 | 1754 |
*/ |
1755 | 1755 |
locked: false, |
1756 | 1756 |
|
1757 | 1757 |
/** |
1758 | 1758 |
* Lock this instance |
1759 |
* @method lock
|
|
1759 |
* @method lock |
|
1760 | 1760 |
*/ |
1761 | 1761 |
lock: function() { this.locked = true; }, |
1762 | 1762 |
|
1763 | 1763 |
/** |
1764 | 1764 |
* Unlock this instace |
1765 |
* @method unlock
|
|
1765 |
* @method unlock |
|
1766 | 1766 |
*/ |
1767 | 1767 |
unlock: function() { this.locked = false; }, |
1768 | 1768 |
|
1769 | 1769 |
/** |
1770 | 1770 |
* By default, all instances can be a drop target. This can be disabled by |
1771 | 1771 |
* setting isTarget to false. |
1772 |
* @property isTarget
|
|
1773 |
* @type boolean
|
|
1772 |
* @property isTarget |
|
1773 |
* @type boolean |
|
1774 | 1774 |
*/ |
1775 | 1775 |
isTarget: true, |
1776 | 1776 |
|
1777 | 1777 |
/** |
1778 | 1778 |
* The padding configured for this drag and drop object for calculating |
1779 | 1779 |
* the drop zone intersection with this object. |
1780 |
* @property padding
|
|
1781 |
* @type int[]
|
|
1780 |
* @property padding |
|
1781 |
* @type int[] |
|
1782 | 1782 |
*/ |
1783 | 1783 |
padding: null, |
1784 | 1784 |
/** |
1785 | 1785 |
* If this flag is true, do not fire drop events. The element is a drag only element (for movement not dropping) |
1786 |
* @property dragOnly
|
|
1787 |
* @type Boolean
|
|
1786 |
* @property dragOnly |
|
1787 |
* @type Boolean |
|
1788 | 1788 |
*/ |
1789 | 1789 |
dragOnly: false, |
1790 | 1790 |
|
1791 | 1791 |
/** |
1792 | 1792 |
* 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. |
1793 |
* @property useShim
|
|
1794 |
* @type Boolean
|
|
1793 |
* @property useShim |
|
1794 |
* @type Boolean |
|
1795 | 1795 |
*/ |
1796 | 1796 |
useShim: false, |
1797 | 1797 |
|
1798 | 1798 |
/** |
1799 | 1799 |
* Cached reference to the linked element |
1800 |
* @property _domRef
|
|
1801 |
* @private
|
|
1800 |
* @property _domRef |
|
1801 |
* @private |
|
1802 | 1802 |
*/ |
1803 | 1803 |
_domRef: null, |
1804 | 1804 |
|
1805 | 1805 |
/** |
1806 | 1806 |
* Internal typeof flag |
1807 |
* @property __ygDragDrop
|
|
1808 |
* @private
|
|
1807 |
* @property __ygDragDrop |
|
1808 |
* @private |
|
1809 | 1809 |
*/ |
1810 | 1810 |
__ygDragDrop: true, |
1811 | 1811 |
|
1812 | 1812 |
/** |
1813 | 1813 |
* Set to true when horizontal contraints are applied |
1814 |
* @property constrainX
|
|
1815 |
* @type boolean
|
|
1816 |
* @private
|
|
1814 |
* @property constrainX |
|
1815 |
* @type boolean |
|
1816 |
* @private |
|
1817 | 1817 |
*/ |
1818 | 1818 |
constrainX: false, |
1819 | 1819 |
|
1820 | 1820 |
/** |
1821 | 1821 |
* Set to true when vertical contraints are applied |
1822 |
* @property constrainY
|
|
1823 |
* @type boolean
|
|
1824 |
* @private
|
|
1822 |
* @property constrainY |
|
1823 |
* @type boolean |
|
1824 |
* @private |
|
1825 | 1825 |
*/ |
1826 | 1826 |
constrainY: false, |
1827 | 1827 |
|
1828 | 1828 |
/** |
1829 | 1829 |
* The left constraint |
1830 |
* @property minX
|
|
1831 |
* @type int
|
|
1832 |
* @private
|
|
1830 |
* @property minX |
|
1831 |
* @type int |
|
1832 |
* @private |
|
1833 | 1833 |
*/ |
1834 | 1834 |
minX: 0, |
1835 | 1835 |
|
1836 | 1836 |
/** |
1837 | 1837 |
* The right constraint |
1838 |
* @property maxX
|
|
1839 |
* @type int
|
|
1840 |
* @private
|
|
1838 |
* @property maxX |
|
1839 |
* @type int |
|
1840 |
* @private |
|
1841 | 1841 |
*/ |
1842 | 1842 |
maxX: 0, |
1843 | 1843 |
|
1844 | 1844 |
/** |
1845 | 1845 |
* The up constraint |
1846 |
* @property minY
|
|
1847 |
* @type int
|
|
1848 |
* @type int
|
|
1849 |
* @private
|
|
1846 |
* @property minY |
|
1847 |
* @type int |
|
1848 |
* @type int |
|
1849 |
* @private |
|
1850 | 1850 |
*/ |
1851 | 1851 |
minY: 0, |
1852 | 1852 |
|
1853 | 1853 |
/** |
1854 | 1854 |
* The down constraint |
1855 |
* @property maxY
|
|
1856 |
* @type int
|
|
1857 |
* @private
|
|
1855 |
* @property maxY |
|
1856 |
* @type int |
|
1857 |
* @private |
|
1858 | 1858 |
*/ |
1859 | 1859 |
maxY: 0, |
1860 | 1860 |
|
1861 | 1861 |
/** |
1862 | 1862 |
* The difference between the click position and the source element's location |
1863 |
* @property deltaX
|
|
1864 |
* @type int
|
|
1865 |
* @private
|
|
1863 |
* @property deltaX |
|
1864 |
* @type int |
|
1865 |
* @private |
|
1866 | 1866 |
*/ |
1867 | 1867 |
deltaX: 0, |
1868 | 1868 |
|
1869 | 1869 |
/** |
1870 | 1870 |
* The difference between the click position and the source element's location |
1871 |
* @property deltaY |
|
1872 |
* @type int |
Also available in: Unified diff
fixed headerinfos