@@ -46,6 +46,15 @@ export default class EventHandler {
4646 this . model . set ( "_wcs" , this . aladin . getViewWCS ( ) ) ;
4747 }
4848
49+ /**
50+ * Updates the view center rotation in the model.
51+ * WARNING: This method don't call model.save_changes()!
52+ */
53+ updateRotation ( ) {
54+ if ( ! this . isLastDiv ( ) ) return ;
55+ this . model . set ( "_rotation" , this . aladin . getRotation ( ) ) ;
56+ }
57+
4958 /**
5059 * Updates the 2-axis FoV in the model.
5160 * WARNING: This method don't call model.save_changes()!
@@ -138,6 +147,15 @@ export default class EventHandler {
138147 this . model . save_changes ( ) ;
139148 } ) ;
140149
150+ /* Rotation control */
151+ this . model . on ( "change:_rotation" , ( ) => {
152+ setRotation ( this . model . get ( "_rotation" ) , this . aladinDiv ) ;
153+ // Update WCS and FoV only if this is the last div
154+ this . updateWCS ( ) ;
155+ this . update2AxisFoV ( ) ;
156+ this . model . save_changes ( ) ;
157+ } ) ;
158+
141159 /* Aladin callbacks */
142160
143161 this . aladin . on ( "cooFrameChanged" , ( ) => {
@@ -273,6 +291,7 @@ export default class EventHandler {
273291 this . eventHandlers = {
274292 add_marker : this . messageHandler . handleAddMarker ,
275293 change_fov : this . messageHandler . handleChangeFoV ,
294+ change_rotation : this . messageHandler . handleChangeRotation ,
276295 goto_ra_dec : this . messageHandler . handleGotoRaDec ,
277296 save_view_as_image : this . messageHandler . handleSaveViewAsImage ,
278297 add_fits : this . messageHandler . handleAddFits ,
@@ -302,6 +321,7 @@ export default class EventHandler {
302321 this . model . off ( "change:_target" ) ;
303322 this . model . off ( "change:_fov" ) ;
304323 this . model . off ( "change:_height" ) ;
324+ this . model . off ( "change:_rotation" ) ;
305325 this . model . off ( "change:coo_frame" ) ;
306326 this . model . off ( "change:survey" ) ;
307327 this . model . off ( "change:overlay_survey" ) ;
0 commit comments