National Poetry Month

    @okiba/pointer

    1.0.7 • Public • Published

    Okiba / Pointer

    A wrapper class that collects normalized (both mouse and touch) pointer information

    import Pointer from '@okiba/pointer'
    import { MyCanvasApp } from '../path/to/my/components'
    
    window.requestAnimationFrame(() => {
     MyCanvasApp.update(Pointer.coords, Pointer.target)
    })

    Installation

    npm i --save @okiba/pointer

    Or import it directly in the browser

    <script type="module" src="https://unpkg.com/@okiba/pointer/index.js"></script>

    Usage

    import Pointer from '@okiba/pointer'

    Untranspiled code 🛑

    Okiba UI packages are not transpiled, so don't forget to transpile them with your favourite bundler. For example, using Babel with Webpack, you should prevent imports from okiba to be excluded from transpilation, like follows:

    {
      test: /\.js$/,
      exclude: /node_modules\/(?!(@okiba)\/).*/,
      use: {
        loader: 'babel-loader',
        options: {
          presets: ['@babel/preset-env']
        }
      }
    }

    coords()

    Coords getter

    Returns

    Object {x, y}

    target()

    Last event target getter

    Returns

    Event

    inview()

    Returns pointer inview status

    Returns

    Boolean

    lastEvent()

    Last event getter

    Returns

    Event

    matches(selectors, testAncestors)

    Checks if last event target matches with given selectors

    Arguments

    + selectors: Array.<String>

    The selectors list

    + testAncestors: Boolean

    If true, extends match test upward in the ancestors

    Returns

    String

    Keywords

    none

    Install

    npm i @okiba/pointer

    DownloadsWeekly Downloads

    15

    Version

    1.0.7

    License

    MIT

    Unpacked Size

    239 kB

    Total Files

    8

    Last publish

    Collaborators

    • fiad
    • ghzmdr
    • lavolpecheprogramma