CadQuery / sphinxcadquery

An extension to visualize CadQuery 3D files in your Sphinx documentation
BSD 3-Clause "New" or "Revised" License
13 stars 4 forks source link

Improve themes support #8

Closed Peque closed 4 years ago

Peque commented 5 years ago

We are currently just patching themes in order to make it work.

Basically we need to set all the backgrounds that are over the canvas as transparent in order to be able to visualize the scenes. If we just push the canvas up (i.e.: with z-index), then it will cover the content (it extends over the full window).

Patching the themes is definitely not the best approach. Themes could change and patches would break. Also, some themes can be affected by the patches. The Read the Docs theme, for example, would lose its "gray" right column, which would become white instead, just like the text/content background.

This could be possibly fixed by using some CSS/z-index/opacity dark magic.

Maybe better, have a look at:

https://threejsfundamentals.org/threejs/lessons/threejs-multiple-scenes.html

In particular, render to an off screen canvas and copy the result to a 2D canvas at each element. If performance is not too bad, it would be worth it.

Peque commented 4 years ago

Maybe this could help as well:

https://threejsfundamentals.org/threejs/lessons/threejs-tips.html#transparent-canvas