# Opacity changing is firing unnecessary annotation changed event

**URL:** <https://pdfjs.community/t/opacity-changing-is-firing-unnecessary-annotation-changed-event/849>\
**Category:** Technical Support\
**Created:** [June 25, 2021, 10:34am UTC](https://pdfjs.community/t/opacity-changing-is-firing-unnecessary-annotation-changed-event/849 "2021-06-25T10:34:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![toufiqul](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@toufiqul](https://pdfjs.community/u/toufiqul)\
**Post date:** [June 25, 2021, 10:34am UTC](https://pdfjs.community/t/opacity-changing-is-firing-unnecessary-annotation-changed-event/849/1 "2021-06-25T10:34:48Z")

</div>

When I’m changing opacity its firing annotaton changed mutlitple time, can we get it only when it stops. is there any way to get annotation changed fire only once on one point only.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/ffbcd25c7d423db8d5acd5db201c272f4db306dd.png) [@system](https://pdfjs.community/u/system)\
**Post date:** [June 25, 2021, 10:34am UTC](https://pdfjs.community/t/opacity-changing-is-firing-unnecessary-annotation-changed-event/849/2 "2021-06-25T10:34:53Z")

</div>

**Hello, I’m Ron, an automated tech support bot 🤖**

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:
- [Create fillable forms - Modify fields to readonly](https://pdfjs.express/documentation/forms/fill-form-fields#modify-fields-to-readonly)
- [Customize annotation tools - Event when tool creates an annotation](https://pdfjs.express/documentation/annotation/customizing-tools#event-when-tool-creates-an-annotation)
- [Add annotation events - annotationSelected](https://pdfjs.express/documentation/annotation/annotation-events#annotationselected)

APIs:
- [CoreControls.AnnotationManager - deleteAnnotation(annotation [, options])](https://pdfjs.express/api/CoreControls.AnnotationManager.html#deleteAnnotation__anchor)
- [CoreControls.BlackBoxAnnotationManager - preloadAnnotations(An)](https://pdfjs.express/api/CoreControls.BlackBoxAnnotationManager.html#preloadAnnotations__anchor)
- [CoreControls.AnnotationHistoryManager - historyChanged](https://pdfjs.express/api/CoreControls.AnnotationHistoryManager.html#event:historyChanged__anchor)

Forums:
- [Flipped annotations aren’t triggering annotationChanged (modify) event, also NOT getting saved/export](https://pdfjs.community/t/flipped-annotations-arent-triggering-annotationchanged-modify-event-also-not-getting-saved-export/591/2)
- [Annotations are getting displaced when zoom in and out are done abit fast](https://pdfjs.community/t/annotations-are-getting-displaced-when-zoom-in-and-out-are-done-abit-fast/567/1)
- [Get previous annotation from annotationChanged event](https://pdfjs.community/t/get-previous-annotation-from-annotationchanged-event/700/3)

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [June 25, 2021, 3:41pm UTC](https://pdfjs.community/t/opacity-changing-is-firing-unnecessary-annotation-changed-event/849/3 "2021-06-25T15:41:20Z")

</div>

Hi there!

We have a fix coming for this in the next version (aiming for beginning of July).

For now, you can debounce the event like so:

```javascript
  let debounce;
  instance.annotManager.on('annotationChanged', () => {
    clearTimeout(debounce)
    debounce = setTimeout(() => {
      console.log('Done!')
    }, 100) // you can adjust this number to suite your needs
  })

```

This code just sets a timeout that will get executed after 100ms, but clears that timeout every time the event is fired, effectively making the code inside the timeout execute only when the user is done sliding the slider.

Thanks!  
Logan

---

<div class="post-metadata">

**Author:** ![toufiqul](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@toufiqul](https://pdfjs.community/u/toufiqul)\
**Post date:** [July 6, 2021, 4:51am UTC](https://pdfjs.community/t/opacity-changing-is-firing-unnecessary-annotation-changed-event/849/4 "2021-07-06T04:51:49Z")

</div>

When will the release come? Can you please let me know the date

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [July 6, 2021, 6:33pm UTC](https://pdfjs.community/t/opacity-changing-is-firing-unnecessary-annotation-changed-event/849/5 "2021-07-06T18:33:36Z")

</div>

Hi there,

We do not have an exact date, but it is expected early-mid July.

Logan

---

<div class="post-metadata">

**Author:** ![sys1](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@sys1](https://pdfjs.community/u/sys1)\
**Post date:** [March 30, 2022, 4:44am UTC](https://pdfjs.community/t/opacity-changing-is-firing-unnecessary-annotation-changed-event/849/6 "2022-03-30T04:44:13Z")

</div>

Hi,  
is this fix already released? I`m facing the same issue with the slider

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [March 30, 2022, 3:12pm UTC](https://pdfjs.community/t/opacity-changing-is-firing-unnecessary-annotation-changed-event/849/7 "2022-03-30T15:12:00Z")

</div>

Hey there,

It appears there was a regression and this has started happening again. I’ve alerted the team and we’ll have it fixed soon.

Thanks!  
Logan
