-
Notifications
You must be signed in to change notification settings - Fork 76
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
initialize zoom center even when viewer not shown #3222
initialize zoom center even when viewer not shown #3222
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3222 +/- ##
=======================================
Coverage 88.56% 88.56%
=======================================
Files 125 125
Lines 18751 18754 +3
=======================================
+ Hits 16606 16609 +3
Misses 2145 2145 ☔ View full report in Codecov by Sentry. |
Thanks! Maybe turn Duy's example code into a regression test? 🤔 |
yep - wanted to make sure this works on top of #2872 first and see whether tests there will cover this case or whether we want a dedicated test just for this |
on second thought, this can be tested on an even simpler case (confirmed to fail on main). @duytnguyendtn - if you think this will later get duplicated coverage in #2872, feel free to remove the test there when you rebase. |
assert imviz_helper.default_viewer._obj.state.zoom_center_x > 0 | ||
assert imviz_helper.default_viewer._obj.state.zoom_center_y > 0 | ||
assert imviz_helper.default_viewer._obj.state.zoom_radius > 0 |
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.
Can we be a little more specific? Maybe allclose
check instead of just non-zero check?
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.
I intentionally left this flexible so if the zoom behavior changes this does not break except for the regression (where the values were left uninitialized at their default values). Other tests handle specific zoom-tool behavior already. But if you'd still prefer to enforce the current values, I can easily make that change.
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.
Thanks for the quick fix! I tested this on top of #2872 and that fixed one of the two failures that happened, but digging into it last night it seems like the two failures are two separate cases. But at least the one that was failing due to the uninitialized zoom center is now passing. Thanks!
While technically true the |
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.
Thanks!
Description
This pull request sets the zoom center/radius traitlets as soon as the viewer is assigned back to the state to ensure they are initialized immediately rather than waiting for a zoom event when the viewer is shown on the screen. @duytnguyendtn - can you confirm if this fixes the case that you were running into?
Fixes #3217
Change log entry
CHANGES.rst
? If you want to avoid merge conflicts,list the proposed change log here for review and add to
CHANGES.rst
before merge. If no, maintainershould add a
no-changelog-entry-needed
label.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.