I'm trying to use the slector plugging with another plugging toolbar , the problem is when I select the rectangle or poly it work good , I draw it and then I can see the widget to confirm , but when I select the circle or the eclipse , I can't even see the widget if it the widget modified or if the formatter also modified and I got in the console this error :
`Uncaught TypeError: n.reduce is not a function
at _e (selector.js:1945:23)
at new u (selector.js:2373:15)
at a.createEditableShape (selector.js:2557:24)
at AnnotationLayer.js:436:48
at kS.emit (index.js:36:20)
at ToolsRegistry.js:57:46
at a.emit (selector.js:94:25)
at selector.js:2552:23
at i.mouseUp (selector.js:835:29)`
I thought there is a problem with my own formatter and my own widget , so I used a formatter from another plugin ShapeLapel , but still the same problem, here is the code :
<html>
<head>
<!-- Annotorious first -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@recogito/annotorious@latest/dist/annotorious.min.css">
</head>
<body>
<div id="my-toolbar-container"></div>
<img id="hallstatt" src="640px-Hallstatt.jpg">
<script src="https://cdn.jsdelivr.net/npm/@recogito/annotorious@latest/dist/annotorious.min.js"></script>
<script src="annotorious-shape-labels.min.js"></script>
<!-- Selector Pack plugin -->
<script src="https://cdn.jsdelivr.net/npm/@recogito/annotorious-toolbar@latest/dist/annotorious-toolbar.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@recogito/annotorious-selector-pack@latest/dist/annotorious-selector-pack.min.js"></script>
<script>
window.onload = function() {
// Init Annotorious
var anno = Annotorious.init({
image: 'hallstatt',
formatter: Annotorious.ShapeLabelsFormatter()
});
// Init the plugin
Annotorious.SelectorPack(anno);
Annotorious.Toolbar(anno, document.getElementById('my-toolbar-container'));
// [ 'rect', 'polygon', 'point', 'circle', 'ellipse', 'freehand' ]
console.log(anno.listDrawingTools());
}
</script>
</body>
</html>
I think I might have answered this over the Gitter support channel already. But for posterity:
Due to a bug in the current Annotorious release, the
formatter
field currently requires an array as value. Therefore, you need to change your init code to: