Do not select when moving boxes.

This commit is contained in:
Mayhem 2011-04-27 23:46:58 +02:00
parent 0b6fc34ebb
commit e79961031a
2 changed files with 21 additions and 1 deletions

View File

@ -179,6 +179,7 @@
move: function(e) {
var el, rect;
ui.el = el = e.target.parentNode;
document.body.className = 'noselect';
rect = el.getBoundingClientRect();
ui.dx = e.clientX - rect.left;
ui.dy = e.clientY - rect.top;
@ -216,7 +217,8 @@
el = ui.el;
id = el.id;
localStorage["" + id + "Left"] = el.style.left;
return localStorage["" + id + "Top"] = el.style.top;
localStorage["" + id + "Top"] = el.style.top;
return document.body.className = '';
}
};
d = document;
@ -2237,6 +2239,14 @@
#watcher > div:last-child {\
padding: 0 5px 5px 5px;\
}\
\
body.noselect {\
-webkit-user-select: none;\
-khtml-user-select: none;\
-moz-user-select: none;\
-o-user-select: none;\
user-select: none;\
}\
'
};
main.init();

View File

@ -98,6 +98,7 @@ ui =
el
move: (e) ->
ui.el = el = e.target.parentNode
document.body.className = 'noselect'
#distance from pointer to el edge is constant; calculate it here.
# XXX opera reports el.offsetLeft / el.offsetTop as 0
rect = el.getBoundingClientRect()
@ -129,6 +130,7 @@ ui =
{id} = el
localStorage["#{id}Left"] = el.style.left
localStorage["#{id}Top"] = el.style.top
document.body.className = ''
#convenience
d = document
@ -1757,6 +1759,14 @@ main =
#watcher > div:last-child {
padding: 0 5px 5px 5px;
}
body.noselect {
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
}
'
main.init()