All Projects → Kunduin → react-picture-annotation

Kunduin / react-picture-annotation

Licence: MIT license
A simple annotation component.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to react-picture-annotation

rxjs-ninja
RxJS Operators for handling Observable strings, numbers, booleans and more
Stars: ✭ 68 (+28.3%)
Mutual labels:  javascript-library, typescript-library
sqlweb
SqlWeb is an extension of JsStore which allows to use sql query for performing database operation in IndexedDB.
Stars: ✭ 38 (-28.3%)
Mutual labels:  javascript-library, typescript-library
safe-touch
⛓ Runtime optional chaining for JS
Stars: ✭ 71 (+33.96%)
Mutual labels:  javascript-library, typescript-library
validate-polish
Utility library for validation of PESEL, NIP, REGON, identity card etc. Aimed mostly at Polish enviroment. [Polish] Walidacja numerów pesel, nip, regon, dowodu osobistego.
Stars: ✭ 31 (-41.51%)
Mutual labels:  javascript-library, typescript-library
Gojs
JavaScript diagramming library for interactive flowcharts, org charts, design tools, planning tools, visual languages.
Stars: ✭ 5,739 (+10728.3%)
Mutual labels:  javascript-library, typescript-library
imtool
🖼️ Client-side canvas-based image manipulation library.
Stars: ✭ 38 (-28.3%)
Mutual labels:  javascript-library, typescript-library
necktie
Necktie – a simple DOM binding tool
Stars: ✭ 43 (-18.87%)
Mutual labels:  javascript-library, typescript-library
constant-time-js
Constant-time JavaScript functions
Stars: ✭ 43 (-18.87%)
Mutual labels:  javascript-library, typescript-library
animusjs
🎆 AnimusJS is the solution for combine JS and CSS animations.
Stars: ✭ 42 (-20.75%)
Mutual labels:  javascript-library
blaver
A JavaScript library built on top of the Faker.JS library. It generates massive amounts of fake data in the browser and node.js.
Stars: ✭ 112 (+111.32%)
Mutual labels:  javascript-library
puddle.js
An ASCII/Node based fluid simulation library.
Stars: ✭ 102 (+92.45%)
Mutual labels:  javascript-library
html-chain
🔗 A super small javascript library to make html by chaining javascript functions
Stars: ✭ 32 (-39.62%)
Mutual labels:  javascript-library
web-verse
Toolbox for deep, resilient, markup-invariant linking into HTML documents without their cooperation
Stars: ✭ 25 (-52.83%)
Mutual labels:  annotation
AnnotationProcessorStarter
Project to set up basics of a Java annotation processor
Stars: ✭ 19 (-64.15%)
Mutual labels:  annotation
jsonrpc-ts
A very flexible library for building JSON-RPC 2.0 endpoints
Stars: ✭ 19 (-64.15%)
Mutual labels:  typescript-library
Amino.JS
A powerful JavaScript library for interacting with the Amino API 🌟
Stars: ✭ 25 (-52.83%)
Mutual labels:  javascript-library
compile-command-annotations
Annotation hints for the Hotspot JVM JIT compiler.
Stars: ✭ 38 (-28.3%)
Mutual labels:  annotation
ImagerJs
A JavaScript library for uploading images using drag & drop. Crop, rotate, resize, or shrink your image before uploading.
Stars: ✭ 101 (+90.57%)
Mutual labels:  javascript-library
harsh
Hashids implementation in Rust
Stars: ✭ 48 (-9.43%)
Mutual labels:  javascript-library
prime.js
Prime JS is a different kind of JavaScript framework. Prime is written in 100% standard, explicit, and namespaced Object Oriented JavaScript.
Stars: ✭ 13 (-75.47%)
Mutual labels:  javascript-library

React Picture Annotation

GitHub license Travis (.com) npm

A simple annotation component.

rect

Install

# npm
npm install react-picture-annotation

# yarn
yarn add react-picture-annotation

Basic Example

Edit react-picture-annotation-example

const App = () => {
  const [pageSize, setPageSize] = useState({
    width: window.innerWidth,
    height: window.innerHeight
  });
  const onResize = () => {
    setPageSize({ width: window.innerWidth, height: window.innerHeight });
  };

  useEffect(() => {
    window.addEventListener('resize', onResize);
    return () => window.removeEventListener('resize', onResize);
  }, []);

  const onSelect = selectedId => console.log(selectedId);
  const onChange = data => console.log(data);

  return (
    <div className="App">
      <ReactPictureAnnotation
        image="https://source.unsplash.com/random/800x600"
        onSelect={onSelect}
        onChange={onChange}
        width={pageSize.width}
        height={pageSize.height}
      />
    </div>
  );
};

const rootElement = document.getElementById('root');
ReactDOM.render(<App />, rootElement);

ReactPictureAnnotation Props

Name Type Comment required
onChange (annotationData: IAnnotation[]) => void Called every time the shape changes.
onSelected (id: string or null) => void Called each time the selection is changed.
width number Width of the canvas.
height number Height of the canvas.
image string Image to be annotated.
inputElement (value: string,onChange: (value: string) => void,onDelete: () => void) => React.ReactElement; Customizable input control. X
annotationData Array<IAnnotation> Control the marked areas on the page. X
annotationStyle IShapeStyle Control the mark style X
selectedId string or null Selected markId X
scrollSpeed number Speed of wheel zoom, default 0.0005 X
marginWithInput number Margin between input and mark, default 1 X
defaultAnnotationSize number[] Size for annotations created by clicking. X

IShapeStyle

ReactPictureAnnotation can be easily modified the style through a prop named annotationStyle

export const defaultShapeStyle: IShapeStyle = {
  /** text area **/
  padding: 5, // text padding
  fontSize: 12, // text font size
  fontColor: "#212529", // text font color
  fontBackground: "#f8f9fa", // text background color
  fontFamily:
    "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', Helvetica, Arial, sans-serif",
  
  /** stroke style **/
  lineWidth: 2, // stroke width
  shapeBackground: "hsla(210, 16%, 93%, 0.2)", // background color in the middle of the marker
  shapeStrokeStyle: "#f8f9fa", // shape stroke color
  shadowBlur: 10, // stroke shadow blur
  shapeShadowStyle: "hsla(210, 9%, 31%, 0.35)", // shape shadow color
  
  /** transformer style **/
  transformerBackground: "#5c7cfa",
  transformerSize: 10
};

IAnnotation

{
  id:"to identify this shape",    // required,
  comment:"string type comment",  // not required
  mark:{
    type:"RECT",                  // now only support rect

    // The number of pixels in the upper left corner of the image
    x:0,
    y:0,

    // The size of tag
    width:0,
    height:0
  }
}

Licence

MIT License

How To Contribute

This repo uses semantic release. By running npm run commit and merging commits into master branch, travis will automatically trigger release.

Thanks all your great contributions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].