1- from matplotlib .transforms import Affine2D
1+ import math
2+
23from traitlets import Any
34
45from jdaviz .core .registries import tray_registry
@@ -13,7 +14,7 @@ class RotateImageSimple(TemplateMixin, ViewerSelectMixin):
1314
1415 def __init__ (self , * args , ** kwargs ):
1516 super ().__init__ (* args , ** kwargs )
16- self ._theta = 0 # degrees, counter- clockwise
17+ self ._theta = 0 # degrees, clockwise
1718
1819 def vue_rotate_image (self , * args , ** kwargs ):
1920 # We only grab the value here to avoid constantly updating as
@@ -26,12 +27,9 @@ def vue_rotate_image(self, *args, **kwargs):
2627 viewer = self .app ._viewer_by_id (self .viewer_selected )
2728
2829 # Rotate selected viewer canvas.
29- # TODO: This changes zoom too? astrofrog will fix translation issue?
30- y_hub = (viewer .scales ['y' ].min + viewers .scales ['y' ].max ) / 2
31- x_hub = (viewer .scales ['x' ].min + viewer .scales ['x' ].max ) / 2
32- affine_transform = Affine2D ().rotate_deg_around (y_hub , x_hub , self ._theta )
33- viewer .state .affine_matrix = affine_transform
30+ # TODO: Translation still a bit broken if zoomed in.
31+ viewer .state .rotation = math .radians (self ._theta )
3432
35- # TODO: Does the zoom box behave ? If not, we need to disable it.
33+ # TODO: Zoom box in Compass still broken, how to fix ? If not, we need to disable it.
3634 # Update Compass plugin.
3735 viewer .on_limits_change ()
0 commit comments