diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 35a5b85d060..93254ac5830 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -46,6 +46,8 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released - Fixed a regression which caused that uint16 and uint8 segmentations could not be rendered. [#6406](https://github.com/scalableminds/webknossos/pull/6406) - Fixed a bug which prevented keyboard shortcuts from taking affect after expanding/collapsing the sidebar panels using the button icons.[#6410](https://github.com/scalableminds/webknossos/pull/6410) - Fixed a bug with the clip histogram button to prevent it from showing a loading spinner forever in some cases. [#6407](https://github.com/scalableminds/webknossos/pull/6407) +- Fixed an issue whereby a warning toast would be triggered every time the 3D viewport is put into fullscreen mode. [#6412](https://github.com/scalableminds/webknossos/pull/6412) + ### Removed diff --git a/frontend/javascripts/oxalis/model/sagas/dataset_saga.ts b/frontend/javascripts/oxalis/model/sagas/dataset_saga.ts index 46d321d6013..8c84fcc42f0 100644 --- a/frontend/javascripts/oxalis/model/sagas/dataset_saga.ts +++ b/frontend/javascripts/oxalis/model/sagas/dataset_saga.ts @@ -1,11 +1,15 @@ +import { call, take, takeEvery, takeLatest } from "typed-redux-saga"; +import { sum } from "lodash"; import type { Saga } from "oxalis/model/sagas/effect-generators"; import { select } from "oxalis/model/sagas/effect-generators"; -import { call, take, takeEvery, takeLatest } from "typed-redux-saga"; + import { sleep } from "libs/utils"; -import { getEnabledLayers } from "oxalis/model/accessors/dataset_accessor"; import Toast from "libs/toast"; import messages from "messages"; +import { getEnabledLayers } from "../accessors/dataset_accessor"; import { getCurrentResolution } from "../accessors/flycam_accessor"; +import { getViewportExtents } from "../accessors/view_mode_accessor"; + export function* watchMaximumRenderableLayers(): Saga { function* warnMaybe(): Saga { const maximumLayerCountToRender = yield* select( @@ -50,9 +54,17 @@ export function* watchZ1Downsampling(): Saga { const minVoxelPerPixel = 0.1; if (!userClosedWarning) { // checking only the downsampled dimensions x and y + const extents = yield* select((state) => getViewportExtents(state)); + const areas = [extents.PLANE_XY, extents.PLANE_YZ, extents.PLANE_XZ].map( + ([width, height]) => width * height, + ); + const areDataviewportsInvisible = sum(areas) === 0; + const showWarning = - currentZoomStep / currentRes[0] < minVoxelPerPixel || - currentZoomStep / currentRes[1] < minVoxelPerPixel; + (currentZoomStep / currentRes[0] < minVoxelPerPixel || + currentZoomStep / currentRes[1] < minVoxelPerPixel) && + !areDataviewportsInvisible; + if (showWarning) { Toast.warning(messages["dataset.z1_downsampling_hint"], { sticky: true,