diff --git a/js/models/event_handler.js b/js/models/event_handler.js index ed7e82b0..3656ed17 100644 --- a/js/models/event_handler.js +++ b/js/models/event_handler.js @@ -1,9 +1,10 @@ import MessageHandler from "./message_handler"; export default class EventHandler { - constructor(A, aladin, model) { + constructor(A, aladin, aladinDiv, model) { this.A = A; this.aladin = aladin; + this.aladinDiv = aladinDiv; this.model = model; this.messageHandler = new MessageHandler(A, aladin); } @@ -77,7 +78,7 @@ export default class EventHandler { /* Div control */ this.model.on("change:height", () => { let height = this.model.get("height"); - aladinDiv.style.height = `${height}px`; + this.aladinDiv.style.height = `${height}px`; }); /* Aladin callbacks */ diff --git a/js/widget.js b/js/widget.js index 84012d12..df445791 100644 --- a/js/widget.js +++ b/js/widget.js @@ -31,7 +31,7 @@ function initAladinLite(model, el) { aladin.gotoRaDec(raDec[0], raDec[1]); el.appendChild(aladinDiv); - return aladin; + return { aladin, aladinDiv }; } async function initialize({ model }) { @@ -43,9 +43,9 @@ function render({ model, el }) { /* View -------------- */ /* ------------------- */ - const aladin = initAladinLite(model, el); + const { aladin, aladinDiv } = initAladinLite(model, el); - const eventHandler = new EventHandler(A, aladin, model); + const eventHandler = new EventHandler(A, aladin, aladinDiv, model); eventHandler.subscribeAll(); return () => {