@zimi/interact
TypeScript icon, indicating that this package has built-in type declarations

0.17.1 • Public • Published

@zimi/interact

用户交互(move / scale / rotate) 和 交互方式(mouse / touch)的抽象

install

yarn add @zimi/interact

examples

import { MouseFormatter, TouchFormatter } from '@zimi/interact'

// --- mouse ---

const mouseFormatter = new MouseFormatter()

mouseFormatter.attach(element)

mouseFormatter.addListener('move', (...args) => {
  // do sth
})
mouseFormatter.addListener('scale', (...args) => {
  // do sth
})
mouseFormatter.addListener('rotate', (...args) => {
  // do sth
})

// --- touch ---

const touchFormatter = new TouchFormatter()

touchFormatter.attach(element)

touchFormatter.addListener('move', (...args) => {
  // do sth
})
touchFormatter.addListener('scale', (...args) => {
  // do sth
})
touchFormatter.addListener('rotate', (...args) => {
  // do sth
})

Readme

Keywords

none

Package Sidebar

Install

npm i @zimi/interact

Weekly Downloads

3

Version

0.17.1

License

MIT

Unpacked Size

47.2 kB

Total Files

19

Last publish

Collaborators

  • xiaomingtang