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

Canvas rotation #1983

Merged
merged 33 commits into from
Apr 3, 2023
Merged

Canvas rotation #1983

merged 33 commits into from
Apr 3, 2023

Conversation

kecnry
Copy link
Member

@kecnry kecnry commented Jan 26, 2023

Description

This pull request uses css canvas rotation to allow for on-the-fly image rotation (original effort: #1384).

Plugin docs
Plugin API docs

Screen.Recording.2023-02-28.at.2.51.08.PM.mov

TODO:

  • cross-browser support for the correct dragging direction. Will need significant testing across different browsers/versions and perhaps considering workarounds upstream in glue/bqplot or worse case scenario we could detect compatibility and display a message in the plugin
  • cleanup plugin UI (live update instead of button press? option to set north to up? rename plugin to distinguis from reproject)
  • Have zoom box in Compass follow canvas rotation. (Disabled for now.). Or for canvas itself to rotate?
  • Multi-viewer support (value should update when viewer dropdown is changed, consider support for multiselect a la plot options... what to do with linked zoom limits in Imviz...)
  • Port some of the relevant docs from Rotate image in Imviz #1340 into docs/imviz/plugins.rst. This should wait till after Doc Changes for June 2022 #1393 is merged to avoid conflicts.
  • Test coverage?
  • Any other TODOs in the diff

Follow-up:

  • track down and fix the 1/3 image disappearing bug. Probably was introduced somewhere in the limits logic since it does not seem to happen on main.
  • Home button no longer make sense when canvas is rotated. Is this something we can address? Should rotation reset or just set limits such that the whole image is in-frame?
  • Re-consider canvas oversizing (to avoid cropping on the edge of the figures by extending beyond the viewer but faking the zoom-level... see several different attempts at doing that in the commit history in this PR).
  • this currently works per-viewer, but could be changed to be global or the viewer dropdown could support multi-select (with logic for mixed state either copied from plot options or generalized or a lock button that just adopts the default viewer's angle for all viewers and hides the dropdown)

Change log entry

  • Is a change log needed? If yes, is it added to 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, maintainer
    should 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.

  • Are two approvals required? Branch protection rule does not check for the second approval. If a second approval is not necessary, please apply the trivial label.
  • Do the proposed changes actually accomplish desired goals? Also manually run the affected example notebooks, if necessary.
  • Do the proposed changes follow the STScI Style Guides?
  • Are tests added/updated as required? If so, do they follow the STScI Style Guides?
  • Are docs added/updated as required? If so, do they follow the STScI Style Guides?
  • Did the CI pass? If not, are the failures related?
  • Is a milestone set? Set this to bugfix milestone if this is a bug fix and needs to be released ASAP; otherwise, set this to the next major release milestone.
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)?

@github-actions github-actions bot added documentation Explanation of code and concepts embed Regarding issues with front-end embedding imviz labels Jan 26, 2023
@kecnry kecnry mentioned this pull request Feb 10, 2023
17 tasks
@codecov
Copy link

codecov bot commented Feb 27, 2023

Codecov Report

Patch coverage: 94.35% and project coverage change: +0.06 🎉

Comparison is base (5510486) 91.90% compared to head (237ea1b) 91.97%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1983      +/-   ##
==========================================
+ Coverage   91.90%   91.97%   +0.06%     
==========================================
  Files         143      146       +3     
  Lines       15605    15900     +295     
==========================================
+ Hits        14342    14624     +282     
- Misses       1263     1276      +13     
Impacted Files Coverage Δ
jdaviz/app.py 93.41% <ø> (-0.59%) ⬇️
jdaviz/configs/imviz/plugins/viewers.py 91.13% <ø> (ø)
jdaviz/core/events.py 94.61% <86.66%> (-0.58%) ⬇️
jdaviz/core/template_mixin.py 92.78% <86.95%> (-0.14%) ⬇️
...igs/default/plugins/model_fitting/model_fitting.py 85.00% <92.85%> (+1.62%) ⬆️
jdaviz/configs/imviz/plugins/compass/compass.py 93.10% <93.33%> (-0.23%) ⬇️
...nfigs/imviz/plugins/rotate_canvas/rotate_canvas.py 95.58% <95.58%> (ø)
jdaviz/configs/default/plugins/markers/markers.py 95.00% <100.00%> (+0.06%) ⬆️
...efault/plugins/model_fitting/tests/test_fitting.py 99.42% <100.00%> (+0.07%) ⬆️
jdaviz/configs/imviz/plugins/__init__.py 100.00% <100.00%> (ø)
... and 2 more

... and 4 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@kecnry kecnry added this to the 3.4 milestone Feb 28, 2023
@kecnry kecnry force-pushed the canvas-rotation branch 4 times, most recently from 4418017 to 7b68214 Compare February 28, 2023 20:14
@kecnry kecnry force-pushed the canvas-rotation branch 5 times, most recently from a582caa to 5a0d495 Compare March 2, 2023 15:35
@kecnry
Copy link
Member Author

kecnry commented Mar 2, 2023

dev failure is unrelated (also seen in #2053)

@kecnry kecnry marked this pull request as ready for review March 2, 2023 15:50
@kecnry
Copy link
Member Author

kecnry commented Mar 2, 2023

Note that bqplot/bqplot#1585 is required to fix the drag direction in Firefox and Safari. Do we want to hold this up until that is merged/released/pinned?

@rosteen
Copy link
Collaborator

rosteen commented Mar 2, 2023

Note that bqplot/bqplot#1585 is required to fix the drag direction in Firefox and Safari. Do we want to hold this up until that is merged/released/pinned?

I consider it a blocker, personally, the behavior is really annoying.

@kecnry
Copy link
Member Author

kecnry commented Mar 2, 2023

I consider it a blocker, personally, the behavior is really annoying.

Ok, I think this can still be reviewed (on other browsers or using that PR), but we can defer merging until that can be pinned.

@kecnry kecnry marked this pull request as draft March 2, 2023 17:04
@camipacifici
Copy link
Contributor

In Chrome, everything works as expected using a single viewer. I see in the task list to work on the zoom box in compass. I do not see it as a blocker, but it will be a nice to have as a follow up.
When I load a second viewer, I can rotate using the slider, but the present selections do nothing (they still work if I select the first viewer).
About the home button: to me it makes sense that it resets the zoom, but preserves the rotation. Happy to discuss other options.
With the two viewers, if I zoom (with the linked option) on the first viewer, the second viewer "blinks" (for lack of a better word, although it is not an actual blinking between two different images) a couple of times before settling on the correct zoom.
Screen Shot 2023-03-02 at 12 47 14 PM

* needed to include fix for rotated drag events in some browsers
Copy link
Collaborator

@rosteen rosteen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirmed that the panning direction problem is fixed with the most recent bqplot, approved.

@kecnry kecnry merged commit acbaf30 into spacetelescope:main Apr 3, 2023
@kecnry kecnry deleted the canvas-rotation branch April 3, 2023 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Explanation of code and concepts embed Regarding issues with front-end embedding imviz Ready for final review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants