From bd89e7f95b00115d134aa9bff90c736f4f7d44a9 Mon Sep 17 00:00:00 2001 From: Xen0Xys Date: Wed, 24 Apr 2024 14:33:08 +0200 Subject: [PATCH] :bug: Fix missing aladinDiv argument to EventHandler constructor --- js/models/event_handler.js | 5 +++-- js/widget.js | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) 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 () => {