# Trigger 'mouseMove' and 'click' event while drawing an annotation

**URL:** <https://pdfjs.community/t/trigger-mousemove-and-click-event-while-drawing-an-annotation/93>\
**Category:** Technical Support\
**Created:** [June 26, 2020, 4:18am UTC](https://pdfjs.community/t/trigger-mousemove-and-click-event-while-drawing-an-annotation/93 "2020-06-26T04:18:05Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![zzhang](https://avatars.discourse-cdn.com/v4/letter/z/b9e5f3/32.png) [@zzhang](https://pdfjs.community/u/zzhang)\
**Post date:** [June 26, 2020, 7:00pm UTC](https://pdfjs.community/t/trigger-mousemove-and-click-event-while-drawing-an-annotation/93/2 "2020-06-26T19:00:30Z")

</div>

Hi,

It sounds like you are wanting to get the area of a polygon annotation when users are drawing it.

To do this, you can listen to the [mouseMove](https://pdfjs.express/api/CoreControls.DocumentViewer.html#event:mouseMove__anchor) event of **docViewer**. Then inside the event callback you can use [docViewer.getToolMode](https://pdfjs.express/api/CoreControls.DocumentViewer.html#getToolMode__anchor) to get the current tool. Once you have checked the current tool is the polygon tool, you can access the drawing annotation by `tool.annotation`. Now since you have the `annotation` object you can use [getPath](https://pdfjs.express/api/Annotations.PolygonAnnotation.html#getPath__anchor) and do calculations to get the area.

Best Regards,  
Zhijie Zhang

---

_[View the full topic](https://pdfjs.community/t/trigger-mousemove-and-click-event-while-drawing-an-annotation/93)._
