comparison 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
comparison
equal deleted inserted replaced
1405:e4fe346c021e 1406:5d7ee14dc1eb
169 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); 169 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock());
170 lock->GetCompositor().FitContent(lock->GetController().GetScene()); 170 lock->GetCompositor().FitContent(lock->GetController().GetScene());
171 lock->Invalidate(); 171 lock->Invalidate();
172 } 172 }
173 173
174 void RtViewerView::Scroll(int delta)
175 {
176 if (!planes_.empty())
177 {
178 int next = 0;
179 int temp = static_cast<int>(currentPlane_) + delta;
180
181 if (temp < 0)
182 {
183 next = 0;
184 }
185 else if (temp >= static_cast<int>(planes_.size()))
186 {
187 next = static_cast<unsigned int>(planes_.size()) - 1;
188 }
189 else
190 {
191 next = static_cast<size_t>(temp);
192 }
193 LOG(INFO) << "RtViewerView::Scroll(" << delta << ") --> slice is now = " << next;
194
195 if (next != currentPlane_)
196 {
197 currentPlane_ = next;
198 UpdateLayers();
199 }
200 }
201 }
202
174 void RtViewerView::RetrieveGeometry() 203 void RtViewerView::RetrieveGeometry()
175 { 204 {
176 const VolumeImageGeometry& geometry = GetApp()->GetMainGeometry(); 205 const VolumeImageGeometry& geometry = GetApp()->GetMainGeometry();
177 206
178 const unsigned int depth = geometry.GetProjectionDepth(projection_); 207 const unsigned int depth = geometry.GetProjectionDepth(projection_);