From b7d624feb33826e63df44ec8706ecaca885f7da5 Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Thu, 28 Jan 2016 11:38:50 +0100 Subject: Scatterplot: handle right clicks (clear selection) and absence of color data. --- scatterplot.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scatterplot.cpp b/scatterplot.cpp index d97f83d..7666f28 100644 --- a/scatterplot.cpp +++ b/scatterplot.cpp @@ -545,7 +545,11 @@ void Scatterplot::updateGlyphs(QSGNode *glyphsNode) glyphOutlineNode->markDirty(QSGNode::DirtyMaterial); material = static_cast(glyphNode->material()); - material->setColor(m_colorScale.color(m_colorData[i])); + if (m_colorData.n_elem > 0) { + material->setColor(m_colorScale.color(m_colorData[i])); + } else { + material->setColor(QColor()); + } glyphNode->markDirty(QSGNode::DirtyMaterial); } @@ -615,7 +619,7 @@ void Scatterplot::mouseReleaseEvent(QMouseEvent *event) switch (m_currentInteractionState) { case INTERACTION_NONE: case INTERACTION_SELECTED: - if (m_brushedItem < 0) { + if (m_brushedItem < 0 || event->button() == Qt::RightButton) { // Mouse clicked with no brush target; clear selection, if any m_selection.assign(m_selection.size(), false); m_shouldUpdateMaterials = true; -- cgit v1.2.3