Skip to content

Fix mouse wheel zero division in DICOM preview panel#1292

Open
nikochao wants to merge 2 commits intoinvesalius:masterfrom
nikochao:fix-wheel-zero-division
Open

Fix mouse wheel zero division in DICOM preview panel#1292
nikochao wants to merge 2 commits intoinvesalius:masterfrom
nikochao:fix-wheel-zero-division

Conversation

@nikochao
Copy link
Copy Markdown

This PR fixes a mouse wheel handling issue in the DICOM preview panel.

Problem:

  • The wheel step calculation should use WheelRotation / WheelDelta, not WheelDelta / WheelRotation.
  • Scrolling could trigger a ZeroDivisionError when evt.GetWheelRotation() was 0.

Changes:

  • Reversed the calculation order in the wheel step logic.

Result:

  • Prevents crashes when scrolling in the preview panel.
截圖 2026-03-25 下午5 09 06

@paulojamorim
Copy link
Copy Markdown
Collaborator

Hi @nikochao

Could you format the code with Ruff so it passes the pre-commit checks?

@nikochao
Copy link
Copy Markdown
Author

@paulojamorim
Done, I formatted the code and pushed the update. Thanks!

@paulojamorim
Copy link
Copy Markdown
Collaborator

Could you record a video or describe how to reproduce the error?

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.

2 participants