Permalink
Browse files

use getBoundingClientRect() to determine local mouse location

  • Loading branch information...
mojombo committed Oct 25, 2008
1 parent c98a2b3 commit fd6022c5c09804789254f1dd9c48553df329b5ad
Showing with 3 additions and 2 deletions.
  1. +3 −2 primer.js
View
@@ -31,8 +31,9 @@ Primer.prototype = {
var self = this
jelc.eq(0).mousemove(function(e) {
- e.localX = e.clientX - elc.offsetLeft
- e.localY = e.clientY - elc.offsetTop
+ var bounds = e.currentTarget.getBoundingClientRect()
+ e.localX = e.clientX - bounds.left
+ e.localY = e.clientY - bounds.top
self.ghost(e)
})
},

0 comments on commit fd6022c

Please sign in to comment.