Mercurial > hg > orthanc-stone
comparison StoneWebViewer/WebAssembly/StoneWebViewer.cpp @ 1534:0443d04416d9
don't discard the windowing altered by mouse
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 07 Aug 2020 21:48:43 +0200 |
parents | d3cafeef07bb |
children | 7b326e5ee97b |
comparison
equal
deleted
inserted
replaced
1533:82279abb92d0 | 1534:0443d04416d9 |
---|---|
1376 unsigned int frame = frames_->GetFrameIndex(index); | 1376 unsigned int frame = frames_->GetFrameIndex(index); |
1377 | 1377 |
1378 FramesCache::Accessor accessor(*cache_, sopInstanceUid, frame); | 1378 FramesCache::Accessor accessor(*cache_, sopInstanceUid, frame); |
1379 if (accessor.IsValid()) | 1379 if (accessor.IsValid()) |
1380 { | 1380 { |
1381 { | |
1382 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); | |
1383 | |
1384 OrthancStone::Scene2D& scene = lock->GetController().GetScene(); | |
1385 | |
1386 // Save the current windowing (that could have been altered by | |
1387 // GrayscaleWindowingSceneTracker), so that it can be reused | |
1388 // by the next frames | |
1389 if (scene.HasLayer(LAYER_TEXTURE) && | |
1390 scene.GetLayer(LAYER_TEXTURE).GetType() == OrthancStone::ISceneLayer::Type_FloatTexture) | |
1391 { | |
1392 OrthancStone::FloatTextureSceneLayer& layer = | |
1393 dynamic_cast<OrthancStone::FloatTextureSceneLayer&>(scene.GetLayer(LAYER_TEXTURE)); | |
1394 layer.GetWindowing(windowingCenter_, windowingWidth_); | |
1395 } | |
1396 } | |
1397 | |
1381 quality = accessor.GetQuality(); | 1398 quality = accessor.GetQuality(); |
1382 | 1399 |
1383 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer; | 1400 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer; |
1384 | 1401 |
1385 switch (accessor.GetImage().GetFormat()) | 1402 switch (accessor.GetImage().GetFormat()) |
1414 return false; | 1431 return false; |
1415 } | 1432 } |
1416 else | 1433 else |
1417 { | 1434 { |
1418 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); | 1435 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); |
1419 lock->GetController().GetScene().SetLayer(LAYER_TEXTURE, layer.release()); | 1436 |
1437 OrthancStone::Scene2D& scene = lock->GetController().GetScene(); | |
1438 | |
1439 scene.SetLayer(LAYER_TEXTURE, layer.release()); | |
1420 | 1440 |
1421 if (fitNextContent_) | 1441 if (fitNextContent_) |
1422 { | 1442 { |
1423 lock->GetCompositor().RefreshCanvasSize(); | 1443 lock->GetCompositor().RefreshCanvasSize(); |
1424 lock->GetCompositor().FitContent(lock->GetController().GetScene()); | 1444 lock->GetCompositor().FitContent(scene); |
1425 fitNextContent_ = false; | 1445 fitNextContent_ = false; |
1426 } | 1446 } |
1427 | 1447 |
1428 //lock->GetCompositor().Refresh(lock->GetController().GetScene()); | 1448 //lock->GetCompositor().Refresh(scene); |
1429 lock->Invalidate(); | 1449 lock->Invalidate(); |
1430 return true; | 1450 return true; |
1431 } | 1451 } |
1432 } | 1452 } |
1433 else | 1453 else |