# pointer-cursor

> synthesized mouse cursor

Latest version **0.0.3** (published 2013-03-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install pointer-cursor
pnpm add pointer-cursor
yarn add pointer-cursor
bun add pointer-cursor
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2013-03-12 |
| First published | 2013-03-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Chris Dickinson |
| Maintainers | chrisdickinson |
| Keywords | pointer-lock, pointer, cursor, browser |

## Links

- npm: https://www.npmjs.com/package/pointer-cursor
- Repository: https://github.com/chrisdickinson/pointer-cursor
- npm.io page: https://npm.io/package/pointer-cursor

## Dependencies (5)

- [global](https://npm.io/package/global.md) ~2.0.1
- [through](https://npm.io/package/through.md) ~2.2.1
- [debounce](https://npm.io/package/debounce.md) 0.0.1
- [ancestors](https://npm.io/package/ancestors.md) 0.0.3
- [synthetic-dom-events](https://npm.io/package/synthetic-dom-events.md) 0.0.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2013-03-12
- 0.0.2 — 2013-03-05
- 0.0.1 — 2013-03-05

## README

# pointer-cursor

for when you've got a fullscreen game, but you want a cursor.

```javascript
var interact = require('interact')
  , cursor = require('./index')
  , element

var pointer = interact(document.body)
  , current

pointer.on('attain', function(movements) {
  var to = current = cursor(element, true)
  element = to.element
  movements.pipe(to)
})

document.body.onclick = function(ev) {
  if(current) {
    current.click(ev.button)
  }
}
```

## api

#### cursor([element][, constrainToWindow][, dispatchHover]) -> writable stream

creates a cursor element if none is given, and returns it as a writable
stream suitable for piping `interact` movement streams into.

if `constrainToWindow` isn't given, it defaults to `true`; the cursor will
not be able to leave the window.

if `dispatchHover` isn't given, it defaults to `false`; enabling it will
dispatch `mouseover` and `mouseout` events to the elements hovered. note that
this is experimental and slow. 

#### stream.click([button=0])

dispatch a click event to the currently hovered element.

#### stream.element

the element representing the cursor.

#### stream.target() -> element or null

the element currently hovered.

#### stream.constrain(shouldConstrain=true) -> Boolean

set whether or not to constrain mouse movements. if setting to `true`, will recalculate
window size and re-constrain the existing cursor.

## license

MIT

---
_Source: https://npm.io/package/pointer-cursor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
