From b6cceb5acfae140b12b49b8bc12b4e709b5e520d Mon Sep 17 00:00:00 2001 From: Matt Walsh Date: Tue, 10 Jan 2023 14:12:22 -0600 Subject: [PATCH] radar scroll height --- server/scripts/modules/radar.mjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/scripts/modules/radar.mjs b/server/scripts/modules/radar.mjs index 5412efa..dcbf608 100644 --- a/server/scripts/modules/radar.mjs +++ b/server/scripts/modules/radar.mjs @@ -213,8 +213,12 @@ class Radar extends WeatherDisplay { const timePadded = time.length >= 8 ? time : ` ${time}`; this.elem.querySelector('.header .right .time').innerHTML = timePadded; + // get image offset calculation + // is slides slightly because of scaling so we have to take a measurement from the rendered page + const actualFrameHeight = this.elem.querySelector('.frame').getBoundingClientRect().height; + // scroll to image - this.elem.querySelector('.scroll-area').style.top = `${-this.screenIndex * 371}px`; + this.elem.querySelector('.scroll-area').style.top = `${-this.screenIndex * actualFrameHeight}px`; this.finishDraw(); }