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

Conversation

hotzenklotz
Copy link
Member

@hotzenklotz hotzenklotz commented Aug 18, 2022

The PR fix a small isse whereby a toast warning would show up every time one opened the 3D viewport fullscreen. The message is about not having apprirate data for the loaded mag and does not really make sense when the 3D viewport is in fullscreen mode.

This PR prevents this message from showing when maximizing the 3D viewport.

URL of deployed dev instance (used for testing):

  • https://___.webknossos.xyz

Steps to test:

  • Maximize 3D viewport
  • Oberserve no more message popping up

Issues:


(Please delete unneeded items, merge only when none are left open)

@hotzenklotz hotzenklotz enabled auto-merge (squash) August 18, 2022 15:46
@hotzenklotz hotzenklotz self-assigned this Aug 18, 2022
@hotzenklotz hotzenklotz changed the title fixed warning toast whn in fullscreen 3D viewport Prevent mag warning from showing in 3D viewport Aug 18, 2022
@@ -50,9 +51,13 @@ export function* watchZ1Downsampling(): Saga<void> {
const minVoxelPerPixel = 0.1;
if (!userClosedWarning) {
// checking only the downsampled dimensions x and y
const is3DViewportFullscreen = yield* select(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the activeViewport is the one that the mouse hovers currently (or most recently). it's not necessarily in fullscreen then. this means that the toast would likely disappear and re-appear when moving the mouse to the 3d viewport and out of it again.
to get the fullscreen info, I'd do something like the following:

const extent_xy = getViewportExtents(state)["PLANE_XY"];
const extent_yz = getViewportExtents(state)["PLANE_YZ"];
...
const areas = [extent_xy, extent_yz, ...].map(([width, height]) => width * height);
const areDataviewportsInvisible = _.sum(areas) == 0;

could be a helper function next to getViewportExtents in view_mode_accessors.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@philippotto I applied your suggestion, please have a look again.

Copy link
Member

@philippotto philippotto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excellent, works well 👍

@hotzenklotz hotzenklotz merged commit fedc337 into master Aug 23, 2022
@hotzenklotz hotzenklotz deleted the fix_3dviewport_message branch August 23, 2022 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Maximizing 3D viewport triggers mag warning
2 participants