Coder Social home page Coder Social logo

jacobqvist / ng-whiteboard Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mostafazke/ng-whiteboard

0.0 0.0 0.0 5.6 MB

Angular whiteboard component

Home Page: https://mostafazke.github.io/ng-whiteboard/

License: MIT License

JavaScript 7.51% TypeScript 61.47% HTML 16.23% SCSS 14.80%

ng-whiteboard's Introduction

Build Status License: MIT

ng-whiteboard

Lightweight angular whiteboard Demo

Features:

  • Supports touch.
  • Custom colors.
  • Custom background colors. Thanks to Nader Magdy
  • Custom background images.
  • Custom stroke size.
  • Save drawn as (svg | png | jpeg | base64) images.
  • Experimental (undo-redo).

And more to come...

Install

  1. Install npm module:

    npm install ng-whiteboard --save
  2. Add the module to your project

    import { NgWhiteboardModule } from 'ng-whiteboard';
    ...
    
    @NgModule({
        imports: [
            ...
            NgWhiteboardModule
        ]
        ...
    )}
  3. Insert the Whiteboard Component element in the html.

    <ng-whiteboard></ng-whiteboard>

Options

Input Type Default Required Description
[color] string #000000 no Set brush color
[backgroundColor] string #ffffff no Set whiteboard background color
[size] string 5px no Set brush size
[linejoin] string round no Define the shape of two lines when joined together ('miter' , 'round' , 'bevel' , 'miter-clip' , 'arcs')
[linecap] string round no Define start and end shape of line ('butt', 'square' , 'round')
[whiteboardOptions] WhiteboardOptions no Object of all inputs

Outputs

Name Description
(init) Fired on Component initialize
(save) Fired on Saving, "return base64"
(clear) Fired on clearing
(erase) Fired on Cleaning
(undo) Fired on undoing last draw
(redo) Fired on Repainting last draw

Methods

Name ARGS Defaults Description
save [format]: string, [name]: string [format]: 'base64', [name]: 'New board' Save current board
erase null null Clean the whiteboard
undo null null Undo last line
redo null null Repaint last line
addImage image: (string; ArrayBuffer) null add images to the board

to use these Methods inject NgWhiteboardService in your project

import { NgWhiteboardService, FormatType } from 'ng-whiteboard';
...

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
   styleUrls: ['./app.component.scss']
   ...
)}

  constructor(private whiteboardService: NgWhiteboardService) {
   this.whiteboardService.save(FormatType.Base64);
  }

Contributing

The project is open for contributors! Please file an issue or make a PR:)

ng-whiteboard's People

Contributors

mostafazke avatar semantic-release-bot avatar moustafa-in3 avatar dependabot[bot] avatar jacobqvist avatar lehran 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.