{"name":"mouse-event-offset","version":"1.0.2","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":"b38605c8e7cda8f0dcea1b856e113ca3f2f09a22","_id":"mouse-event-offset@1.0.2","_shasum":"52be322ba9e66b6b869b03c6312e2567e0e5a749","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"dist":{"shasum":"52be322ba9e66b6b869b03c6312e2567e0e5a749","tarball":"http://registry-npm.ywwl.com/mouse-event-offset/download/mouse-event-offset-1.0.2.tgz","integrity":"sha512-8j8uktqMoC7z5ntk9Fico/E/9dUcq06ISjRRgkQwfIiKEbGeWZooFCg+WHxIfs6a8F+S9ty+do+39NYM+FFcbA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICVZhgu9hxl9f/otF40ZtuDSQg/WLULHPe0M34XxBGLkAiBvFfxpkFAADXPxsdXHijYIRO+3tjQdz3cBFAp3XbiY1A=="}],"size":2058,"noattachment":false,"key":"/mouse-event-offset/-/mouse-event-offset-1.0.2.tgz"},"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":1411395338088,"_cnpm_publish_time":1411395338088,"dist-tags":{"latest":"3.0.2"}}