Mercurial > hg > orthanc-stone
diff Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp @ 1719:9a1f79d21a3f
added buttons to go to the first and last frames
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 01 Dec 2020 10:42:45 +0100 |
parents | 391c798e4dae |
children | b8d19f53aaca |
line wrap: on
line diff
--- a/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp Tue Dec 01 10:21:37 2020 +0100 +++ b/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp Tue Dec 01 10:42:45 2020 +0100 @@ -1026,6 +1026,11 @@ UpdatePrefetch(); } + size_t GetFramesCount() const + { + return framesCount_; + } + void SetCircularPrefetch(bool isCircularPrefetch) { isCircularPrefetch_ = isCircularPrefetch; @@ -2278,6 +2283,31 @@ return false; } + + + void GoToFirstFrame() + { + if (cursor_.get() != NULL && + cursor_->GetCurrentIndex() != 0) + { + cursor_->SetCurrentIndex(0); + Redraw(); + } + } + + + void GoToLastFrame() + { + if (cursor_.get() != NULL) + { + size_t last = cursor_->GetFramesCount() - 1; + if (cursor_->GetCurrentIndex() != last) + { + cursor_->SetCurrentIndex(last); + Redraw(); + } + } + } bool GetCurrentFrameOfReferenceUid(std::string& frameOfReferenceUid) const @@ -3197,6 +3227,28 @@ EMSCRIPTEN_KEEPALIVE + void GoToFirstFrame(const char* canvas) + { + try + { + GetViewport(canvas)->GoToFirstFrame(); + } + EXTERN_CATCH_EXCEPTIONS; + } + + + EMSCRIPTEN_KEEPALIVE + void GoToLastFrame(const char* canvas) + { + try + { + GetViewport(canvas)->GoToLastFrame(); + } + EXTERN_CATCH_EXCEPTIONS; + } + + + EMSCRIPTEN_KEEPALIVE void ShowReferenceLines(int show) { try