# Get the current mouse mode of mouse dragging

**URL:** <https://pdfjs.community/t/get-the-current-mouse-mode-of-mouse-dragging/3176>\
**Category:** Technical Support\
**Tags:** pdfjs-express\
**Created:** [March 11, 2024, 11:17am UTC](https://pdfjs.community/t/get-the-current-mouse-mode-of-mouse-dragging/3176 "2024-03-11T11:17:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris.jiang](https://avatars.discourse-cdn.com/v4/letter/c/ec9cab/32.png) [@chris.jiang](https://pdfjs.community/u/chris.jiang)\
**Post date:** [March 11, 2024, 11:17am UTC](https://pdfjs.community/t/get-the-current-mouse-mode-of-mouse-dragging/3176/1 "2024-03-11T11:17:37Z")

</div>

**Which product are you using?**  
PDF.js Express Viewer

**PDF.js Express Version**  
8.7.4

**Detailed description of issue**  
Is there any API we can call to get the current mode (pan/select) for mouse dragging?

**Expected behaviour**  
If we are currently in the select mode then the custom function in event will be triggered when clicking or moving the mouse on the page; if we are in the pan mode, the function will not be triggered, only moving the document  
 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/3/3c0af155833ada1941541ae85a2efe35f994fb41.png)

---

<div class="post-metadata">

**Author:** ![kkim](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@kkim](https://pdfjs.community/u/kkim)\
**Post date:** [March 11, 2024, 4:38pm UTC](https://pdfjs.community/t/get-the-current-mouse-mode-of-mouse-dragging/3176/3 "2024-03-11T16:38:50Z")

</div>

Hi there,

You can add an event listener to the Pan Tool:  
[https://pdfjs.express/api/Core.Tools.PanTool.html](https://pdfjs.express/api/Core.Tools.PanTool.html)

To get current tool, you can use the getToolMode API:  
[https://pdfjs.express/api/Core.DocumentViewer.html#getToolMode\_\_anchor](https://pdfjs.express/api/Core.DocumentViewer.html#getToolMode__anchor)

Best regards,  
Kevin Kim
