Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Avoid duplicate draws in FRBMark #249

Merged
merged 5 commits into from
Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
0.8 (unreleased)
================

* Avoid updating FRBMark multiple times when adding a new layer. [#248]

0.7 (2021-07-02)
================

Expand Down
5 changes: 4 additions & 1 deletion glue_jupyter/bqplot/image/frb_mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ def __init__(self, viewer, array_maker):
self.viewer.figure.axes[1].scale.observe(self.debounced_update, 'min')
self.viewer.figure.axes[1].scale.observe(self.debounced_update, 'max')

self.update()
# NOTE: we deliberately don't call .update() here because when FRBImage
# is created for the main composite image layer the composite arrays
# haven't been set up yet, and for subset layers the layer gets force
# updated anyway when the layers are added to the viewer.

@debounced(method=True)
def debounced_update(self, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion glue_jupyter/bqplot/image/layer_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def _update_image(self, force=False, **kwargs):
self._update_contour_lines()

def _update_image_data(self, *args, **kwargs):
super()._update_image_data(*args, **kwargs)
self.composite_image.invalidate_cache()
# if the image data change, the contour lines are invalid
self._contour_line_cache.clear()
self._update_contour_lines()
Expand Down