Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: Allow for .next to be a MouseInteraction and clean up its event handlers #86

Conversation

maartenbreddels
Copy link
Collaborator

fix: Allow for .next to be a MouseInteraction and clean up its event handlers

We now remove the .drag event handlers, but, because multiple MouseInteractions
share the same DOM node and event name, this will remove all event handlers.

Therefore, if the 'parent' MouseInteraction reattaches its event handlers
when .next changes this is not an issue.

Also, if .next changes quickly, we might attach a stale interaction
because we awaited while in the meantime .next already changed.
This caused event handlers to be added, and never removed.

This makes it easier to debug which event handlers are attached
to the DOM.
…handlers

We now remove the .drag event handlers, but, because multiple MouseInteractions
share the same DOM node and event name, this will remove all event handlers.

Therefore, if the 'parent' MouseInteraction reattaches its event handlers
when .next changes this is not an issue.

Also, if .next changes quickly, we might attach a stale interaction
because we awaited while in the meantime .next already changed.
This caused event handlers to be added, and never removed.
@codecov
Copy link

codecov bot commented Mar 2, 2022

Codecov Report

Merging #86 (85bc685) into master (3e6077f) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #86   +/-   ##
=======================================
  Coverage   55.38%   55.38%           
=======================================
  Files           7        7           
  Lines         130      130           
=======================================
  Hits           72       72           
  Misses         58       58           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3e6077f...85bc685. Read the comment docs.

@maartenbreddels
Copy link
Collaborator Author

Note that this does not seem to be a problem in Jupyter lab, which I am not sure if it can be considered a notebook issue, but I commented on this at March 2, 2022 1:18 PM

@maartenbreddels
Copy link
Collaborator Author

@kecnry This should fix the issues you mentioned in spacetelescope/jdaviz#1013 (comment) but it would be great if you can confirm it.

@kecnry
Copy link

kecnry commented Mar 2, 2022

Seems to have done the trick! Thanks @maartenbreddels!

@maartenbreddels maartenbreddels merged commit 0ec7d87 into glue-viz:master Mar 8, 2022
kecnry added a commit to kecnry/jdaviz that referenced this pull request Mar 8, 2022
* glue-viz/bqplot-image-gl#86 which fixes a bug in the slice indicator sliding noted in spacetelescope#1013 (comment)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants