diff --git a/Software/PC_Application/LibreVNA-GUI/Traces/tracexyplot.cpp b/Software/PC_Application/LibreVNA-GUI/Traces/tracexyplot.cpp index e608a58..79e628a 100644 --- a/Software/PC_Application/LibreVNA-GUI/Traces/tracexyplot.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Traces/tracexyplot.cpp @@ -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); } } } diff --git a/Software/PC_Application/LibreVNA-GUI/preferences.cpp b/Software/PC_Application/LibreVNA-GUI/preferences.cpp index 7bca628..69a6b7b 100644 --- a/Software/PC_Application/LibreVNA-GUI/preferences.cpp +++ b/Software/PC_Application/LibreVNA-GUI/preferences.cpp @@ -322,6 +322,7 @@ void PreferencesDialog::setInitialGUIState() ui->MarkerInterpolate->setCurrentIndex(p->Marker.interpolatePoints ? 1 : 0); ui->MarkerSortOrder->setCurrentIndex((int) p->Marker.sortOrder); ui->MarkerSymbolStyle->setCurrentIndex((int) p->Marker.symbolStyle); + ui->MarkerClipToYAxis->setChecked(p->Marker.clipToYAxis); ui->SCPIServerEnabled->setChecked(p->SCPIServer.enabled); ui->SCPIServerPort->setValue(p->SCPIServer.port); @@ -437,6 +438,7 @@ void PreferencesDialog::updateFromGUI() p->Marker.interpolatePoints = ui->MarkerInterpolate->currentIndex() == 1; p->Marker.sortOrder = (MarkerSortOrder) ui->MarkerSortOrder->currentIndex(); p->Marker.symbolStyle = (MarkerSymbolStyle) ui->MarkerSymbolStyle->currentIndex(); + p->Marker.clipToYAxis = ui->MarkerClipToYAxis->isChecked(); p->SCPIServer.enabled = ui->SCPIServerEnabled->isChecked(); p->SCPIServer.port = ui->SCPIServerPort->value(); diff --git a/Software/PC_Application/LibreVNA-GUI/preferences.h b/Software/PC_Application/LibreVNA-GUI/preferences.h index 18054a5..ac70402 100644 --- a/Software/PC_Application/LibreVNA-GUI/preferences.h +++ b/Software/PC_Application/LibreVNA-GUI/preferences.h @@ -165,6 +165,7 @@ public: bool interpolatePoints; MarkerSortOrder sortOrder; MarkerSymbolStyle symbolStyle; + bool clipToYAxis; } Marker; struct { bool enabled; @@ -304,6 +305,7 @@ private: {&Marker.interpolatePoints, "Marker.interpolatePoints", false}, {&Marker.sortOrder, "Marker.sortOrder", MarkerSortOrder::PrefMarkerSortXCoord}, {&Marker.symbolStyle, "Marker.symbolStyle", MarkerSymbolStyle::FilledNumberAbove}, + {&Marker.clipToYAxis, "Marker.clipToYAxis", true}, {&SCPIServer.enabled, "SCPIServer.enabled", true}, {&SCPIServer.port, "SCPIServer.port", 19542}, {&StreamingServers.VNARawData.enabled, "StreamingServers.VNARawData.enabled", false}, diff --git a/Software/PC_Application/LibreVNA-GUI/preferencesdialog.ui b/Software/PC_Application/LibreVNA-GUI/preferencesdialog.ui index 861fcb3..d429bf8 100644 --- a/Software/PC_Application/LibreVNA-GUI/preferencesdialog.ui +++ b/Software/PC_Application/LibreVNA-GUI/preferencesdialog.ui @@ -98,7 +98,7 @@ - 0 + 3 @@ -713,8 +713,8 @@ 0 0 - 564 - 477 + 697 + 563 @@ -1475,9 +1475,9 @@ 0 - 0 + -65 683 - 605 + 628 @@ -1787,6 +1787,20 @@ + + + + Show out-of-range marker at top/bottom: + + + + + + + + + + @@ -1822,8 +1836,8 @@ 0 0 - 697 - 563 + 168 + 127 @@ -2105,8 +2119,8 @@ 0 0 - 697 - 563 + 258 + 241