Skip to content

Conversation

MichaelBuessemeyer
Copy link
Contributor

@MichaelBuessemeyer MichaelBuessemeyer commented Jul 17, 2025

The d/f switching / dynamic space direction got wonky since rotating the viewports is allowed (see #8614). It impacted the moving via alt+mouse to move in wrong directions. Therefore, this PR disables the dynamic space direction to be only used / applied when using the acutal d/f short cuts. The other possibilities should not be affected by d/f switching anymore.

URL of deployed dev instance (used for testing):

  • https://___.webknossos.xyz

Steps to test:

  • do the same on master as well as on this branch
  • Open an annotation.
  • Brush in z layer X
  • Brush in z layer x-5 or so (should be smaller than before, to cause the "flipping")
  • Turn on d/f switching in the left settings drawer
  • move via alt + mouse. On master this should not move as expected. On this branch, this should be fixed

Issues:

  • verbally reported bug

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

  • Added changelog entry (create a $PR_NUMBER.md file in unreleased_changes or use ./tools/create-changelog-entry.py)

Copy link
Contributor

coderabbitai bot commented Jul 17, 2025

📝 Walkthrough

Walkthrough

A new boolean parameter, useDynamicSpaceDirection, was introduced and threaded through several movement-related functions and actions in the frontend viewer codebase. This flag selectively controls whether dynamic space direction adjustments are applied during movement handling, affecting both action creators and reducers, as well as movement handler logic and keybindings.

Changes

Files/Paths Change Summary
.../controller/combinations/move_handlers.ts Added useDynamicSpaceDirection parameter to moveW function and passed it to dispatched actions.
.../controller/viewmodes/plane_controller.tsx Updated createDelayAwareMoveHandler to accept/use new flag; updated keybindings to pass the flag.
.../model/actions/flycam_actions.ts Added optional useDynamicSpaceDirection parameter to two action creators and action payloads.
.../model/reducers/flycam_reducer.ts Modified reducer logic to conditionally apply space direction based on new flag in actions.
unreleased_changes/8786.md Adjusted d/f switching setting to only affect keyboard shortcut movements, not others.
.../test/reducers/flycam_reducer.spec.ts Extended tests to verify movement behavior with and without useDynamicSpaceDirection flag.

Poem

🐇
In fields of code where vectors roam,
A bunny hops through space and home.
With flags that guide direction’s fate,
Movements now can contemplate—
Should I twist or glide straight through?
Dynamic or static, the choice is new!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4bee840 and f04a366.

📒 Files selected for processing (1)
  • frontend/javascripts/test/reducers/flycam_reducer.spec.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
frontend/javascripts/test/reducers/flycam_reducer.spec.ts (1)
Learnt from: dieknolle3333
PR: scalableminds/webknossos#8168
File: frontend/javascripts/oxalis/geometries/materials/plane_material_factory.ts:568-585
Timestamp: 2024-11-22T17:18:43.411Z
Learning: In the file `frontend/javascripts/oxalis/geometries/materials/plane_material_factory.ts`, the uniform name `allResolutions` should remain unchanged to maintain consistency with the shader code.
🧬 Code Graph Analysis (1)
frontend/javascripts/test/reducers/flycam_reducer.spec.ts (3)
frontend/javascripts/viewer/model/actions/flycam_actions.ts (1)
  • FlycamActions (39-56)
frontend/javascripts/viewer/model/accessors/flycam_accessor.ts (1)
  • getPosition (370-370)
frontend/javascripts/test/fixtures/volumetracing_object.ts (1)
  • initialState (123-126)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build-smoketest-push
  • GitHub Check: backend-tests
  • GitHub Check: frontend-tests
🔇 Additional comments (4)
frontend/javascripts/test/reducers/flycam_reducer.spec.ts (4)

166-166: Good addition of explicit parameter for dynamic space direction.

The test now explicitly passes true for useDynamicSpaceDirection, making it clear that this test case is specifically testing the dynamic space direction behavior.


171-178: Well-designed test case for default behavior.

This new test case correctly verifies that when useDynamicSpaceDirection is not explicitly set (defaults to false), the movement does not apply the dynamic space direction transformation. The expected position [2, 0, 2] (without direction inversion) vs [2, 0, -2] (with direction inversion) clearly demonstrates the different behavior.


214-214: Correct parameter addition for plane movement test.

The test now explicitly passes true for useDynamicSpaceDirection, maintaining consistency with the other dynamic space direction test cases.


219-226: Excellent test coverage for plane movement default behavior.

This new test case properly validates that movePlaneFlycamOrthoAction without explicit useDynamicSpaceDirection parameter behaves differently from the version with the parameter set to true. The expected position [0, 0, 2] (without direction transformation) vs [0, 0, -2] (with direction transformation) clearly demonstrates the intended behavior change.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@MichaelBuessemeyer
Copy link
Contributor Author

MichaelBuessemeyer commented Jul 17, 2025

The fix can be summarized as: I added useDynamicSpaceDirection as a property to the two relevant actions, which are dispatched by the d/f keyboard shortcut. All other sources of such actions have automatically useDynamicSpaceDirection=false

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.

lgtm 👍

@MichaelBuessemeyer MichaelBuessemeyer enabled auto-merge (squash) July 18, 2025 08:49
@MichaelBuessemeyer MichaelBuessemeyer merged commit 6b96fe2 into master Jul 18, 2025
5 checks passed
@MichaelBuessemeyer MichaelBuessemeyer deleted the fix-mouse-move-df-switching branch July 18, 2025 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants