# Prevent update when mouse is down

**URL:** <https://community.plotly.com/t/prevent-update-when-mouse-is-down/33910>\
**Category:** Dash Python\
**Created:** [January 21, 2020, 10:47am UTC](https://community.plotly.com/t/prevent-update-when-mouse-is-down/33910 "2020-01-21T10:47:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dankal](https://avatars.discourse-cdn.com/v4/letter/d/a9adbd/32.png) [@Dankal](https://community.plotly.com/u/Dankal)\
**Post date:** [January 21, 2020, 10:47am UTC](https://community.plotly.com/t/prevent-update-when-mouse-is-down/33910/1 "2020-01-21T10:47:39Z")

</div>

I would like to prevent plot updates when user is rotating/moving chart.  
As you can see in example below, when updates are frequent and user drags slowly, the view is constantly being restored to the starting camera position.

 ![Peek 2020-01-21 11-39](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/9/9cd9bc61a88cb40b1574867b9770fd080f5e77cb.gif)

Do you have some idea how to do this? I am using timer for plot updates and would love to have some way to know if the mouse button is being pressed at the time and return no\_update in such a case.

---

<div class="post-metadata">

**Author:** ![Dankal](https://avatars.discourse-cdn.com/v4/letter/d/a9adbd/32.png) [@Dankal](https://community.plotly.com/u/Dankal)\
**Post date:** [February 28, 2020, 5:53pm UTC](https://community.plotly.com/t/prevent-update-when-mouse-is-down/33910/2 "2020-02-28T17:53:18Z")

</div>

Solved my problem. In case someone needed it, you basically need to add `isMouseDown` variable and constantly update it with 2 event listeners

Copying from [https://stackoverflow.com/a/47930992/4601890:](https://stackoverflow.com/a/47930992/4601890:)

```auto
let isMouseDown = false;

document.addEventListener('mousedown', function(event) {
    if ( event.which ) isMouseDown = true;
}, true);

document.addEventListener('mouseup', function(event) {
    if ( event.which ) isMouseDown = false;
}, true);

```

Then just not update if isMouseDown
