GithubHelp home page GithubHelp logo

atif-bashir-1998 / lasso-canvas-image Goto Github PK

View Code? Open in Web Editor NEW

This project forked from akcyp/lasso-canvas-image

0.0 0.0 0.0 280 KB

Lasso tool for HTML5 Image in Javascript

License: MIT License

JavaScript 100.00%

lasso-canvas-image's Introduction

lasso-canvas-image

Polygon selecting tool for HTML5 Image Element

View

Note

This package has been turned into a responsive react component and will no longer be supported.

Check out newest version!

Instalation

npm i lasso-canvas-image

Usage

// ES6 modules with Babel or TypeScript
import createLasso from 'lasso-canvas-image';

// CommonJS modules
const createLasso = require('lasso-canvas-image');

// Init
const lasso = createLasso({
  element: document.querySelector('img'),
  radius: 10,
  onChange (polygon) {
    console.log('Selection area changed: ' + polygon);
  },
  onUpdate (polygon) {
    console.log('Selection area updated: ' + polygon);
  }
});

// Methods
lasso.reset();
lasso.setPath('100,100 300,100 200,200');

lasso.disable();
lasso.enable();

Examples

Check out this example

Edit lass-canvas-image

Syntax

function createLasso ({
  element: HTMLImageElement,
  radius?: number,
  onChange?: (polygon: string) => void,
  onUpdate?: (polygon: string) => void,
  enabled?: boolean
})

Options

  • element DOM HTMLImageElement Instance
  • radius The radius of the circle's dots on the canvas
  • onChange Runs when the selected area is updated or points are moved by the user
  • onUpdate Runs when the selected area is updated
  • enabled defaults to true

lasso-canvas-image's People

Contributors

akcyp 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.