-
Notifications
You must be signed in to change notification settings - Fork 38
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
Expand fixed resolution buffer beyond the image boundaries to make panning seamless #246
Conversation
Does this go with another fix that disable actual pan until mouse button is up? Or this is it? |
Codecov Report
@@ Coverage Diff @@
## main #246 +/- ##
==========================================
- Coverage 89.11% 88.68% -0.44%
==========================================
Files 82 82
Lines 4044 4074 +30
==========================================
+ Hits 3604 3613 +9
- Misses 440 461 +21
Continue to review full report at Codecov.
|
I will do a separate PR for the mouse button fix, but you can already try this PR out as it will give you the biggest benefit |
@@ -56,6 +56,12 @@ def update(self, *args, **kwargs): | |||
ymin = self.viewer.figure.axes[1].scale.min | |||
ymax = self.viewer.figure.axes[1].scale.max | |||
|
|||
# Expand beyond the boundary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this mean when the whole image already fits in the view? Does it do unnecessary computation in that case, or is this smart enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is smart enough :)
Agreed with @pllim - the performance is vastly better, but the display scaling seems strangely different (and I don't see why the small code change here would have affected that). See the two short movies below for an example of what I'm talking about. With this PR, there are a bunch of bright pixels that seem to change location when panning, which is quite annoying. Screen.Recording.2021-08-03.at.2.46.35.PM.movScreen.Recording.2021-08-03.at.2.55.09.PM.mov |
Maybe the bounds = [(ymin, ymax, ny), (xmin, xmax, nx)] Min/max changed but |
I dunno, maybe something like this? With this, resolution improved and still appeared somewhat performance on drag/zoom, but I did notice a lag in loading (or has it been always there?). 🤷 --- a/glue_jupyter/bqplot/image/frb_mark.py
+++ b/glue_jupyter/bqplot/image/frb_mark.py
@@ -65,7 +65,8 @@ class FRBImage(ImageGL):
if xmin is None or xmax is None or ymin is None or ymax is None:
return
- ny, nx = self.shape
+ ny = self.shape[0] + int(dy * 0.5)
+ nx = self.shape[1] + int(dx * 0.5)
# Set up bounds
bounds = [(ymin, ymax, ny), (xmin, xmax, nx)] p.s. I also attempted the "only update pan on dragend" but didn't get anywhere. I went as far as setting |
Looks like that resolved the problem I was seeing. The resolution looks good now, and the performance is much better than it was. I still get some white space that takes a moment to fill in occasionally when zoomed in and panning, but it is way better than the constant slow drawing previously. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolution seems fine now. As @rosteen said, there is still some lag if you pan around or zoom too much real fast, but some improvement is better than no improvement.
Hold on... Toolbar is laggy when I re-enable linking in the Imviz example notebook with this patch. Do you also see the same problem? |
Especially the blinking. Blink is now laggy. |
Yes that could well be - the issue is that the image will now take longer to generate, so blinking could end up being a bit slower. I need to think a little more about how we can improve performance across the board. |
The issue is that this currently slows down the main display of the image, so it would be better to asynchronously load the image outside the field of view after the main visible image has been updated. |
Re: #246 (comment) -- Does that mean you plan to push more commit to this before I review, or is that "future work"? (Tom said this PR is no-go.) |
9e7845b
to
66d7c9e
Compare
…nning seem seamless
66d7c9e
to
8fde165
Compare
I've now made this effectively opt-in for now until we come up with a more elegant solution. To opt in to this, downstream packages should set the |
Thanks, but this isn't really usable for MVP unless you plan to release it in the next 2 days. |
Watch me 😆 |
See spacetelescope/jdaviz#864 for using this in jdaviz. |
I think this will resolve spacetelescope/jdaviz#564