-
Notifications
You must be signed in to change notification settings - Fork 82
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
Imviz click to center in pan/zoom #1319
Conversation
Not sure why auto labeling failed but should not block this PR. |
Codecov Report
@@ Coverage Diff @@
## main #1319 +/- ##
==========================================
- Coverage 81.22% 81.09% -0.14%
==========================================
Files 91 91
Lines 7570 7591 +21
==========================================
+ Hits 6149 6156 +7
- Misses 1421 1435 +14
Continue to review full report at Codecov.
|
Can this logic not be in the tools themselves? Do we want this to be imviz-specific behavior and not in all image viewer (or all viewers)? |
It was only requested for Imviz. 🤷 If you want this to be native in Pan/Zoom tool, then it has to go upstream in |
We can put it in a subclass of the panzoom tools (in
We'll have to see if the existing selector (likely |
The PanZoom stuff is all the way in https://github.com/bqplot/bqplot/blob/0.12.x/bqplot/interacts.py#L140 https://github.com/bqplot/bqplot/blob/0.12.x/js/src/PanZoom.ts https://github.com/bqplot/bqplot/blob/0.12.x/js/src/PanZoomModel.ts |
Then we can still add a callback on the viewer in the same way that we do for the |
This comment was marked as resolved.
This comment was marked as resolved.
as suggested by Kyle Conroy.
Okay, I think refactored it as you suggested, @kecnry . Is this what you meant? |
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.
Yes, exactly! And seems to work perfectly! This is currently still imviz-specific, but I think that's fine for now (and it lives in imviz tools, so that makes sense... if we ever want to generalize it for other viewers, we can easily move it into the core tools). Besides one line in the docs, this isn't really discoverable, but I think that's ok too.
Would be nice to have better test coverage, but testing the actual on_click
logic probably wouldn't be easy (although I guess we could pass data
manually to on_click
to mimic the location... but then its still not fully testing the interactive action). If we've usually let these things go through without full coverage, I'm fine with that for now and we can revisit it when we implement better UI/UX testing.
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.
Looks good!
Thanks for the approvals! |
Description
This pull request is to enable "click to center" when in pan/zoom mode (either linked or unlinked)
This is driven by interactive actions, and by precedence, I didn't write any non-interactive unit tests for it. The underlying
center_on()
method is already tested intest_astrowidgets_api.py
.Checklist for package maintainer(s)
This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.
trivial
label.CHANGES.rst
?