GithubHelp home page GithubHelp logo

wowvain-dev / react-drawing-board Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dilidili/react-drawing-board

0.0 0.0 1.0 115 KB

Fork for adding ro_RO locale.

Home Page: https://react-drawing-board-demo.dilidili.now.sh

License: MIT License

JavaScript 0.24% TypeScript 90.59% EJS 0.25% Less 8.92%

react-drawing-board's Introduction

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

Props Description Type Default
userId(optional) identify for operation source string uuid.v4()
locale(optional) 'en-US', 'zh-CN', 'tr-TR' string navigator.language
operations(optional) operations on drawing board Operation[] undefined
onChange(optional) called when user draw some operations (newOperaton: Operation, operationsAfter: Operation[]) => void undefined
onSave(image) called when user click save button for saving current view (image: { canvas: HTMLCanvasElement, dataUrl: string }) => void undefined
style(optional) element style CSSProperties undefined
className(optional) element classname string undefined
toolbarPlacement(optional) the position of toolbar 'top' or 'left' or 'right' 'top'
viewMatrix(optional) control the current perspective undefined
onViewMatrixChange(optional) (viewMatrix: ViewMatrix) => void undefined

react-drawing-board's People

Contributors

marcosalles avatar wowvain-dev avatar ahmetozalp avatar gabrielguilhoto avatar leftstick avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.