Fix timeline issue

This commit is contained in:
Johnnybegood90
2026-03-09 15:44:59 +01:00
parent 6bdfbcb206
commit 133d884653
+9 -6
View File
@@ -660,8 +660,8 @@ $m3u_url = htmlspecialchars($config["m3u_url"] ?? "");
<div class="now-line" id="nowLineRuler"></div> <div class="now-line" id="nowLineRuler"></div>
</div> </div>
<div class="programs-scroll" id="programsScroll"> <div class="programs-scroll" id="programsScroll">
<div class="programs-inner" id="programsInner">
<div class="now-line" id="nowLineGrid"></div> <div class="now-line" id="nowLineGrid"></div>
<div class="programs-inner" id="programsInner">
</div> </div>
</div> </div>
</div> </div>
@@ -869,8 +869,6 @@ function renderPrograms(vs, ve) {
const inner = document.getElementById('programsInner'); const inner = document.getElementById('programsInner');
inner.innerHTML = ''; inner.style.width = totalWidthPx+'px'; inner.style.height = (channels.length*ROW_H)+'px'; inner.innerHTML = ''; inner.style.width = totalWidthPx+'px'; inner.style.height = (channels.length*ROW_H)+'px';
const nowLine = document.createElement('div'); nowLine.className='now-line'; nowLine.id='nowLineGrid';
inner.appendChild(nowLine);
const now = new Date(); const now = new Date();
channels.forEach((ch, i) => { channels.forEach((ch, i) => {
@@ -909,7 +907,9 @@ function renderPrograms(vs, ve) {
scrollListenerAdded = true; scrollListenerAdded = true;
document.getElementById('programsScroll').addEventListener('scroll', function() { document.getElementById('programsScroll').addEventListener('scroll', function() {
document.getElementById('timeRulerInner').style.transform = `translateX(-${this.scrollLeft}px)`; document.getElementById('timeRulerInner').style.transform = `translateX(-${this.scrollLeft}px)`;
document.getElementById('nowLineRuler').style.left = (msToX(Date.now())-this.scrollLeft)+'px'; const visibleX = msToX(Date.now()) - this.scrollLeft;
document.getElementById('nowLineRuler').style.left = visibleX + 'px';
document.getElementById('nowLineGrid').style.left = visibleX + 'px';
document.getElementById('channelsList').scrollTop = this.scrollTop; document.getElementById('channelsList').scrollTop = this.scrollTop;
}); });
} }
@@ -917,10 +917,13 @@ function renderPrograms(vs, ve) {
function positionNowLine() { function positionNowLine() {
const x = msToX(Date.now()); const x = msToX(Date.now());
const scroll = document.getElementById('programsScroll');
const scrollLeft = scroll ? scroll.scrollLeft : 0;
const ruler = document.getElementById('nowLineRuler'); const ruler = document.getElementById('nowLineRuler');
const grid = document.getElementById('nowLineGrid'); const grid = document.getElementById('nowLineGrid');
if (ruler) { ruler.style.left=x+'px'; ruler.style.top='0'; ruler.style.bottom='0'; } const visibleX = x - scrollLeft;
if (grid) { grid.style.left=x+'px'; grid.style.top='0'; grid.style.height=(channels.length*80)+'px'; } if (ruler) { ruler.style.left = visibleX + 'px'; ruler.style.top='0'; ruler.style.bottom='0'; }
if (grid) { grid.style.left = visibleX + 'px'; grid.style.top='0'; grid.style.height='100%'; }
} }
function centerNow() { function centerNow() {