drinkspiller / SimpleSketch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SimpleSketch

A standalone Angular component for simple canvas sketching using the Angular Material library. Try the demo.

Prerequisites

Node and npm

Installation and Usage

  1. Install:
npm install simple-sketch
  1. Import into your component's .ts file:
/* ----------------------------------------------------------
 * my-component.ts
 * ----------------------------------------------------------*/
import {Component} from '@angular/core';
import {SimpleSketchCanvasComponent} from 'simple-sketch';

@Component({
  selector: 'app-my-component',
  templateUrl: 'my-component.html',
})
export class MyComponent {}
  1. Import SimpleSketch's styles into your global stylesheet: (e.g. styles.scss)
/* ----------------------------------------------------------
 * styles.scss
 * ----------------------------------------------------------*/
@import '../node_modules/simple-sketch/assets/styles.css';
  1. Use the simple sketch component in your component's template:
<!----------------------------------------------------------
 * my-component.html
 * ---------------------------------------------------------->
<simple-sketch-canvas
  backgroundColor="#000000"
  paintColor="#ffffff"
  [showToolbar]="true"
>
</simple-sketch-canvas>

Run the Demo App

Run ng serve, then navigate to http://localhost:4200/. The application will automatically reload if you change any of the source files.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory.

About


Languages

Language:TypeScript 66.2%Language:SCSS 23.4%Language:HTML 10.2%Language:JavaScript 0.2%