Mercurial > hg > orthanc-stone
diff Samples/Common/RtViewerView.cpp @ 1406:5d7ee14dc1eb
Mouse wheel handler is now OK in SDL and Wasm
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Thu, 30 Apr 2020 00:25:55 +0200 |
parents | 3e644f6fadd4 |
children | 8635b333fa5b |
line wrap: on
line diff
--- a/Samples/Common/RtViewerView.cpp Wed Apr 29 22:06:58 2020 +0200 +++ b/Samples/Common/RtViewerView.cpp Thu Apr 30 00:25:55 2020 +0200 @@ -171,6 +171,35 @@ lock->Invalidate(); } + void RtViewerView::Scroll(int delta) + { + if (!planes_.empty()) + { + int next = 0; + int temp = static_cast<int>(currentPlane_) + delta; + + if (temp < 0) + { + next = 0; + } + else if (temp >= static_cast<int>(planes_.size())) + { + next = static_cast<unsigned int>(planes_.size()) - 1; + } + else + { + next = static_cast<size_t>(temp); + } + LOG(INFO) << "RtViewerView::Scroll(" << delta << ") --> slice is now = " << next; + + if (next != currentPlane_) + { + currentPlane_ = next; + UpdateLayers(); + } + } + } + void RtViewerView::RetrieveGeometry() { const VolumeImageGeometry& geometry = GetApp()->GetMainGeometry();