diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 553026791c..997431f188 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -29,6 +29,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released - Fixed "Create a new tree group for this file" setting in front-end import when a group id of 0 was used in the NML. [#5573](https://github.com/scalableminds/webknossos/pull/5573) - Fixed a bug that caused a distortion when moving or zooming in the maximized 3d viewport. [#5550](https://github.com/scalableminds/webknossos/pull/5550) - Fixed a bug that prevented focusing the login fields when being prompted to login after trying to view a dataset without being logged in.[#5521](https://github.com/scalableminds/webknossos/pull/5577) +- Fixed that the 3d view content disappeared permanently if the 3d view was resized to not be visible. [#5588](https://github.com/scalableminds/webknossos/pull/5588) ### Removed - diff --git a/frontend/javascripts/oxalis/controller/camera_controller.js b/frontend/javascripts/oxalis/controller/camera_controller.js index 42040389cc..a67fce9b37 100644 --- a/frontend/javascripts/oxalis/controller/camera_controller.js +++ b/frontend/javascripts/oxalis/controller/camera_controller.js @@ -153,13 +153,13 @@ class CameraController extends React.PureComponent { const oldWidth = tdCamera.right - tdCamera.left; const oldHeight = tdCamera.top - tdCamera.bottom; - const oldAspectRatio = oldWidth / oldHeight; const tdRect = inputCatcherRects[OrthoViews.TDView]; - const newAspectRatio = tdRect.width / tdRect.height; - // Do not update the tdCamera if the tdView is not visible (height === 0) - if (Number.isNaN(newAspectRatio)) return; + // Do not update the tdCamera if the tdView is not visible + if (tdRect.height === 0 || tdRect.width === 0) return; + const oldAspectRatio = oldWidth / oldHeight; + const newAspectRatio = tdRect.width / tdRect.height; const newWidth = (oldWidth * newAspectRatio) / oldAspectRatio; tdCamera.left = oldMid - newWidth / 2;