summaryrefslogtreecommitdiff
path: root/lib/scripts/drag.js
diff options
context:
space:
mode:
authorAndreas Gohr <gohr@cosmocode.de>2009-08-12 20:03:44 +0200
committerAndreas Gohr <gohr@cosmocode.de>2009-08-12 20:03:44 +0200
commit6977dceff2f79ba3dc75e6d3d47eaf16aad3fb8f (patch)
tree409bca8ef1f93232ef4b97f9cf279ad9b3d35d70 /lib/scripts/drag.js
parent56dfcc12d4d4b326fc393a8271da0cf8374d3a11 (diff)
downloadrpg-6977dceff2f79ba3dc75e6d3d47eaf16aad3fb8f.tar.gz
rpg-6977dceff2f79ba3dc75e6d3d47eaf16aad3fb8f.tar.bz2
make dragged objects stylable via CSS
Ignore-this: ae47b532b80d10868e82e0ccc5c963d1 A DOM object that is dragged through the new drag Object gets the ondrag assigned. note: development was part of the ICKE 2.0 project see http://www.icke-projekt.de for info darcs-hash:20090812180344-6e07b-a50d6589f0650897ddd5f5d345a3d15513aada77.gz
Diffstat (limited to 'lib/scripts/drag.js')
-rw-r--r--lib/scripts/drag.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/scripts/drag.js b/lib/scripts/drag.js
index aefe8af52..1294be602 100644
--- a/lib/scripts/drag.js
+++ b/lib/scripts/drag.js
@@ -37,14 +37,15 @@ drag = {
*/
start: function (e){
drag.handle = e.target;
- drag.handle.style.cursor = 'move';
-
if(drag.handle.dragobject){
drag.obj = drag.handle.dragobject;
}else{
drag.obj = drag.handle;
}
+ drag.handle.className += ' ondrag';
+ drag.obj.className += ' ondrag';
+
drag.oX = parseInt(drag.obj.style.left);
drag.oY = parseInt(drag.obj.style.top);
drag.eX = drag.evX(e);
@@ -62,7 +63,8 @@ drag = {
* Ends the dragging operation
*/
stop: function(){
- drag.handle.style.cursor = '';
+ drag.handle.className = drag.handle.className.replace(/ ?ondrag/,'');
+ drag.obj.className = drag.obj.className.replace(/ ?ondrag/,'');
removeEvent(document,'mousemove',drag.drag);
removeEvent(document,'mouseup',drag.stop);
drag.obj = null;