Repository navigation
Fix slow vertical rotation in the Sphinx viewer on tall pages - #2124
Merged
adam-urbanczyk merged 1 commit intoNov 6, 2026
Merged
Conversation
The interactor was bound to document.body and vtk.js scales mouse positions by the size of the bound element, so on pages where the body is taller than the window vertical drags were shrunk. Bind to an object that listens on the body but reports the canvas size.
shimwell
added a commit
to fusion-energy/paramak
that referenced
this pull request
Nov 4, 2026
* Fix mouse rotation in the interactive docs viewer The CadQuery viewer binds the vtk.js interactor to document.body, which on long pages shrinks vertical drags so up and down rotation was very slow. cq_viewer.js binds to an object that reports the canvas size (to be removed once a CadQuery release includes CadQuery/cadquery#2124) and makes rotation the same angle per pixel in both directions. * Show the mouse controls as hover text on the interactive docs views
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2124 +/- ##
=======================================
Coverage 95.81% 95.81%
=======================================
Files 30 30
Lines 9605 9605
Branches 1443 1443
=======================================
Hits 9203 9203
Misses 247 247
Partials 155 155 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
|
Seems to be working fine, docs related so merging. |
shimwell
added a commit
to fusion-energy/paramak
that referenced
this pull request
Nov 6, 2026
CadQuery/cadquery#2124 is merged, so the docs install CadQuery from the main branch until it is in a release and cq_viewer.js no longer rebinds the interactor.
shimwell
added a commit
to fusion-energy/paramak
that referenced
this pull request
Nov 6, 2026
) CadQuery/cadquery#2124 is merged, so the docs install CadQuery from the main branch until it is in a release and cq_viewer.js no longer rebinds the interactor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rotating a model in the
cadquerySphinx directive by dragging up and down is very slow on long pages with some themes (I hit it with pydata_sphinx_theme). Left and right is fine.The interactor is bound to
document.body, and vtk.js scales mouse positions by the size of the element it is bound to. The canvas is window sized but the body can be the full page height, so vertical movement gets shrunk by page height / window height. The CadQuery docs theme keeps the body window sized, which is why it doesn't show up there.This binds the interactor to a small object that still listens on the body but reports the canvas size.
On a ~26800 px tall page, a 200 px vertical drag rotated 2.7 deg before and 80 deg after, the same as on the CadQuery docs.
this is also visible when trying to rotate images in the older versions of the paramak docs