comparison Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp @ 1948:d459477804bf

added SetFrame() in Stone Web viewer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 15 Jul 2022 16:17:23 +0200
parents a7a77488ddb1
children 6ffd65cfd2ee c6272d7bb6d9
comparison
equal deleted inserted replaced
1947:31fd7aba48ca 1948:d459477804bf
2858 2858
2859 return false; 2859 return false;
2860 } 2860 }
2861 2861
2862 2862
2863 void SetFrame(unsigned int frameNumber)
2864 {
2865 if (cursor_.get() != NULL &&
2866 frameNumber < cursor_->GetFramesCount() &&
2867 frameNumber != cursor_->GetCurrentIndex())
2868 {
2869 cursor_->SetCurrentIndex(frameNumber);
2870 Redraw();
2871 }
2872 }
2873
2874
2863 void GoToFirstFrame() 2875 void GoToFirstFrame()
2864 { 2876 {
2865 if (cursor_.get() != NULL && 2877 if (cursor_.get() != NULL &&
2866 cursor_->GetCurrentIndex() != 0) 2878 cursor_->GetCurrentIndex() != 0)
2867 { 2879 {
4006 return 0; 4018 return 0;
4007 } 4019 }
4008 4020
4009 4021
4010 EMSCRIPTEN_KEEPALIVE 4022 EMSCRIPTEN_KEEPALIVE
4023 void SetFrame(const char* canvas,
4024 int frameNumber)
4025 {
4026 try
4027 {
4028 if (frameNumber >= 0)
4029 {
4030 GetViewport(canvas)->SetFrame(static_cast<unsigned int>(frameNumber));
4031 }
4032 }
4033 EXTERN_CATCH_EXCEPTIONS;
4034 }
4035
4036
4037 EMSCRIPTEN_KEEPALIVE
4011 void GoToFirstFrame(const char* canvas) 4038 void GoToFirstFrame(const char* canvas)
4012 { 4039 {
4013 try 4040 try
4014 { 4041 {
4015 GetViewport(canvas)->GoToFirstFrame(); 4042 GetViewport(canvas)->GoToFirstFrame();