Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions frontend/src/components/graph2D/indexOverlay/IndexOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -296,28 +296,41 @@ export function IndexOverlay({
return;
}

// Position index line
// Position index line — hide if the current x or y value is outside the zoomed viewport
const px = chart.convertToPixel({ xAxisIndex: 0 }, xValue) as number;
const inBoundsX = px >= rect.x && px <= rect.x + rect.width;

if (!inBoundsX) {
lineEl.style.display = 'none';
Comment thread
camdnnn marked this conversation as resolved.
dotEls.forEach((dotEl) => {
if (dotEl) dotEl.style.display = 'none';
});
return;
}

lineEl.style.transform = `translate3d(${px}px, ${rect.y}px, 0)`;
lineEl.style.height = `${rect.height}px`;
lineEl.style.display = 'block';

// Position dots
yValues.forEach((yValue, seriesIndex) => {
const dotEl = dotEls[seriesIndex];
if (!dotEl) return;
if (yValue != null) {
const py = chart.convertToPixel({ yAxisIndex: 0 }, yValue) as number;
dotEls.forEach((dotEl, seriesIndex) => {
const yValue = yValues[seriesIndex];
if (!dotEl || yValue == null) return;

const py = chart.convertToPixel({ yAxisIndex: 0 }, yValue) as number;
const inBoundsY = py >= rect.y && py <= rect.y + rect.height;
if (inBoundsY) {
dotEl.style.transform = `translate3d(${px - 6}px, ${py - 6}px, 0)`;
dotEl.style.display = 'block';
} else {
dotEl.style.display = 'none';
}
});

for (let i = yValues.length; i < dotEls.length; i++) {
if (dotEls[i]) dotEls[i].style.display = 'none';
}
// Not sure what this code does
// for (let i = yValues.length; i < dotEls.length; i++) {
// if (dotEls[i]) dotEls[i].style.display = 'none';
// }

// Build tooltip HTML
const xLabel = xAxis.unit
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/utils/ReplayController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export class ReplayController {
if (latest) {
this.emit({
type: ReplayEventType.Progress,
currentIndex: this.currentIndex,
currentIndex: this.currentIndex - 1,
data: latest, // only the newest point this frame
});
}
Expand Down
Loading