resize-cursors
v1.0.0
Published
Get a resize cursor given top/bottom/left/right state
Downloads
2
Readme
resize-cursors
Get a CSS cursor style given top/bottom/left/right cursor positional state relative to a DOM element.
Installation
Install using npm:
$ npm install resize-cursors
Usage
resize-cursors takes cursor positional state relative to a DOM node and
returns a CSS cursor style that makes sense for that state. States that don't
imply a resize (i.e., false for all edges), as well as states that don't make
much sense (e.g., true for three or more edges) return undefined
.
var resizeStyle = require('resize-cursors');
console.log(resizeStyle({})); // => undefined
console.log(resizeStyle({ top: true })); // => "ns-resize"
console.log(resizeStyle({ left: true })); // => "ew-resize"
console.log(resizeStyle({ bottom: true, right: true })); // => "nwse-resize"
console.log(resizeStyle({ top: true, bottom: true, left: true }));
// => undefined
Changelog
1.0.0
- Initial release
License
MIT