summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/MochiKit/DragAndDrop.js
authorGiulio Cesare Solaroli <giulio.cesare@clipperz.com>2012-03-17 21:08:23 (UTC)
committer Giulio Cesare Solaroli <giulio.cesare@clipperz.com>2012-03-17 21:08:23 (UTC)
commit928f3f3ed3981f7f81b69ed94f2a315205db39fa (patch) (unidiff)
tree8a47229b56e4c906de8512baf0c5ca100bc03dfb /frontend/gamma/js/MochiKit/DragAndDrop.js
parentbf7d8191a3a6dbd092a88911098a3e7f6cf30cf7 (diff)
downloadclipperz-928f3f3ed3981f7f81b69ed94f2a315205db39fa.zip
clipperz-928f3f3ed3981f7f81b69ed94f2a315205db39fa.tar.gz
clipperz-928f3f3ed3981f7f81b69ed94f2a315205db39fa.tar.bz2
Fixed frontend properties and updated MochiKit version
Diffstat (limited to 'frontend/gamma/js/MochiKit/DragAndDrop.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/MochiKit/DragAndDrop.js14
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,23 +1,23 @@
1/*** 1/***
2MochiKit.DragAndDrop 1.5 2MochiKit.DragAndDrop 1.5
3 3
4See <http://mochikit.com/> for documentation, downloads, license, etc. 4See <http://mochikit.com/> for documentation, downloads, license, etc.
5 5
6Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 6Copyright (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
11MochiKit.Base._module('DragAndDrop', '1.5', ['Base', 'Iter', 'DOM', 'Signal', 'Visual', 'Position']); 11MochiKit.Base.module(MochiKit, 'DragAndDrop', '1.5', ['Base', 'Iter', 'DOM', 'Signal', 'Visual', 'Position']);
12 12
13MochiKit.DragAndDrop.Droppables = { 13MochiKit.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);
@@ -297,26 +297,27 @@ MochiKit.DragAndDrop.Draggables = {
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);
@@ -433,26 +434,26 @@ MochiKit.DragAndDrop.Draggable.prototype = {
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' ||
@@ -472,26 +473,25 @@ MochiKit.DragAndDrop.Draggable.prototype = {
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);