Skip to content

Commit

Permalink
🐛 Fix WCS recovering when widget is out of sight
Browse files Browse the repository at this point in the history
  • Loading branch information
Xen0Xys committed Aug 1, 2024
1 parent 0472517 commit e39f996
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions js/models/event_handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ export default class EventHandler {
this.aladin.setFoV(fov);
});

this.aladin.on("layerChanged", (imageLayer, layerName, state) => {
if (layerName !== "base" || state !== "ADDED") return;
this.updateWCS();
this.model.set("_base_layer_last_view", imageLayer.id);
this.model.save_changes();
});

/* Div control */
this.model.on("change:_height", () => {
let height = this.model.get("_height");
Expand All @@ -151,16 +158,12 @@ export default class EventHandler {
this.model.save_changes();
});

this.aladin.on("layerChanged", (imageLayer, layerName, state) => {
if (layerName !== "base" || state !== "ADDED") return;
this.updateWCS();
this.model.set("_base_layer_last_view", imageLayer.id);
this.model.save_changes();
});

this.aladin.on("resizeChanged", () => {
this.aladin.on("resizeChanged", (width, height) => {
// Skip resize event when the div is hidden
if (width === 1 && height === 1) return;
this.updateWCS();
this.update2AxisFoV();
this.model.set("_height", height);
this.model.save_changes();
});

Expand Down

0 comments on commit e39f996

Please sign in to comment.