1.1.11 • Published 3 years ago

screenshot-editor-test v1.1.11

Weekly downloads
40
License
MIT
Repository
-
Last release
3 years ago

NPM JavaScript Style Guide

Install

npm install --save screenshot-editor-test

Usage

import React, { Component } from "react";

import Editor from "screenshot-editor-test";

class Example extends Component {
  render() {
    return (
      <Editor
        imgSrc="https://i.imgur.com/aZO5Kol.jpeg"
        onDrawingEnd={this.onDrawingEnd}
        lineWidth={5}
      />
    );
  }
}

Properties

NameTypeDefaultDescription
imgSrcstring A string representing the source to screenshot . ( Required )
onDrawingEndfunction A mouseup listner on the image returns the updated image on every mouseup.( Required )
lineWidthNumber5A Number representing the line width of drawing
configsArray[]An array representing the editor controls. and it must follow the ###config structure

configs structure

NameTypeDefaultDescription
rolestring A string representing the role, should be from the list of rect,line,circle,pencil,text,undo,eraser,color . ( Required )
iconimage Imported icon, it will be rendered as an image in lib .( Required )
colorsarray[]An array for adding extra color in the color list.( Required )

role

roleoperation
rectIt will add a function for drawing rectangle
lineIt will add a function for drawing line
circleIt will add a function for drawing circle
pencilIt will add a function for drawing pencil
colorIt will add a function for selecting the color
textIt will add a function for adding text
undoIt will add a function for undo
eraserIt will add a function for eraser

Example configs prop

const configData = [
  {
    icon: undoIcon,
    role: "undo"
  },
  {
    role: "rect",
    icon: squareIcon
  },
  {
    role: "line",
    icon: moveIcon
  },
  {
    role: "circle",
    icon: elipseIcon
  },
  {
    role: "color",
    icon: bucketIcon,
    extraColors: ["#ff0000", "#ff3333"]
  },
  {
    role: "pencil",
    icon: pencilIcon
  },
  {
    icon: textIcon,
    role: "text"
  },
  {
    icon: eraserIcon,
    role: "eraser"
  }
]; 

with configs props

import React from "react";

import Editor from "screenshot-editor-test";

const Example = () =>  {

    return (
      <Editor
        imgSrc="https://i.imgur.com/aZO5Kol.jpeg"
        onDrawingEnd={this.onDrawingEnd}
        lineWidth={5}
        configs={configData}
      />
    );
}

License

MIT © errorr404

1.1.11

3 years ago

1.1.10

3 years ago

1.1.9

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago