@recogito/annotorious-better-polygon

0.2.0 • Public • Published

Annotorious Better Polygon

A better polygon selection tool for Annotorious. Compatible with both the Annotorious standard version and Annotorious for OpenSeadragon.

Demo video

Features

  • Close the polygon either by double clicking (or long tap), or re-selecting the first point
  • When approaching the first point, the mouse will snap to it to make selecting easier
  • Add points by clicking and dragging the line midpoint handles
  • Remove points by selecting them with a click and pressing the DEL key
  • Optionally start drawing by drag or single click

Installation

Better Polygon requires Annotorious version 2.5.9 or higher.

<html>
  <head>
    <!-- Import Annotorious first -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@recogito/annotorious@latest/dist/annotorious.min.css">
    <script src="https://cdn.jsdelivr.net/npm/@recogito/annotorious@latest/dist/annotorious.min.js"></script>

    <!-- Import the Better Polygon script -->
    <script src="https://cdn.jsdelivr.net/npm/@recogito/annotorious-better-polygon@latest/dist/annotorious-better-polygon.js"></script>
  </head>
  <body>
    <img id="hallstatt" src="640px-Hallstatt.jpg" />

    <script type="text/javascript">
      (function() {
        // Init Annotorious
        var anno = Annotorious.init({
          image: 'hallstatt'
        });

        // Init the plugin
        Annotorious.BetterPolygon(anno);
      })();
    </script>
  </body>
</html>

Or via npm:

$ npm i @recogito/annotorious-better-polygon

Import and initialize:

import BetterPolygon from '@recogito/annotorious-better-polygon';

//...

BetterPolygon(anno);

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.0
    53
    • latest

Version History

Package Sidebar

Install

npm i @recogito/annotorious-better-polygon

Weekly Downloads

58

Version

0.2.0

License

BSD-3-Clause

Unpacked Size

1.59 MB

Total Files

13

Last publish

Collaborators

  • aboutgeo