bianco.pointer
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

bianco.pointer

Build Status NPM version NPM downloads MIT License

Usage

import pointer from 'bianco.pointer'

// get the x and y position from any Mouse or Touch event
const { x, y } = pointer.position(touchEvent)

API

Table of Contents

position

Normalize the pointer events to get a single position of the pointer on the screen

Parameters

Examples

import { position } from 'bianco.pointer'
import { add } from 'bianco.events'


add(window, 'touchmove mousemove', function(event) {
  const { x, y } = position(event)

  console.log('Your pointer y is=', y, 'your pointer x is', x)
})

Returns Object position - pointer position on the screen

Returns number position.x - x condinates relative to the screen

Returns number position.y - y condinates relative to the screen

Readme

Keywords

Package Sidebar

Install

npm i bianco.pointer

Weekly Downloads

205

Version

1.1.0

License

MIT

Unpacked Size

6.14 kB

Total Files

6

Last publish

Collaborators

  • gianlucaguarini