diff options
Diffstat (limited to 'lib/scripts/drag.js')
-rw-r--r-- | lib/scripts/drag.js | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/lib/scripts/drag.js b/lib/scripts/drag.js index 2212fb6c1..6ab275a61 100644 --- a/lib/scripts/drag.js +++ b/lib/scripts/drag.js @@ -1,29 +1,29 @@ /** - * Makes a DOM object draggable - * - * If you just want to move objects around, use drag.attach. For full - * customization, drag can be used as a javascript prototype, it is - * inheritance-aware. - * - * @link http://nofunc.org/Drag_Drop/ - */ +* Makes a DOM object draggable +* +* If you just want to move objects around, use drag.attach. For full +* customization, drag can be used as a javascript prototype, it is +* inheritance-aware. +* +* @link http://nofunc.org/Drag_Drop/ +*/ var drag = { obj: null, handle: null, - oX: 0, // object X position - oY: 0, // object Y position - eX: 0, // event X delta - eY: 0, // event Y delta + oX: 0, // object X position + oY: 0, // object Y position + eX: 0, // event X delta + eY: 0, // event Y delta /** - * Attaches the needed handlers to the given object - * - * This can be called for multiple objects, the right one is later - * determined from the event itself. The handle is optional - * - * @param DOMObject obj The object that should be draggable - * @param DOMObject handle A handle on which the obj can be dragged - */ +* Attaches the needed handlers to the given object +* +* This can be called for multiple objects, the right one is later +* determined from the event itself. The handle is optional +* +* @param DOMObject obj The object that should be draggable +* @param DOMObject handle A handle on which the obj can be dragged +*/ attach: function (obj,handle) { if(handle){ handle.dragobject = obj; @@ -35,8 +35,8 @@ var drag = { }, /** - * Starts the dragging operation - */ +* Starts the dragging operation +*/ start: function (e){ this.handle = e.target; if(this.handle.dragobject){ @@ -46,7 +46,7 @@ var drag = { } this.handle.className += ' ondrag'; - this.obj.className += ' ondrag'; + this.obj.className += ' ondrag'; this.oX = parseInt(this.obj.style.left); this.oY = parseInt(this.obj.style.top); @@ -62,11 +62,11 @@ var drag = { }, /** - * Ends the dragging operation - */ +* Ends the dragging operation +*/ stop: function(){ this.handle.className = this.handle.className.replace(/ ?ondrag/,''); - this.obj.className = this.obj.className.replace(/ ?ondrag/,''); + this.obj.className = this.obj.className.replace(/ ?ondrag/,''); removeEvent(document,'mousemove', this.mousehandlers[0]); removeEvent(document,'mouseup', this.mousehandlers[1]); this.obj = null; @@ -74,12 +74,12 @@ var drag = { }, /** - * Moves the object during the dragging operation - */ +* Moves the object during the dragging operation +*/ drag: function(e) { if(this.obj) { - this.obj.style.top = (e.pageY+this.oY-this.eY+'px'); + this.obj.style.top = (e.pageY+this.oY-this.eY+'px'); this.obj.style.left = (e.pageX+this.oX-this.eX+'px'); } } -}; +};
\ No newline at end of file |