fix opera movement... again

This commit is contained in:
James Campos 2011-03-26 22:11:28 -07:00
parent 4f8cfbc148
commit 7cd3075dfa
2 changed files with 8 additions and 5 deletions

View File

@ -183,10 +183,11 @@
return el;
},
move: function(e) {
var el;
var el, rect;
el = ui.el;
ui.dx = e.clientX - el.offsetLeft;
ui.dy = e.clientY - el.offsetTop;
rect = el.getBoundingClientRect();
ui.dx = e.clientX - rect.left;
ui.dy = e.clientY - rect.top;
ui.width = document.body.clientWidth - el.offsetWidth;
ui.height = document.body.clientHeight - el.offsetHeight;
document.addEventListener('mousemove', ui.moveMove, true);

View File

@ -100,8 +100,10 @@ ui =
move: (e) ->
{el} = ui
#distance from pointer to el edge is constant; calculate it here.
ui.dx = e.clientX - el.offsetLeft
ui.dy = e.clientY - el.offsetTop
# XXX opera reports el.offsetLeft / el.offsetTop as 0
rect = el.getBoundingClientRect()
ui.dx = e.clientX - rect.left
ui.dy = e.clientY - rect.top
#factor out el from document dimensions
ui.width = document.body.clientWidth - el.offsetWidth
ui.height = document.body.clientHeight - el.offsetHeight