{"_id":"canvas-fit","_rev":"17-d0ae26c14a00111d4d6271bec0bd254f","name":"canvas-fit","description":"Small module for fitting a canvas element within the bounds of its parent.","dist-tags":{"latest":"1.5.0"},"versions":{"0.0.0":{"name":"canvas-fit","version":"0.0.0","description":"Small module for fitting a canvas element within the bounds of its parent.","main":"index.js","scripts":{"test":"beefy test.js --open"},"repository":{"type":"git","url":"git://github.com/hughsk/canvas-fit.git"},"author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com","url":"http://hughsk.io/"},"license":"MIT","bugs":{"url":"https://github.com/hughsk/canvas-fit/issues"},"homepage":"https://github.com/hughsk/canvas-fit","dependencies":{},"devDependencies":{"beefy":"^1.1.0","raf":"^0.1.3"},"keywords":["canvas","fit","screen","window","browser","stretch","resize"],"_id":"canvas-fit@0.0.0","_shasum":"5fbfc34736f532d6fd2e474ff4493c3bd4b5415f","_from":".","_npmVersion":"1.4.10","_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"dist":{"shasum":"5fbfc34736f532d6fd2e474ff4493c3bd4b5415f","tarball":"https://registry.npmjs.org/canvas-fit/-/canvas-fit-0.0.0.tgz","integrity":"sha512-nKe3B2VQFsF4/2uRPAwrCY5L1UzKAlH86msRCz933xQzLVkrDt4U8Mu14OOidCKdI/h9PKF0HWrYLgBzdam2rA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCD6f9pbRtD88xR7cJLBGiUYk97AROa5rpuWdneTOcFiwIhANZYB+fV18vvv+KJ3bu1QH6CePqw3KWxm2e+xBl9ElS+"}]}},"1.0.0":{"name":"canvas-fit","version":"1.0.0","description":"Small module for fitting a canvas element within the bounds of its parent.","main":"index.js","scripts":{"test":"beefy test.js --open"},"repository":{"type":"git","url":"git://github.com/hughsk/canvas-fit.git"},"author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com","url":"http://hughsk.io/"},"license":"MIT","bugs":{"url":"https://github.com/hughsk/canvas-fit/issues"},"homepage":"https://github.com/hughsk/canvas-fit","dependencies":{"element-size":"^1.0.0"},"devDependencies":{"beefy":"^1.1.0","raf":"^0.1.3"},"keywords":["canvas","fit","screen","window","browser","stretch","resize"],"gitHead":"8049cd5046cecc5175f1300e1a72f4b08a656b13","_id":"canvas-fit@1.0.0","_shasum":"7f73c47954f63cbe63d99c7339f4e57394432034","_from":".","_npmVersion":"1.4.13","_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"dist":{"shasum":"7f73c47954f63cbe63d99c7339f4e57394432034","tarball":"https://registry.npmjs.org/canvas-fit/-/canvas-fit-1.0.0.tgz","integrity":"sha512-n1XNrHEso0gsuzI8VNg/hOHC3fnANZEZLGh3S9iDLLb1sKriBfFoDcS75V13rr7nLUmFpJjmKxfWN59okr9x5w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD+CGWHE+8iKSM8kvgaDEBFlqyLaF3joYvVZyiKIQaV3gIgM82nl0tCzqaU+TDqTGg5+hES3FnVDN9EviSVYew98CA="}]}},"1.1.0":{"name":"canvas-fit","version":"1.1.0","description":"Small module for fitting a canvas element within the bounds of its parent.","main":"index.js","scripts":{"test":"beefy test.js --open"},"repository":{"type":"git","url":"git://github.com/hughsk/canvas-fit.git"},"author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com","url":"http://hughsk.io/"},"license":"MIT","bugs":{"url":"https://github.com/hughsk/canvas-fit/issues"},"homepage":"https://github.com/hughsk/canvas-fit","dependencies":{"element-size":"^1.0.0"},"devDependencies":{"beefy":"^1.1.0","raf":"^0.1.3"},"keywords":["canvas","fit","screen","window","browser","stretch","resize"],"gitHead":"683cb384ae4fd5da3b6fdecf58b650269e1d5ecf","_id":"canvas-fit@1.1.0","_shasum":"d559654a90038b9e3bfa44ca946ea69d09ba3f55","_from":".","_npmVersion":"1.5.0-alpha-4","_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"dist":{"shasum":"d559654a90038b9e3bfa44ca946ea69d09ba3f55","tarball":"https://registry.npmjs.org/canvas-fit/-/canvas-fit-1.1.0.tgz","integrity":"sha512-uddPt+G4aO1dXcrPHRabkIQO29cK3N8/9ggz7s+ctMYx2iFPgPtHwmKBAmXqRbBQhMH03JoQ+45+eXOqu4Kl5g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA+L9A8M94XnY2EJ4EUUrU3E+FtNF2fDGqlXgRW86JvzAiEAvO6lxjE7WJ4JWVBTtx8g8P2RVDtmClZkARzDetw4Y3s="}]}},"1.1.1":{"name":"canvas-fit","version":"1.1.1","description":"Small module for fitting a canvas element within the bounds of its parent.","main":"index.js","scripts":{"test":"beefy test.js --open"},"repository":{"type":"git","url":"git://github.com/hughsk/canvas-fit.git"},"author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com","url":"http://hughsk.io/"},"license":"MIT","bugs":{"url":"https://github.com/hughsk/canvas-fit/issues"},"homepage":"https://github.com/hughsk/canvas-fit","dependencies":{"element-size":"^1.1.0"},"devDependencies":{"beefy":"^1.1.0","raf":"^0.1.3"},"keywords":["canvas","fit","screen","window","browser","stretch","resize"],"gitHead":"51ec2c94a984528167c33471c77ebe9136c68166","_id":"canvas-fit@1.1.1","_shasum":"16cdf3058872af221d96b93662ce754ea8a31eb7","_from":".","_npmVersion":"1.5.0-alpha-4","_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"dist":{"shasum":"16cdf3058872af221d96b93662ce754ea8a31eb7","tarball":"https://registry.npmjs.org/canvas-fit/-/canvas-fit-1.1.1.tgz","integrity":"sha512-l5mEqL9vvgQvKXW3wLyzgD9lLUEno0vR1bW+FHZdm5bAwSFq7uwze6VkEdvWabBHR8wZ1urcKRcYljRCuBX7xQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDmp/GiqfZPyzfgpvVd+o/SR1+k0wyrm1QircWy6EXIyAiAvIYT+yM2rBii+UobHLxJjkOF62QrMtk3DzWX/kK0Dsw=="}]}},"1.1.2":{"name":"canvas-fit","version":"1.1.2","description":"Small module for fitting a canvas element within the bounds of its parent.","main":"index.js","scripts":{"test":"beefy test.js --open"},"repository":{"type":"git","url":"git://github.com/hughsk/canvas-fit.git"},"author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com","url":"http://hughsk.io/"},"license":"MIT","bugs":{"url":"https://github.com/hughsk/canvas-fit/issues"},"homepage":"https://github.com/hughsk/canvas-fit","dependencies":{"element-size":"^1.1.0"},"devDependencies":{"beefy":"^1.1.0","raf":"^0.1.3"},"keywords":["canvas","fit","screen","window","browser","stretch","resize"],"gitHead":"fd5b9ede25f4e53e2f2765cdd6fb2767e41a4c52","_id":"canvas-fit@1.1.2","_shasum":"ba4c6aaec910edab92db568dad013f2f2d6e4ff0","_from":".","_npmVersion":"1.5.0-alpha-4","_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"dist":{"shasum":"ba4c6aaec910edab92db568dad013f2f2d6e4ff0","tarball":"https://registry.npmjs.org/canvas-fit/-/canvas-fit-1.1.2.tgz","integrity":"sha512-+fFODDlDDo5UgZShHZ2DmK8g01CbvUjzob5XvWcdd7gUlfD39Jeyy4OkqditMZW8SQT8kxfbFaCZdaMH5QA4ig==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAmrwVnNHVzrD3iWZBRxM21rh8oh7uzJ/IyvlNg/uwpjAiEAxy6Q28lZFh8tJj0BqZpkRBFDJVmwsmoiUSTX/o33JMg="}]}},"1.2.0":{"name":"canvas-fit","version":"1.2.0","description":"Small module for fitting a canvas element within the bounds of its parent.","main":"index.js","scripts":{"test":"beefy test.js --open"},"repository":{"type":"git","url":"git://github.com/hughsk/canvas-fit.git"},"author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com","url":"http://hughsk.io/"},"license":"MIT","bugs":{"url":"https://github.com/hughsk/canvas-fit/issues"},"homepage":"https://github.com/hughsk/canvas-fit","dependencies":{"element-size":"^1.1.1"},"devDependencies":{"beefy":"^1.1.0","raf":"^0.1.3"},"keywords":["canvas","fit","screen","window","browser","stretch","resize"],"gitHead":"ed6d53b24a194b298691ea53187d69d4d50f9d05","_id":"canvas-fit@1.2.0","_shasum":"cb873c10339fec735b609a9e140bf37c20528a1f","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"dist":{"shasum":"cb873c10339fec735b609a9e140bf37c20528a1f","tarball":"https://registry.npmjs.org/canvas-fit/-/canvas-fit-1.2.0.tgz","integrity":"sha512-gEZLVRi9dWfJnSIUN4iuJqd7GW9kxiWYWJbGUTFhLXxq224HoQNB47VJ8Etk++N30e7O8bQRs8uRpdVV7bP+1Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDSmjZCo0M1wU6PYby87OuV2mDuuyd64yFxcHbjDxS+oAIhAKpnzsl+jA7t8uuwq+AtkYqJOhTtIpeT8BQCbVzUyVlA"}]}},"1.3.0":{"name":"canvas-fit","version":"1.3.0","description":"Small module for fitting a canvas element within the bounds of its parent.","main":"index.js","scripts":{"test":"beefy test.js --open"},"repository":{"type":"git","url":"git://github.com/hughsk/canvas-fit.git"},"author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com","url":"http://hughsk.io/"},"license":"MIT","bugs":{"url":"https://github.com/hughsk/canvas-fit/issues"},"homepage":"https://github.com/hughsk/canvas-fit","dependencies":{"element-size":"^1.1.1"},"devDependencies":{"beefy":"^1.1.0","raf":"^0.1.3"},"keywords":["canvas","fit","screen","window","browser","stretch","resize"],"gitHead":"b3184f50b6281a175be884fe9de3e7c247d540a4","_id":"canvas-fit@1.3.0","_shasum":"18160020c569653a48c5b93903f6bf2a4ffe31a3","_from":".","_npmVersion":"2.5.0","_nodeVersion":"0.10.36","_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"dist":{"shasum":"18160020c569653a48c5b93903f6bf2a4ffe31a3","tarball":"https://registry.npmjs.org/canvas-fit/-/canvas-fit-1.3.0.tgz","integrity":"sha512-tyAH9ECVk80EVQ1u+A7LwlzhXSfO1wLhhGyevikUQavQyksysiyCNMkWQkXeMkKpcsaqCmHyBJdbXC7mfVvWXg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFgp7hmkCQTndlIX6jG9dAOAIPH5jWYJb4gjE13M88iYAiEA5IkHQFUAyFuAlZKoW+L7Y708XbLwoJ/gEQntL3tojQk="}]}},"1.4.0":{"name":"canvas-fit","version":"1.4.0","description":"Small module for fitting a canvas element within the bounds of its parent.","main":"index.js","scripts":{"test":"beefy test.js --open"},"repository":{"type":"git","url":"git://github.com/hughsk/canvas-fit.git"},"author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com","url":"http://hughsk.io/"},"license":"MIT","bugs":{"url":"https://github.com/hughsk/canvas-fit/issues"},"homepage":"https://github.com/hughsk/canvas-fit","dependencies":{"element-size":"^1.1.1"},"devDependencies":{"beefy":"^1.1.0","raf":"^0.1.3"},"keywords":["canvas","fit","screen","window","browser","stretch","resize"],"gitHead":"15557a19c292a0b4b15ae6369a4ed75437f5e626","_id":"canvas-fit@1.4.0","_shasum":"409db29984c5f49cb9b89fd1f34f9fc04fea4487","_from":".","_npmVersion":"2.7.5","_nodeVersion":"0.10.36","_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"dist":{"shasum":"409db29984c5f49cb9b89fd1f34f9fc04fea4487","tarball":"https://registry.npmjs.org/canvas-fit/-/canvas-fit-1.4.0.tgz","integrity":"sha512-7ITUHp9kN0yDxTpTLLL5q+UmKLNb8pSqcuGWt/BlQGRjpZdzchFIjSbxwZFSmxVAVpTL22qmWpEWEkJxjH7fMA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGMCu1HoNXFpKgi0oBiL18uKlgafLfigr/L/WQHX6ABoAiEAlgh/GejyuJObOPEt8pBW4htJOlZx1BXu5cm/iqcZP2o="}]}},"1.5.0":{"name":"canvas-fit","version":"1.5.0","description":"Small module for fitting a canvas element within the bounds of its parent.","main":"index.js","scripts":{"test":"beefy test.js --open"},"repository":{"type":"git","url":"git://github.com/hughsk/canvas-fit.git"},"author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com","url":"http://hughsk.io/"},"license":"MIT","bugs":{"url":"https://github.com/hughsk/canvas-fit/issues"},"homepage":"https://github.com/hughsk/canvas-fit","dependencies":{"element-size":"^1.1.1"},"devDependencies":{"beefy":"^1.1.0","raf":"^0.1.3"},"keywords":["canvas","fit","screen","window","browser","stretch","resize"],"gitHead":"55ba4fa0261168779b8e2c0e7d177f22688adbb3","_id":"canvas-fit@1.5.0","_shasum":"ae13be66ade42f5be0e487e345fce30a5e5b5e5f","_from":".","_npmVersion":"2.12.1","_nodeVersion":"2.3.4-nightly20150820b1aa3f0247","_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"dist":{"shasum":"ae13be66ade42f5be0e487e345fce30a5e5b5e5f","tarball":"https://registry.npmjs.org/canvas-fit/-/canvas-fit-1.5.0.tgz","integrity":"sha512-onIcjRpz69/Hx5bB5HGbYKUF2uC6QT6Gp+pfpGm3A7mPfcluSLV5v4Zu+oflDUwLdUw0rLIBhUbi0v8hM4FJQQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCrlZyVBo4XihuLZHHvbCaUU71UASkmOuG3E7PEpuPAmgIhALK/riHE3ErqFOr8kqtjRYKR8CVJ7zH+l7q2qnSAMosy"}]},"maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}]}},"readme":"# canvas-fit [![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)\n\nSmall module for fitting a canvas element within the bounds of its parent.\nUseful, for example, for making a canvas fill the screen. Works with SVG\nelements too!\n\n## Usage\n\n[![NPM](https://nodei.co/npm/canvas-fit.png)](https://nodei.co/npm/canvas-fit/)\n\n### resize = fit(canvas[, parent[, scale]])\n\nCreates a `resize` function for your `canvas` element. Calling this function\nwill resize the canvas to fit its parent element.\n\nHere's a simple example to make your canvas update its dimensions when\nresizing the window:\n\n``` javascript\nvar fit = require('canvas-fit')\nvar canvas = document.createElement('canvas')\n\nwindow.addEventListener('resize', fit(canvas), false)\n```\n\nYou might want to override the `parent` element that the canvas should be\nfitting within: in which case, pass that element in as your second argument:\n\n``` javascript\nwindow.addEventListener('resize'\n  , fit(canvas, window)\n  , false\n)\n```\n\nYou can also set the scale of the canvas element relative to its styled size\non the page using the `scale` argument – for example, passing in\n`window.devicePixelRatio` here will scale the canvas resolution up on retina\ndisplays.\n\n\n### `resize.scale = <Number>`\n\nDynamically change the canvas' target `scale`. Note that you still need to\nmanually trigger a resize after doing this.\n\n\n### `resize.parent = <DOMElement>`\n\nDynamically change the canvas' `parent` element. Note that you still need\nto manually trigger a resize after doing this.\n\n### `resize.parent = () => [width, height]`\n\nInstead of filling a given element, explicitly set the width and height\nof the canvas. Note that this value will still be scaled up according\nto `resize.scale`\n\n``` javascript\nresize.parent = function() {\n  return [ window.innerWidth - 300, window.innerHeight ]\n}\n```\n\n## License\n\nMIT. See [LICENSE.md](http://github.com/hughsk/canvas-fit/blob/master/LICENSE.md) for details.\n","maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"time":{"modified":"2022-06-13T05:34:06.745Z","created":"2014-05-13T21:49:00.022Z","0.0.0":"2014-05-13T21:49:00.022Z","1.0.0":"2014-07-07T06:31:57.555Z","1.1.0":"2014-08-02T19:50:34.664Z","1.1.1":"2014-08-02T19:53:54.588Z","1.1.2":"2014-08-02T19:55:42.858Z","1.2.0":"2014-08-20T09:10:30.080Z","1.3.0":"2015-04-02T19:42:33.892Z","1.4.0":"2015-04-14T22:11:02.912Z","1.5.0":"2015-08-27T23:17:51.421Z"},"homepage":"https://github.com/hughsk/canvas-fit","keywords":["canvas","fit","screen","window","browser","stretch","resize"],"repository":{"type":"git","url":"git://github.com/hughsk/canvas-fit.git"},"author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com","url":"http://hughsk.io/"},"bugs":{"url":"https://github.com/hughsk/canvas-fit/issues"},"license":"MIT","readmeFilename":"README.md"}