Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hasma/react-drawing-board

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hasma/react-drawing-board

Browser drawing board created with canvas and React.

  • 0.5.24
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
233
decreased by-2.92%
Maintainers
1
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 02 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc