diff --git a/js/models/event_handler.js b/js/models/event_handler.js index 8b21d0ff..b8e8d8ed 100644 --- a/js/models/event_handler.js +++ b/js/models/event_handler.js @@ -42,25 +42,21 @@ export default class EventHandler { // Event triggered when the user moves the map in Aladin Lite this.aladin.on("positionChanged", (position) => { - if (f1Lock.locked) return; - // const raDec = this.aladin.getRaDec(); - const raDec = [position.ra, position.dec]; - this.clog("positionChanged", `${raDec[0]} ${raDec[1]}`); + if (f1Lock.locked) { + f1Lock.unlock(); + return; + } + const raDec = this.aladin.getRaDec(); + // const raDec = [position.ra, position.dec]; this.model.set("_target", `${raDec[0]} ${raDec[1]}`); - this.model.set("shared_target", `${raDec[0]} ${raDec[1]}`); this.model.save_changes(); - f2Lock.unlock(); }); // Event triggered when the target is changed from the Python side using jslink - this.model.on("change:shared_target", () => { - if (f1Lock.locked) return; - f2Lock.lock(); - const target = this.model.get("shared_target"); - const [ra, dec] = target.split(" "); - this.clog("change:shared_target", target); + this.model.on("change:_target", () => { + const [ra, dec] = this.model.get("_target").split(" "); this.aladin.gotoRaDec(ra, dec); - f1Lock.unlock(); + f1Lock.lock(); }); /* Field of View control */