diff --git a/profile-widget/diveeventitem.cpp b/profile-widget/diveeventitem.cpp index f756e2f33..b713b01a1 100644 --- a/profile-widget/diveeventitem.cpp +++ b/profile-widget/diveeventitem.cpp @@ -191,8 +191,15 @@ static int depthAtTime(const plot_info &pi, duration_t time) } bool DiveEventItem::isInteresting(const struct dive *d, const struct divecomputer *dc, - const struct event *ev, const plot_info &pi) + const struct event *ev, const plot_info &pi, + int firstSecond, int lastSecond) { + /* + * Ignore items outside of plot range + */ + if (ev->time.seconds < firstSecond || ev->time.seconds >= lastSecond) + return false; + /* * Some gas change events are special. Some dive computers just tell us the initial gas this way. * Don't bother showing those diff --git a/profile-widget/diveeventitem.h b/profile-widget/diveeventitem.h index 82e1773fb..d340f9cb9 100644 --- a/profile-widget/diveeventitem.h +++ b/profile-widget/diveeventitem.h @@ -23,7 +23,8 @@ public: void setHorizontalAxis(DiveCartesianAxis *axis); bool shouldBeHidden(); static bool isInteresting(const struct dive *d, const struct divecomputer *dc, - const struct event *ev, const struct plot_info &pi); + const struct event *ev, const struct plot_info &pi, + int firstSecond, int lastSecond); private: void setupToolTipString(struct gasmix lastgasmix); diff --git a/profile-widget/profilescene.cpp b/profile-widget/profilescene.cpp index ef5541519..8d422a52f 100644 --- a/profile-widget/profilescene.cpp +++ b/profile-widget/profilescene.cpp @@ -487,7 +487,7 @@ void ProfileScene::plotDive(const struct dive *dIn, int dcIn, DivePlannerPointsM continue; } } - if (DiveEventItem::isInteresting(d, currentdc, event, plotInfo)) { + if (DiveEventItem::isInteresting(d, currentdc, event, plotInfo, firstSecond, lastSecond)) { auto item = new DiveEventItem(d, event, lastgasmix, plotInfo, timeAxis, profileYAxis, animSpeed, *pixmaps); item->setZValue(2);