comparison 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
comparison
equal deleted inserted replaced
1718:65c03d33c345 1719:9a1f79d21a3f
1024 { 1024 {
1025 SetFastDelta(framesCount / 20); 1025 SetFastDelta(framesCount / 20);
1026 UpdatePrefetch(); 1026 UpdatePrefetch();
1027 } 1027 }
1028 1028
1029 size_t GetFramesCount() const
1030 {
1031 return framesCount_;
1032 }
1033
1029 void SetCircularPrefetch(bool isCircularPrefetch) 1034 void SetCircularPrefetch(bool isCircularPrefetch)
1030 { 1035 {
1031 isCircularPrefetch_ = isCircularPrefetch; 1036 isCircularPrefetch_ = isCircularPrefetch;
1032 UpdatePrefetch(); 1037 UpdatePrefetch();
1033 } 1038 }
2276 } 2281 }
2277 } 2282 }
2278 2283
2279 return false; 2284 return false;
2280 } 2285 }
2286
2287
2288 void GoToFirstFrame()
2289 {
2290 if (cursor_.get() != NULL &&
2291 cursor_->GetCurrentIndex() != 0)
2292 {
2293 cursor_->SetCurrentIndex(0);
2294 Redraw();
2295 }
2296 }
2297
2298
2299 void GoToLastFrame()
2300 {
2301 if (cursor_.get() != NULL)
2302 {
2303 size_t last = cursor_->GetFramesCount() - 1;
2304 if (cursor_->GetCurrentIndex() != last)
2305 {
2306 cursor_->SetCurrentIndex(last);
2307 Redraw();
2308 }
2309 }
2310 }
2281 2311
2282 2312
2283 bool GetCurrentFrameOfReferenceUid(std::string& frameOfReferenceUid) const 2313 bool GetCurrentFrameOfReferenceUid(std::string& frameOfReferenceUid) const
2284 { 2314 {
2285 if (cursor_.get() != NULL && 2315 if (cursor_.get() != NULL &&
3195 return 0; 3225 return 0;
3196 } 3226 }
3197 3227
3198 3228
3199 EMSCRIPTEN_KEEPALIVE 3229 EMSCRIPTEN_KEEPALIVE
3230 void GoToFirstFrame(const char* canvas)
3231 {
3232 try
3233 {
3234 GetViewport(canvas)->GoToFirstFrame();
3235 }
3236 EXTERN_CATCH_EXCEPTIONS;
3237 }
3238
3239
3240 EMSCRIPTEN_KEEPALIVE
3241 void GoToLastFrame(const char* canvas)
3242 {
3243 try
3244 {
3245 GetViewport(canvas)->GoToLastFrame();
3246 }
3247 EXTERN_CATCH_EXCEPTIONS;
3248 }
3249
3250
3251 EMSCRIPTEN_KEEPALIVE
3200 void ShowReferenceLines(int show) 3252 void ShowReferenceLines(int show)
3201 { 3253 {
3202 try 3254 try
3203 { 3255 {
3204 showReferenceLines_ = (show != 0); 3256 showReferenceLines_ = (show != 0);