Skip to content

Commit fedc337

Browse files
authored
Prevent mag warning from showing in 3D viewport (#6412)
* fixed warning toast whn in fullscreen 3D viewport * updated changelog * fix CI * apply pr feedback * linting
1 parent 675f7ef commit fedc337

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

CHANGELOG.unreleased.md

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
4646
- Fixed a regression which caused that uint16 and uint8 segmentations could not be rendered. [#6406](https://github.com/scalableminds/webknossos/pull/6406)
4747
- 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)
4848
- 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)
49+
- 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)
50+
4951

5052

5153
### Removed

frontend/javascripts/oxalis/model/sagas/dataset_saga.ts

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
import { call, take, takeEvery, takeLatest } from "typed-redux-saga";
2+
import { sum } from "lodash";
13
import type { Saga } from "oxalis/model/sagas/effect-generators";
24
import { select } from "oxalis/model/sagas/effect-generators";
3-
import { call, take, takeEvery, takeLatest } from "typed-redux-saga";
5+
46
import { sleep } from "libs/utils";
5-
import { getEnabledLayers } from "oxalis/model/accessors/dataset_accessor";
67
import Toast from "libs/toast";
78
import messages from "messages";
9+
import { getEnabledLayers } from "../accessors/dataset_accessor";
810
import { getCurrentResolution } from "../accessors/flycam_accessor";
11+
import { getViewportExtents } from "../accessors/view_mode_accessor";
12+
913
export function* watchMaximumRenderableLayers(): Saga<void> {
1014
function* warnMaybe(): Saga<void> {
1115
const maximumLayerCountToRender = yield* select(
@@ -50,9 +54,17 @@ export function* watchZ1Downsampling(): Saga<void> {
5054
const minVoxelPerPixel = 0.1;
5155
if (!userClosedWarning) {
5256
// checking only the downsampled dimensions x and y
57+
const extents = yield* select((state) => getViewportExtents(state));
58+
const areas = [extents.PLANE_XY, extents.PLANE_YZ, extents.PLANE_XZ].map(
59+
([width, height]) => width * height,
60+
);
61+
const areDataviewportsInvisible = sum(areas) === 0;
62+
5363
const showWarning =
54-
currentZoomStep / currentRes[0] < minVoxelPerPixel ||
55-
currentZoomStep / currentRes[1] < minVoxelPerPixel;
64+
(currentZoomStep / currentRes[0] < minVoxelPerPixel ||
65+
currentZoomStep / currentRes[1] < minVoxelPerPixel) &&
66+
!areDataviewportsInvisible;
67+
5668
if (showWarning) {
5769
Toast.warning(messages["dataset.z1_downsampling_hint"], {
5870
sticky: true,

0 commit comments

Comments
 (0)