Diffstat (limited to 'frontend/gamma/js/MochiKit/DragAndDrop.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/MochiKit/DragAndDrop.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/frontend/gamma/js/MochiKit/DragAndDrop.js b/frontend/gamma/js/MochiKit/DragAndDrop.js index 62777c5..cf84f77 100644 --- a/frontend/gamma/js/MochiKit/DragAndDrop.js +++ b/frontend/gamma/js/MochiKit/DragAndDrop.js | |||
@@ -1,27 +1,27 @@ | |||
1 | /*** | 1 | /*** |
2 | MochiKit.DragAndDrop 1.5 | 2 | MochiKit.DragAndDrop 1.5 |
3 | 3 | ||
4 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 4 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
5 | 5 | ||
6 | Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) | 6 | Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) |
7 | Mochi-ized By Thomas Herve (_firstname_@nimail.org) | 7 | Mochi-ized By Thomas Herve (_firstname_@nimail.org) |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | MochiKit.Base._module('DragAndDrop', '1.5', ['Base', 'Iter', 'DOM', 'Signal', 'Visual', 'Position']); | 11 | MochiKit.Base.module(MochiKit, 'DragAndDrop', '1.5', ['Base', 'Iter', 'DOM', 'Signal', 'Visual', 'Position']); |
12 | 12 | ||
13 | MochiKit.DragAndDrop.Droppables = { | 13 | MochiKit.DragAndDrop.Droppables = { |
14 | /*** | 14 | /*** |
15 | 15 | ||
16 | Manage all droppables. Shouldn't be used, use the Droppable object instead. | 16 | Manage all droppables. Shouldn't be used, use the Droppable object instead. |
17 | 17 | ||
18 | ***/ | 18 | ***/ |
19 | drops: [], | 19 | drops: [], |
20 | 20 | ||
21 | remove: function (element) { | 21 | remove: function (element) { |
22 | this.drops = MochiKit.Base.filter(function (d) { | 22 | this.drops = MochiKit.Base.filter(function (d) { |
23 | return d.element != MochiKit.DOM.getElement(element); | 23 | return d.element != MochiKit.DOM.getElement(element); |
24 | }, this.drops); | 24 | }, this.drops); |
25 | }, | 25 | }, |
26 | 26 | ||
27 | register: function (drop) { | 27 | register: function (drop) { |
@@ -293,34 +293,35 @@ MochiKit.DragAndDrop.Draggables = { | |||
293 | // fails for Safari | 293 | // fails for Safari |
294 | window.focus(); | 294 | window.focus(); |
295 | this.activeDraggable = draggable; | 295 | this.activeDraggable = draggable; |
296 | }, | 296 | }, |
297 | 297 | ||
298 | deactivate: function () { | 298 | deactivate: function () { |
299 | this.activeDraggable = null; | 299 | this.activeDraggable = null; |
300 | }, | 300 | }, |
301 | 301 | ||
302 | updateDrag: function (event) { | 302 | updateDrag: function (event) { |
303 | if (!this.activeDraggable) { | 303 | if (!this.activeDraggable) { |
304 | return; | 304 | return; |
305 | } | 305 | } |
306 | var pointer = event.mouse(); | 306 | var pointer = event.mouse(); |
307 | // Mozilla-based browsers fire successive mousemove events with | 307 | // Mozilla-based browsers fire successive mousemove events with |
308 | // the same coordinates, prevent needless redrawing (moz bug?) | 308 | // the same coordinates, prevent needless redrawing (moz bug?) |
309 | if (this._lastPointer && (MochiKit.Base.repr(this._lastPointer.page) == | 309 | if (this._lastPointer && |
310 | MochiKit.Base.repr(pointer.page))) { | 310 | this._lastPointer.page.x == pointer.page.x && |
311 | this._lastPointer.page.y == pointer.page.y) { | ||
311 | return; | 312 | return; |
312 | } | 313 | } |
313 | this._lastPointer = pointer; | 314 | this._lastPointer = pointer; |
314 | this.activeDraggable.updateDrag(event, pointer); | 315 | this.activeDraggable.updateDrag(event, pointer); |
315 | }, | 316 | }, |
316 | 317 | ||
317 | endDrag: function (event) { | 318 | endDrag: function (event) { |
318 | if (!this.activeDraggable) { | 319 | if (!this.activeDraggable) { |
319 | return; | 320 | return; |
320 | } | 321 | } |
321 | this._lastPointer = null; | 322 | this._lastPointer = null; |
322 | this.activeDraggable.endDrag(event); | 323 | this.activeDraggable.endDrag(event); |
323 | this.activeDraggable = null; | 324 | this.activeDraggable = null; |
324 | }, | 325 | }, |
325 | 326 | ||
326 | keyPress: function (event) { | 327 | keyPress: function (event) { |
@@ -429,34 +430,34 @@ MochiKit.DragAndDrop.Draggable.prototype = { | |||
429 | 430 | ||
430 | this.eventMouseDown = MochiKit.Signal.connect(this.handle, | 431 | this.eventMouseDown = MochiKit.Signal.connect(this.handle, |
431 | 'onmousedown', this, this.initDrag); | 432 | 'onmousedown', this, this.initDrag); |
432 | MochiKit.DragAndDrop.Draggables.register(this); | 433 | MochiKit.DragAndDrop.Draggables.register(this); |
433 | }, | 434 | }, |
434 | 435 | ||
435 | /** @id MochiKit.DragAndDrop.destroy */ | 436 | /** @id MochiKit.DragAndDrop.destroy */ |
436 | destroy: function () { | 437 | destroy: function () { |
437 | MochiKit.Signal.disconnect(this.eventMouseDown); | 438 | MochiKit.Signal.disconnect(this.eventMouseDown); |
438 | MochiKit.DragAndDrop.Draggables.unregister(this); | 439 | MochiKit.DragAndDrop.Draggables.unregister(this); |
439 | }, | 440 | }, |
440 | 441 | ||
441 | /** @id MochiKit.DragAndDrop.currentDelta */ | 442 | /** @id MochiKit.DragAndDrop.currentDelta */ |
442 | currentDelta: function () { | 443 | currentDelta: function () { |
443 | var s = MochiKit.Style.getStyle; | 444 | var s = MochiKit.Style.getStyle; |
444 | return [ | 445 | return [ |
445 | parseInt(s(this.element, 'left') || '0'), | 446 | parseInt(s(this.element, 'left') || '0', 10), |
446 | parseInt(s(this.element, 'top') || '0')]; | 447 | parseInt(s(this.element, 'top') || '0', 10)]; |
447 | }, | 448 | }, |
448 | 449 | ||
449 | /** @id MochiKit.DragAndDrop.initDrag */ | 450 | /** @id MochiKit.DragAndDrop.initDrag */ |
450 | initDrag: function (event) { | 451 | initDrag: function (event) { |
451 | if (!event.mouse().button.left) { | 452 | if (!event.mouse().button.left) { |
452 | return; | 453 | return; |
453 | } | 454 | } |
454 | // abort on form elements, fixes a Firefox issue | 455 | // abort on form elements, fixes a Firefox issue |
455 | var src = event.target(); | 456 | var src = event.target(); |
456 | var tagName = (src.tagName || '').toUpperCase(); | 457 | var tagName = (src.tagName || '').toUpperCase(); |
457 | if (tagName === 'INPUT' || tagName === 'SELECT' || | 458 | if (tagName === 'INPUT' || tagName === 'SELECT' || |
458 | tagName === 'OPTION' || tagName === 'BUTTON' || | 459 | tagName === 'OPTION' || tagName === 'BUTTON' || |
459 | tagName === 'TEXTAREA') { | 460 | tagName === 'TEXTAREA') { |
460 | return; | 461 | return; |
461 | } | 462 | } |
462 | 463 | ||
@@ -468,34 +469,33 @@ MochiKit.DragAndDrop.Draggable.prototype = { | |||
468 | var pointer = event.mouse(); | 469 | var pointer = event.mouse(); |
469 | var pos = MochiKit.Position.cumulativeOffset(this.element); | 470 | var pos = MochiKit.Position.cumulativeOffset(this.element); |
470 | this.offset = [pointer.page.x - pos.x, pointer.page.y - pos.y]; | 471 | this.offset = [pointer.page.x - pos.x, pointer.page.y - pos.y]; |
471 | 472 | ||
472 | MochiKit.DragAndDrop.Draggables.activate(this); | 473 | MochiKit.DragAndDrop.Draggables.activate(this); |
473 | event.stop(); | 474 | event.stop(); |
474 | }, | 475 | }, |
475 | 476 | ||
476 | /** @id MochiKit.DragAndDrop.startDrag */ | 477 | /** @id MochiKit.DragAndDrop.startDrag */ |
477 | startDrag: function (event) { | 478 | startDrag: function (event) { |
478 | this.dragging = true; | 479 | this.dragging = true; |
479 | if (this.options.selectclass) { | 480 | if (this.options.selectclass) { |
480 | MochiKit.DOM.addElementClass(this.element, | 481 | MochiKit.DOM.addElementClass(this.element, |
481 | this.options.selectclass); | 482 | this.options.selectclass); |
482 | } | 483 | } |
483 | if (this.options.zindex) { | 484 | if (this.options.zindex) { |
484 | this.originalZ = parseInt(MochiKit.Style.getStyle(this.element, | 485 | this.originalZ = MochiKit.Style.getStyle(this.element, 'z-index'); |
485 | 'z-index') || '0'); | ||
486 | this.element.style.zIndex = this.options.zindex; | 486 | this.element.style.zIndex = this.options.zindex; |
487 | } | 487 | } |
488 | 488 | ||
489 | if (this.options.ghosting) { | 489 | if (this.options.ghosting) { |
490 | this._clone = this.element.cloneNode(true); | 490 | this._clone = this.element.cloneNode(true); |
491 | this.ghostPosition = MochiKit.Position.absolutize(this.element); | 491 | this.ghostPosition = MochiKit.Position.absolutize(this.element); |
492 | this.element.parentNode.insertBefore(this._clone, this.element); | 492 | this.element.parentNode.insertBefore(this._clone, this.element); |
493 | } | 493 | } |
494 | 494 | ||
495 | if (this.options.scroll) { | 495 | if (this.options.scroll) { |
496 | if (this.options.scroll == window) { | 496 | if (this.options.scroll == window) { |
497 | var where = this._getWindowScroll(this.options.scroll); | 497 | var where = this._getWindowScroll(this.options.scroll); |
498 | this.originalScrollLeft = where.left; | 498 | this.originalScrollLeft = where.left; |
499 | this.originalScrollTop = where.top; | 499 | this.originalScrollTop = where.top; |
500 | } else { | 500 | } else { |
501 | this.originalScrollLeft = this.options.scroll.scrollLeft; | 501 | this.originalScrollLeft = this.options.scroll.scrollLeft; |