|
| 1 | +import { call, take, takeEvery, takeLatest } from "typed-redux-saga"; |
| 2 | +import { sum } from "lodash"; |
1 | 3 | import type { Saga } from "oxalis/model/sagas/effect-generators";
|
2 | 4 | import { select } from "oxalis/model/sagas/effect-generators";
|
3 |
| -import { call, take, takeEvery, takeLatest } from "typed-redux-saga"; |
| 5 | + |
4 | 6 | import { sleep } from "libs/utils";
|
5 |
| -import { getEnabledLayers } from "oxalis/model/accessors/dataset_accessor"; |
6 | 7 | import Toast from "libs/toast";
|
7 | 8 | import messages from "messages";
|
| 9 | +import { getEnabledLayers } from "../accessors/dataset_accessor"; |
8 | 10 | import { getCurrentResolution } from "../accessors/flycam_accessor";
|
| 11 | +import { getViewportExtents } from "../accessors/view_mode_accessor"; |
| 12 | + |
9 | 13 | export function* watchMaximumRenderableLayers(): Saga<void> {
|
10 | 14 | function* warnMaybe(): Saga<void> {
|
11 | 15 | const maximumLayerCountToRender = yield* select(
|
@@ -50,9 +54,17 @@ export function* watchZ1Downsampling(): Saga<void> {
|
50 | 54 | const minVoxelPerPixel = 0.1;
|
51 | 55 | if (!userClosedWarning) {
|
52 | 56 | // 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 | + |
53 | 63 | 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 | + |
56 | 68 | if (showWarning) {
|
57 | 69 | Toast.warning(messages["dataset.z1_downsampling_hint"], {
|
58 | 70 | sticky: true,
|
|
0 commit comments