UNPKG

@cogic/annotorious

Version:

A JavaScript image annotation library

75 lines (67 loc) 1.78 kB
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Annotorious | Custom Style</title> <link href="https://fonts.googleapis.com/css?family=Lato&display=swap" rel="stylesheet"> <link href="custom-style.css" rel="stylesheet"> <link href="/annotorious.min.css" rel="stylesheet"> <script type="text/javascript" src="/annotorious.min.js"></script></head> <style> html, body { padding:20px; margin:0px; font-family:'Lato', sans-serif; } #content { width:100%; } h1 { font-size:21px; font-weight:normal; margin:0; padding:0; } p.instructions { padding:10px 0; } img { max-width:100%; } p.caption { font-family:Arial, Helvetica, sans-serif; color:#8f8f8f; } p.caption a { color:#3f3f3f; } </style> </head> <body> <div id="content"> <p> <button id="current-tool">RECTANGLE</button> </p> <img id="hallstatt" src="/640px-Hallstatt.jpg"> </div> </div> <script> (function() { var anno = Annotorious.init({ image: 'hallstatt', locale: 'auto' }); var toolToggle = document.getElementById('current-tool'); toolToggle.addEventListener('click', function() { if (toolToggle.innerHTML == 'RECTANGLE') { toolToggle.innerHTML = 'POLYGON'; anno.setDrawingTool('polygon'); } else { toolToggle.innerHTML = 'RECTANGLE'; anno.setDrawingTool('rect'); } }); })() </script> </body> </html>