diff options
author | madmaxoft <github@xoft.cz> | 2014-10-03 12:33:03 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-10-03 12:33:03 +0200 |
commit | f625b33d56f6a0ce98f03a24bf6cad8b5624ce07 (patch) | |
tree | 5062632160237bcc8e382527bddfb54b4b1b5d45 /Tools/QtBiomeVisualiser/BiomeView.cpp | |
parent | Fix spelling of PRISMRAINE (diff) | |
download | cuberite-f625b33d56f6a0ce98f03a24bf6cad8b5624ce07.tar cuberite-f625b33d56f6a0ce98f03a24bf6cad8b5624ce07.tar.gz cuberite-f625b33d56f6a0ce98f03a24bf6cad8b5624ce07.tar.bz2 cuberite-f625b33d56f6a0ce98f03a24bf6cad8b5624ce07.tar.lz cuberite-f625b33d56f6a0ce98f03a24bf6cad8b5624ce07.tar.xz cuberite-f625b33d56f6a0ce98f03a24bf6cad8b5624ce07.tar.zst cuberite-f625b33d56f6a0ce98f03a24bf6cad8b5624ce07.zip |
Diffstat (limited to 'Tools/QtBiomeVisualiser/BiomeView.cpp')
-rw-r--r-- | Tools/QtBiomeVisualiser/BiomeView.cpp | 78 |
1 files changed, 25 insertions, 53 deletions
diff --git a/Tools/QtBiomeVisualiser/BiomeView.cpp b/Tools/QtBiomeVisualiser/BiomeView.cpp index ce5a870cd..8d53c8626 100644 --- a/Tools/QtBiomeVisualiser/BiomeView.cpp +++ b/Tools/QtBiomeVisualiser/BiomeView.cpp @@ -80,6 +80,27 @@ void BiomeView::setChunkSource(std::shared_ptr<ChunkSource> a_ChunkSource) +void BiomeView::setPosition(int a_BlockX, int a_BlockZ) +{ + m_X = a_BlockX; + m_Z = a_BlockZ; + redraw(); +} + + + + + +void BiomeView::setZoomLevel(double a_ZoomLevel) +{ + m_Zoom = a_ZoomLevel; + redraw(); +} + + + + + void BiomeView::redraw() { if (!hasData()) @@ -307,12 +328,12 @@ void BiomeView::wheelEvent(QWheelEvent * a_Event) m_MouseWheelDelta += a_Event->delta(); while (m_MouseWheelDelta >= DELTA_STEP) { - increaseZoom(); + emit wheelUp(); m_MouseWheelDelta -= DELTA_STEP; } while (m_MouseWheelDelta <= -DELTA_STEP) { - decreaseZoom(); + emit wheelDown(); m_MouseWheelDelta += DELTA_STEP; } } @@ -360,14 +381,14 @@ void BiomeView::keyPressEvent(QKeyEvent * a_Event) case Qt::Key_PageUp: case Qt::Key_Q: { - increaseZoom(); + emit increaseZoom(); break; } case Qt::Key_PageDown: case Qt::Key_E: { - decreaseZoom(); + emit decreaseZoom(); break; } } @@ -376,52 +397,3 @@ void BiomeView::keyPressEvent(QKeyEvent * a_Event) - -void BiomeView::decreaseZoom() -{ - if (m_Zoom > 1.001) - { - m_Zoom--; - if (m_Zoom < 1.0) - { - // Just crossed the 100%, fixate the 100% threshold: - m_Zoom = 1.0; - } - } - else if (m_Zoom > 0.01) - { - m_Zoom = m_Zoom / 2; - } - redraw(); -} - - - - - -void BiomeView::increaseZoom() -{ - if (m_Zoom > 0.99) - { - if (m_Zoom > 20.0) - { - // Zoom too large - return; - } - m_Zoom++; - } - else - { - m_Zoom = m_Zoom * 2; - if (m_Zoom > 1.0) - { - // Just crossed the 100%, fixate the 100% threshold: - m_Zoom = 1.0; - } - } - redraw(); -} - - - - |