npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@o.krucheniuk/ngx-signature-pad

v0.0.7

Published

Angular 9 library for drawing smooth signatures, based on [signature_pad](https://www.npmjs.com/package/signature_pad).

Downloads

659

Readme

NgxSignaturePad

Angular 9 library for drawing smooth signatures, based on signature_pad.

Usage:

Install package

npm i @o.krucheniuk/ngx-signature-pad -D

Import NgxSignaturePadModule into app.module.ts

import {NgxSignaturePadModule} from '@o.krucheniuk/ngx-signature-pad'; imports: [ SharedModule, BrowserModule, NgxSignaturePadModule ],

Use component:

Add into app.component.html :

<ngx-signature-pad [config]="config" #testPad></ngx-signature-pad>

Add into app.component.ts:

@ViewChild('testPad', {static: true}) signaturePadElement: NgxSignaturePadComponent;

config: SignaturePadOptions = { minWidth: 1, maxWidth: 10, penColor: 'blue' };

Stackblitz example

https://stackblitz.com/edit/ngx-signature-pad

API

API is accessable via this.signaturePadElement

Returns signature image as data URL (see https://mdn.io/todataurl for the list of possible parameters)

toDataURL(); // save image as PNG toDataURL("image/jpeg"); // save image as JPEG toDataURL("image/svg+xml"); // save image as SVG

// Draws signature image from data URL. // NOTE: This method does not populate internal data structure that represents drawn signature. Thus, after using #fromDataURL, #toData won't work properly. fromDataURL("data:image/png;base64,iVBORw0K...");

// Returns signature image as an array of point groups toData();

// Draws signature image from an array of point groups fromData(data);

// Clears the canvas clear();

// Returns true if canvas is empty, otherwise returns false isEmpty();

// Unbinds all event handlers off();

// Rebinds all event handlers on();

// Force re-render of the signature canvas. Method also clears canvas forceUpdate(); Config options dotSize : (float or function) Radius of a single dot.

minWidth: (float) Minimum width of a line. Defaults to 0.5.

maxWidth: (float) Maximum width of a line. Defaults to 2.5.

throttle: (integer) Draw the next point at most once per every x milliseconds. Set it to 0 to turn off throttling. Defaults to 16.

minDistance: (integer) Add the next point only if the previous one is farther than x pixels. Defaults to 5.

backgroundColor: (string) Color used to clear the background. Can be any color format accepted by context.fillStyle. Defaults to "rgba(0,0,0,0)" (transparent black). Use a non-transparent color e.g. "rgb(255,255,255)" (opaque white) if you'd like to save signatures as JPEG images.

penColor: (string) Color used to draw the lines. Can be any color format accepted by context.fillStyle. Defaults to "black".

velocityFilterWeight: (float) Weight used to modify new velocity based on the previous velocity. Defaults to 0.7.

Notes:

Canvas used for drawing is responsive. To limit it size add static dimensions for parent element of ngx-signature-pad