diff options
author | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-04-09 08:42:18 +0300 |
---|---|---|
committer | Mika Salmela <mika.salmela@digia.com> | 2013-04-09 09:51:02 +0300 |
commit | a9955a6afa7ddf208a06f5b7b4bb596346ae7d7b (patch) | |
tree | 2f381a0ab696193d67052404f77b7a46ea9c91d8 /src | |
parent | a5aa4f957579636caf6e0e78e5bbc54848a1e13f (diff) |
Keep selection highlighted in overview when zoomed
Change-Id: Ib5129ad1807e5b5362e63c0f5d7c25eed58e3292
Change-Id: Ib5129ad1807e5b5362e63c0f5d7c25eed58e3292
Reviewed-by: Mika Salmela <mika.salmela@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/datavis3d/engine/q3dbars.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/datavis3d/engine/q3dbars.cpp b/src/datavis3d/engine/q3dbars.cpp index b1f0c895..39189057 100644 --- a/src/datavis3d/engine/q3dbars.cpp +++ b/src/datavis3d/engine/q3dbars.cpp @@ -669,7 +669,7 @@ void Q3DBars::drawScene() QVector3D barColor = baseColor + heightColor + depthColor; float lightStrength = d_ptr->m_lightStrength; - if (!d_ptr->m_zoomActivated && d_ptr->m_selectionMode > None) { + if (d_ptr->m_selectionMode > None) { Q3DBarsPrivate::SelectionType selectionType = d_ptr->isSelected(row, bar , selection); switch (selectionType) { @@ -682,12 +682,14 @@ void Q3DBars::drawScene() // qDebug() << "object position:" << modelMatrix.column(3).toVector3D(); //} // Insert data to QDataItem. We have no ownership, don't delete the previous one - d_ptr->m_selectedBar = item; - d_ptr->m_selectedBar->d_ptr->setPosition(d_ptr->m_mousePos); - barSelectionFound = true; - if (d_ptr->m_selectionMode >= ZoomRow) { - item->d_ptr->setTranslation(modelMatrix.column(3).toVector3D()); - d_ptr->m_zoomSelection->addItem(item); + if (!d_ptr->m_zoomActivated) { + d_ptr->m_selectedBar = item; + d_ptr->m_selectedBar->d_ptr->setPosition(d_ptr->m_mousePos); + barSelectionFound = true; + if (d_ptr->m_selectionMode >= ZoomRow) { + item->d_ptr->setTranslation(modelMatrix.column(3).toVector3D()); + d_ptr->m_zoomSelection->addItem(item); + } } break; } @@ -696,7 +698,7 @@ void Q3DBars::drawScene() // Current bar is on the same row as the selected bar barColor = Utils::vectorFromColor(d_ptr->m_highlightRowColor); lightStrength = d_ptr->m_highlightLightStrength; - if (ZoomRow == d_ptr->m_selectionMode) { + if (!d_ptr->m_zoomActivated && ZoomRow == d_ptr->m_selectionMode) { item->d_ptr->setTranslation(modelMatrix.column(3).toVector3D()); d_ptr->m_zoomSelection->addItem(item); } @@ -707,7 +709,7 @@ void Q3DBars::drawScene() // Current bar is on the same column as the selected bar barColor = Utils::vectorFromColor(d_ptr->m_highlightColumnColor); lightStrength = d_ptr->m_highlightLightStrength; - if (ZoomColumn == d_ptr->m_selectionMode) { + if (!d_ptr->m_zoomActivated && ZoomColumn == d_ptr->m_selectionMode) { item->d_ptr->setTranslation(modelMatrix.column(3).toVector3D()); d_ptr->m_zoomSelection->addItem(item); } @@ -793,7 +795,7 @@ void Q3DBars::mousePressEvent(QMouseEvent *event) //qDebug() << "mouse button pressed" << event->button(); if (Qt::LeftButton == event->button()) { if (d_ptr->m_zoomActivated) { - qDebug() << event->pos().x() << event->pos().y() << d_ptr->m_sceneViewPort << d_ptr->m_zoomViewPort; + //qDebug() << event->pos().x() << event->pos().y() << d_ptr->m_sceneViewPort << d_ptr->m_zoomViewPort; if (event->pos().x() <= d_ptr->m_sceneViewPort.width() && event->pos().y() <= d_ptr->m_sceneViewPort.height()) { d_ptr->m_mousePressed = Q3DBarsPrivate::MouseOnOverview; |