comparison Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp @ 1576:92fca2b3ba3d

sanitizing the handling of canvas size
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 24 Sep 2020 16:40:30 +0200
parents e4a52cbbdd70
children 1f812f4c95be
comparison
equal deleted inserted replaced
1575:e4a52cbbdd70 1576:92fca2b3ba3d
1464 1464
1465 scene.SetLayer(LAYER_TEXTURE, layer.release()); 1465 scene.SetLayer(LAYER_TEXTURE, layer.release());
1466 1466
1467 if (fitNextContent_) 1467 if (fitNextContent_)
1468 { 1468 {
1469 lock->GetCompositor().RefreshCanvasSize(); 1469 lock->RefreshCanvasSize();
1470 lock->GetCompositor().FitContent(scene); 1470 lock->GetCompositor().FitContent(scene);
1471 fitNextContent_ = false; 1471 fitNextContent_ = false;
1472 } 1472 }
1473 1473
1474 //lock->GetCompositor().Refresh(scene); 1474 //lock->GetCompositor().Refresh(scene);
1748 // This method is used when the layout of the HTML page changes, 1748 // This method is used when the layout of the HTML page changes,
1749 // which does not trigger the "emscripten_set_resize_callback()" 1749 // which does not trigger the "emscripten_set_resize_callback()"
1750 void UpdateSize(bool fitContent) 1750 void UpdateSize(bool fitContent)
1751 { 1751 {
1752 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); 1752 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock());
1753 lock->GetCompositor().RefreshCanvasSize(); 1753 lock->RefreshCanvasSize();
1754 1754
1755 if (fitContent) 1755 if (fitContent)
1756 { 1756 {
1757 lock->GetCompositor().FitContent(lock->GetController().GetScene()); 1757 lock->GetCompositor().FitContent(lock->GetController().GetScene());
1758 } 1758 }