From 3a025908b2bd3b8d25b228ec14ad41b111ed21c8 Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Thu, 14 Jan 2016 14:24:32 +0100 Subject: Scatterplot: changed internal handling of update()s. --- scatterplot.cpp | 34 +++++++++++++++------------------- scatterplot.h | 3 --- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/scatterplot.cpp b/scatterplot.cpp index fae97e3..4a26eed 100644 --- a/scatterplot.cpp +++ b/scatterplot.cpp @@ -10,7 +10,7 @@ static const qreal GLYPH_OPACITY_SELECTED = 1.0; static const QColor OUTLINE_COLOR(0, 0, 0); static const QColor SELECTION_COLOR(128, 128, 128, 96); -static const int GLYPH_SIZE = 4.0f; +static const int GLYPH_SIZE = 8.0f; static const float PADDING = 10.0f; Scatterplot::Scatterplot(QQuickItem *parent) @@ -35,7 +35,7 @@ void Scatterplot::setColorScale(ColorScale *colorScale) m_colorScale = colorScale; if (m_colorData.n_elem > 0) { - updateMaterials(); + m_shouldUpdateMaterials = true; } } @@ -76,8 +76,10 @@ void Scatterplot::setXY(const arma::mat &xy, bool updateView) setOpacityData(opacityData, false); } + m_shouldUpdateGeometry = true; + if (updateView) { - updateGeometry(); + update(); } } @@ -95,8 +97,10 @@ void Scatterplot::setColorData(const arma::vec &colorData, bool updateView) m_colorData = colorData; emit colorDataChanged(m_colorData); + m_shouldUpdateMaterials = true; + if (updateView) { - updateMaterials(); + update(); } } @@ -138,8 +142,10 @@ void Scatterplot::setScale(const LinearScale &sx, const LinearScalelocalPos(); - updateGeometry(); + m_shouldUpdateGeometry = true; + update(); break; case INTERACTION_SELECTED: event->ignore(); @@ -433,7 +428,8 @@ void Scatterplot::mouseReleaseEvent(QMouseEvent *event) case INTERACTION_MOVING: m_currentInteractionState = INTERACTION_SELECTED; applyManipulation(); - updateGeometry(); + m_shouldUpdateGeometry = true; + update(); m_dragOriginPos = m_dragCurrentPos; break; case INTERACTION_NONE: diff --git a/scatterplot.h b/scatterplot.h index 7649a3f..6510c54 100644 --- a/scatterplot.h +++ b/scatterplot.h @@ -56,9 +56,6 @@ private: void applyManipulation(); - void updateGeometry(); - void updateMaterials(); - void updateSplat(QSGNode *node); void updateGlyphs(QSGNode *node); -- cgit v1.2.3