Check if plot is in drawing range.

This commit is contained in:
Bartosz Taudul 2022-09-03 21:46:00 +02:00
parent 0e94ed8fc6
commit 3780c47bb6
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -23,12 +23,13 @@ bool View::DrawPlot( PlotData& plot, double pxns, int& offset, const ImVec2& wpo
const auto nspx = 1.0 / pxns; const auto nspx = 1.0 / pxns;
const auto dpos = wpos + ImVec2( 0.5f, 0.5f ); const auto dpos = wpos + ImVec2( 0.5f, 0.5f );
auto& vec = plot.data;
vec.ensure_sorted();
if( vec.front().time.Val() > m_vd.zvEnd || vec.back().time.Val() < m_vd.zvStart ) return false;
auto yPos = wpos.y + offset; auto yPos = wpos.y + offset;
if( yPos + PlotHeight >= yMin && yPos <= yMax ) if( yPos + PlotHeight >= yMin && yPos <= yMax )
{ {
auto& vec = plot.data;
vec.ensure_sorted();
const auto color = GetPlotColor( plot, m_worker ); const auto color = GetPlotColor( plot, m_worker );
const auto bg = 0x22000000 | ( DarkenColorMore( color ) & 0xFFFFFF ); const auto bg = 0x22000000 | ( DarkenColorMore( color ) & 0xFFFFFF );
const auto fill = 0x22000000 | ( DarkenColor( color ) & 0xFFFFFF ); const auto fill = 0x22000000 | ( DarkenColor( color ) & 0xFFFFFF );