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; return el;
}, },
move: function(e) { move: function(e) {
var el; var el, rect;
el = ui.el; el = ui.el;
ui.dx = e.clientX - el.offsetLeft; rect = el.getBoundingClientRect();
ui.dy = e.clientY - el.offsetTop; ui.dx = e.clientX - rect.left;
ui.dy = e.clientY - rect.top;
ui.width = document.body.clientWidth - el.offsetWidth; ui.width = document.body.clientWidth - el.offsetWidth;
ui.height = document.body.clientHeight - el.offsetHeight; ui.height = document.body.clientHeight - el.offsetHeight;
document.addEventListener('mousemove', ui.moveMove, true); document.addEventListener('mousemove', ui.moveMove, true);

View File

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