UNPKG

openseadragon-annotations

Version:
37 lines (32 loc) 688 B
const shapesFactory = { getPath(x, y) { return [ 'path', { fill: 'none', d: `M${x} ${y}`, stroke: 'red', 'stroke-width': 3, 'stroke-linejoin': 'round', 'stroke-linecap': 'round', 'vector-effect': 'non-scaling-stroke', }, ]; }, }; export default function press(x, y, Dispatcher, Store) { switch (Store.getMode()) { case 'DRAW': Dispatcher.dispatch({ type: 'ACTIVITY_UPDATE', inProgress: true, }); Dispatcher.dispatch({ type: 'ANNOTATIONS_CREATE', annotation: shapesFactory.getPath(x, y), }); break; default: break; } }