Skip to content

Commit 0d8743e

Browse files
cppartsbmatthieu3
authored andcommitted
initial updates from Matthieu, adding noqa to avoid ruff errors on PLC0415
1 parent 7eb3a16 commit 0d8743e

4 files changed

Lines changed: 7 additions & 19 deletions

File tree

js/models/event_handler.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ export default class EventHandler {
5151
* WARNING: This method doesn't call model.save_changes()!
5252
*/
5353
updateRotation() {
54-
if (!this.isLastDiv()) return;
55-
this.model.set("_rotation", this.aladin.getRotation());
54+
let rotation = this.model.get("_rotation");
55+
this.aladin.setRotation(rotation);
5656
}
5757

5858
/**
@@ -144,6 +144,7 @@ export default class EventHandler {
144144
// Update WCS and FoV only if this is the last div
145145
this.updateWCS();
146146
this.update2AxisFoV();
147+
if (!this.isLastDiv()) return;
147148
this.model.save_changes();
148149
});
149150

@@ -203,14 +204,9 @@ export default class EventHandler {
203204
});
204205

205206
this.aladin.on("rotationChanged", (object) => {
206-
if (object["data"] !== undefined) {
207-
this.model.send({
208-
event_type: "rotation_changed",
209-
content: {
210-
rotation: object["rotation"],
211-
},
212-
});
213-
}
207+
this.updateRotation();
208+
if (!this.isLastDiv()) return;
209+
this.model.save_changes();
214210
});
215211

216212
this.aladin.on("objectClicked", (clicked) => {
@@ -302,7 +298,6 @@ export default class EventHandler {
302298
this.eventHandlers = {
303299
add_marker: this.messageHandler.handleAddMarker,
304300
change_fov: this.messageHandler.handleChangeFoV,
305-
change_rotation: this.messageHandler.handleChangeRotation,
306301
goto_ra_dec: this.messageHandler.handleGotoRaDec,
307302
save_view_as_image: this.messageHandler.handleSaveViewAsImage,
308303
add_fits: this.messageHandler.handleAddFits,

js/models/message_handler.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ export default class MessageHandler {
3838
this.aladin.gotoRaDec(msg["ra"], msg["dec"]);
3939
}
4040

41-
handleChangeRotation(msg) {
42-
this.aladin.setRotation(msg["rotation"]);
43-
}
44-
4541
async handleSaveViewAsImage(msg) {
4642
const path = msg["path"];
4743
const format = msg["format"];

js/widget.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function initAladinLite(model, el) {
3939
});
4040
const wcs = { ...aladin.getViewWCS() };
4141
model.set("_wcs", wcs);
42-
const rotation = { ...aladin.getRotation() };
42+
const rotation = aladin.getRotation();
4343
model.set("_rotation", rotation);
4444

4545
model.set("_is_loaded", true);

src/ipyaladin/widget.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,7 @@ def rotation(self, rotation: Union[float, Angle]) -> None:
326326
rotation = rotation.deg
327327
if np.isclose(self._rotation, rotation):
328328
return
329-
self._wcs = {}
330-
self._fov_xy = {}
331329
self._rotation = rotation
332-
self.send({"event_name": "change_rotation", "rotation": rotation})
333330

334331
@property
335332
def wcs(self) -> WCS:

0 commit comments

Comments
 (0)