{"name":"mouse-event-offset","version":"3.0.0","description":"get relative position from an event","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com"},"dependencies":{},"devDependencies":{"dom-events":"^0.1.1","dom-style":"0.0.3","domready":"^1.0.6","simulate-event":"0.0.3","tape":"~2.13.2"},"scripts":{"test":"node test.js"},"testling":{"files":"test.js","browsers":["ie/6..latest","chrome/22..latest","firefox/16..latest","safari/latest","opera/11.0..latest","iphone/6","ipad/6","android-browser/latest"]},"repository":{"type":"git","url":"git://github.com/mattdesl/mouse-event-offset.git"},"homepage":"https://github.com/mattdesl/mouse-event-offset","bugs":{"url":"https://github.com/mattdesl/mouse-event-offset/issues"},"keywords":["mouse","event","offset","top","left","corner","clientX","clientY","offsetX","offsetY","getBoundingClientRect","click","relative","position"],"gitHead":"66a823e7ace599cc1b5013896ca04507f24be2c9","_id":"mouse-event-offset@3.0.0","_shasum":"e42b2ab31c2741f324aac7b85e2567d4c1a1dac8","_from":".","_npmVersion":"2.14.5","_nodeVersion":"0.12.7","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"dist":{"shasum":"e42b2ab31c2741f324aac7b85e2567d4c1a1dac8","tarball":"http://registry-npm.ywwl.com/mouse-event-offset/download/mouse-event-offset-3.0.0.tgz","integrity":"sha512-RsWPN+xyQg3ElfAbKJpwpiXyi/aeGJ7QWpVc3/ybAJ2K9lhEyzAyaY5/z4NEk3iLSuhpAPqGyDP5w9PZvdWjHw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCCEzVggoqRpD9mCohB8gHOoa8CO3KFtqTJWXNJyOiU3AIgQOAkM730mOhF2EMIBElH5M5iLAxExqMY5dNTsTWn7M0="}],"size":2280,"noattachment":false,"key":"/mouse-event-offset/-/mouse-event-offset-3.0.0.tgz"},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"directories":{},"readme":"# mouse-event-offset\n\n[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)\n\nComputes the `[ offsetX, offsetY ]` from a mouse or touch event, relative to the top left of the `target` element.\n\n```js \nvar offset = require('mouse-event-offset')\n\nwindow.addEventListener('touchstart', function (ev) {\n  var target = ev.currentTarget\n  var touch = ev.changedTouches[0]\n  var pos = offset(touch, target)\n  //=> [ 128, 52 ]\n})\n```\n## Usage\n\n### `position = offset(event, [target], [out])`\n\nPass a MouseEvent or TouchEvent as `event`. \n\nOptionally, you can specify a `target` element which the touch event should be relative to. Defaults to `event.currentTarget`, falling back to `event.srcElement` for older IE.\n\nYou can also specifiy `out` to store the position in that array, and avoid creating a new one.\n\n## Changelog\n\n- `3.x` new version; simpler API, less assumptions, avoids GC thrashing\n- `2.x` uses `ev.currentTarget` instead of `ev.target`\n- `1.x` simple implementation using `ev.target || ev.srcElement`\n\n## License\n\nMIT, see [LICENSE.md](http://github.com/mattdesl/mouse-event-offset/blob/master/LICENSE.md) for details.\n","publish_time":1443493765857,"_cnpm_publish_time":1443493765857,"dist-tags":{"latest":"3.0.2"}}