Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent mag warning from showing in 3D viewport #6412

Merged
merged 6 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 16 additions & 4 deletions frontend/javascripts/oxalis/model/sagas/dataset_saga.ts
Original file line number Diff line number Diff line change
@@ -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<void> {
function* warnMaybe(): Saga<void> {
const maximumLayerCountToRender = yield* select(
Expand Down Expand Up @@ -50,9 +54,17 @@ export function* watchZ1Downsampling(): Saga<void> {
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,
Expand Down