Merge pull request #61 from ok2/codex/fix-event-overflow-in-detail-view

This commit is contained in:
Kiyomichi Kosaka 2025-06-20 07:42:01 +02:00 committed by GitHub
commit 47d4a66b0f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 9 deletions

View File

@ -743,17 +743,20 @@ function showEonstripDetail(index, startCob) {
const width = 100 / (columns.length || 1); const width = 100 / (columns.length || 1);
events.forEach(ev=>{ events.forEach(ev=>{
const left = ev.col * width; const left = ev.col * width;
const elem = document.createElement(ev.end>ev.start ? 'div':'div'); const displayStart = Math.max(0, ev.start);
if (ev.end>ev.start) { const displayEnd = Math.min(1, ev.end);
elem.className='event-box'; const elem = document.createElement(ev.end > ev.start ? 'div' : 'div');
elem.style.height=((ev.end-ev.start)*100)+'%'; if (ev.end > ev.start) {
elem.className = 'event-box';
const h = (displayEnd - displayStart) * 100;
elem.style.height = (h > 0 ? h : 0) + '%';
} else { } else {
elem.className='event-line'; elem.className = 'event-line';
} }
elem.style.top=(ev.start*100)+'%'; elem.style.top = (displayStart * 100) + '%';
elem.style.left=left+'%'; elem.style.left = left + '%';
elem.style.width=`calc(${width}% - 2px)`; elem.style.width = `calc(${width}% - 2px)`;
elem.textContent=ev.label; elem.textContent = ev.label;
timeline.appendChild(elem); timeline.appendChild(elem);
}); });
} }

View File

@ -403,6 +403,7 @@
height: 400px; height: 400px;
border-left: 2px solid #00ffff; border-left: 2px solid #00ffff;
margin-left: 40px; margin-left: 40px;
overflow: hidden;
} }
.timeline-block { .timeline-block {