1.1.15 • Published 5 years ago

free-draw v1.1.15

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

English | 简体中文

Free-Draw

Progress Build Status npm npm npm

Free draw with canvas! Rectangle, circle, ellipse and polygon. Support zoom and offset!

Installation

Using npm:

$ npm i -g npm
$ npm i free-draw

Usage

HTML:

<canvas id="canvas" width="800" height="600"></canvas>

JS:

<script>
import FreeDraw from 'free-draw'

const freeDraw = new FreeDraw({ canvas: document.getElementById('canvas') })
const rect = freeDraw.addShape({ id: 'rect-1', type: 'rect', startPoint: [50, 50], width: 100, height: 200 });

</script>

API Document

Class - FreeDraw(options)

  • options {Object}:

    • canvas: DOM Element required
    • eventsCallBack: {Function} Events hook function
    • eventsReceive: {Array} <mouseenter|mouseleave|mousemove|keydown|drag>
  • Returns: FreeDraw {Object}

  • Usage:

const freeDraw = new FreeDraw({ canvas: document.getElementById('canvas') })

Object - freeDraw

  • Attributes
    • canvas: DOM Element required
    • eventsCallBack: {Function} Events hook function
    • eventsReceive: {Array} <mouseenter|mouseleave|mousemove|keydown|drag>
    • model: {String} Current model <view|edit>
    • editingId: {String} Current editing shape id
    • shapeInCanvas: {Object} Shapes in cavas
1.1.15

5 years ago

1.1.14

5 years ago

1.1.13

5 years ago

1.1.12

5 years ago

1.1.11

5 years ago

1.1.10

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.29

5 years ago

1.0.28

5 years ago

1.0.27

5 years ago

1.0.26

5 years ago

1.0.25

5 years ago

1.0.24

5 years ago

1.0.23

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago