Option to show markers symbols at top/bottom of graph for out-of-range markers

This commit is contained in:
Jan Käberich 2025-04-13 14:27:44 +02:00
parent a28dd50e36
commit b1c4c4ffad
4 changed files with 39 additions and 9 deletions

View file

@ -638,13 +638,25 @@ void TraceXYPlot::draw(QPainter &p)
p.drawLine(p1, p2);
}
if(pref.Marker.clipToYAxis) {
// clip Y coordinate of markers to visible area (always show markers, even when out of range)
if(point.y() < plotRect.top()) {
point.ry() = plotRect.top();
} else if(point.y() > plotRect.bottom()) {
point.ry() = plotRect.bottom();
}
}
if(!plotRect.contains(point)) {
// out of screen
continue;
}
auto symbol = m->getSymbol();
point += QPoint(-symbol.width()/2, -symbol.height());
// ignore clipRect for markers
p.setClipping(false);
p.drawPixmap(point, symbol);
p.setClipping(true);
}
}
}