diff --git a/apps/regression/graph_view.cpp b/apps/regression/graph_view.cpp index c866b19b0..3c95177dd 100644 --- a/apps/regression/graph_view.cpp +++ b/apps/regression/graph_view.cpp @@ -5,7 +5,7 @@ namespace Regression { GraphView::GraphView(Data * data) : - CurveViewWithBanner(data, 0.2f, 0.2f, 0.4f, 0.2f), + CurveViewWithBannerAndCursor(data, 0.2f, 0.2f, 0.4f, 0.2f), m_data(data), m_bannerView(BannerView(data)) { @@ -14,8 +14,9 @@ GraphView::GraphView(Data * data) : void GraphView::reloadSelection() { float pixelXSelection = roundf(floatToPixel(Axis::Horizontal, m_data->xCursorPosition())); float pixelYSelection = roundf(floatToPixel(Axis::Vertical, m_data->yCursorPosition())); - KDRect dirtyZone(KDRect(pixelXSelection - k_dotSize/2, pixelYSelection - k_dotSize/2, k_dotSize, k_dotSize)); + KDRect dirtyZone(KDRect(pixelXSelection - k_dotSize, pixelYSelection - k_dotSize, 2*k_dotSize, 2*k_dotSize)); markRectAsDirty(dirtyZone); + layoutSubviews(); m_bannerView.reload(); } @@ -23,6 +24,7 @@ void GraphView::reload() { markRectAsDirty(bounds()); computeLabels(Axis::Horizontal); computeLabels(Axis::Vertical); + layoutSubviews(); m_bannerView.reload(); } diff --git a/apps/regression/graph_view.h b/apps/regression/graph_view.h index bc7f6e92d..c144fa2f5 100644 --- a/apps/regression/graph_view.h +++ b/apps/regression/graph_view.h @@ -5,18 +5,19 @@ #include "data.h" #include "banner_view.h" #include "../constant.h" -#include "../curve_view_with_banner.h" +#include "../cursor_view.h" +#include "../curve_view_with_banner_and_cursor.h" namespace Regression { -class GraphView : public CurveViewWithBanner { +class GraphView : public CurveViewWithBannerAndCursor { public: GraphView(Data * m_data); void reloadSelection() override; void reload(); void drawRect(KDContext * ctx, KDRect rect) const override; private: - constexpr static KDCoordinate k_dotSize = 4; + constexpr static KDCoordinate k_dotSize = 5; char * label(Axis axis, int index) const override; View * bannerView() override; float evaluateModelWithParameter(Model * curve, float t) const override;