0.0.4 • Published 3 years ago

clip-flappers v0.0.4

Weekly downloads
4
License
MIT
Repository
github
Last release
3 years ago

Main License: MIT

clip-flappers

This is the component to clip a image without any frontend framework.

demo

https://miyanokomiya.github.io/clip-flappers/

usage

install

yarn add clip-flappers

mount

import { ClipFlappers, Rectangle, Size, clipImage } from 'clip-flappers'

const clipFlappers = new ClipFlappers('target', {
  viewSize: { width: 300, height: 200 },
  clipSize: { width: 100, height: 100 },
  onUpdateClip: async (base64: string, clipRect: Rectangle, size: Size) => {
    const clipped = await clipImage(base64, clipRect, size)
    console.log(clipped)
  },
})

// clipFlappers.dispose()

customize error messages

import { ClipFlappers, ErrorMessages } from 'clip-flappers'

new ClipFlappers('target', {
  errorMessages: ErrorMessages = {
    invalidImageFile: 'Invalid image file.',
  }
})

commnad

# install dependencies
$ yarn install

# start dev & demo server
$ yarn demo

# lint
$ yarn lint[:fix]

# test
$ yarn test [--watch]

# build
$ yarn build

publish

Update version in package.json, commit with a comment Release x.x.x and merge into the main branch.

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago