0.5.50 • Published 1 year ago

@hasma/react-drawing-board v0.5.50

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

React Drawing board

Browser drawing board created with canvas and React.

Preview

preview

Features

A browser-ready efficient drawing board.

  • Support for drawing strokes, shapes, texts and images.
  • Built-in support for both redo and clear.
  • Easily zoom or pan the board content.
  • Ability to save screenshot.
  • Ability to be used as a Pictionary board for long distance communication.
  • Working for mobile users.

Installation

In NPM

React Drawing board uses a CMD so you can use it in NPM as well. npm install this package and

const DrawingBoard = require('react-drawing-board');

Basic Use

Basic

<DrawingBoard />

As A Pictionary

const Demo: React.FC = () => {
  const [operations, setOperations] = useState<Operation[]>([]);

  return (
    <DrawingBoard
      userId="user1" // identify for different players.
      operations={operations}
      onChange={(newOperation, afterOperation) => {
        console.log(`TODO: send ${newOperation}`);
        setOperations(afterOperation);
      }}
    />
  )
}

Props

PropsDescriptionTypeDefault
userId(optional)identify for operation sourcestringuuid.v4()
locale(optional)'en-US', 'zh-CN', 'tr-TR'stringnavigator.language
operations(optional)operations on drawing boardOperation[]undefined
onChange(optional)called when user draw some operations(newOperaton: Operation, operationsAfter: Operation[]) => voidundefined
onSave(image)called when user click save button for saving current view(image: { canvas: HTMLCanvasElement, dataUrl: string }) => voidundefined
style(optional)element styleCSSPropertiesundefined
className(optional)element classnamestringundefined
toolbarPlacement(optional)the position of toolbar'top' or 'left' or 'right''top'
viewMatrix(optional)control the current perspectiveundefined
onViewMatrixChange(optional)(viewMatrix: ViewMatrix) => voidundefined
0.5.50

1 year ago

0.5.49

1 year ago

0.5.47

1 year ago

0.5.48

1 year ago

0.5.46

1 year ago

0.5.44

1 year ago

0.5.45

1 year ago

0.5.43

1 year ago

0.5.42

1 year ago

0.5.41

1 year ago

0.5.40

1 year ago

0.5.39

1 year ago

0.5.38

1 year ago

0.5.37

1 year ago

0.5.36

1 year ago

0.5.35

1 year ago

0.5.34

1 year ago

0.5.33

1 year ago

0.5.32

1 year ago

0.5.31

1 year ago

0.5.30

1 year ago

0.5.29

1 year ago

0.5.28

1 year ago

0.5.27

1 year ago

0.5.26

1 year ago

0.5.24

1 year ago

0.5.23

1 year ago

0.5.22

1 year ago

0.5.21

1 year ago

0.5.2

1 year ago

0.5.1

1 year ago

0.5.0-beta.5.1

1 year ago

0.5.0-beta.5

1 year ago

0.5.0-beta.4

1 year ago

0.5.0-beta.1.1

1 year ago

0.5.0-beta.1

1 year ago

0.3.6

1 year ago