-
Notifications
You must be signed in to change notification settings - Fork 50
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
Auto-resizing or initial zooming/scaling of models doesn't work (for me) #8
Comments
Thanks wejn , I know the auto_zoom is far from perfect. Also, the zoom functionality is opposite from logic - the higher zoom value you set, the farther the model. (I guess I should not call it zoom ...) As to the scale - as long as you don't set the zoom value, it will try to set auto_zoom anyway (even if auto_zoom is false), so the scale won't do nothing here (unless you have another model in scene already). Please let me know if that solve the issue. |
Hi, yes, this works somewhat. Thank you. It's not the best solution for responsive designs (the sizing is different based on device width) but it provides better results. Btw, I think that the problem is non-trivial given the possibility of arbitrary rotation of the model(s) and non-constant aspect ratio. From what I was able to find, there aren't readily re-usable examples using three.js that would solve this general case in a satisfactory fashion. |
For the record, I think I have solved the But I don't know how to backport it to viewstl. So I'm leaving it here, in case you want to take it as inspiration. |
Well done wejn - I'll try to apply your idea on the stlviewer, and will do some tests. |
Applied your code to the new version (1.12) - thank you very much!! |
Hi!
First off, thanks for the viewer. It's such a breeze to use! Even for a newbie like myself.
I have run into a small issue when using it on my website, though: In my opinion the
auto_resize
doesn't work well (for my models anyway) as it leaves a lot of space around the model.And when I tried using
zoom
or per-modelscale
to compensate, then the result was also not what I would expect.Here's a test page to illustrate (at the bottom of it):
https://wejn.org/2000/01/test-page/
(plus here is a snapshot with the
<div>
s emphasised by a border... in case the page misbehaves for you)What I would expect with the default setup is that the model would more or less fill out the entire canvas. And it doesn't.
But that wouldn't be a big deal if I could find a
zoom
or per-modelscale
parameter that would allow me to position/zoom the model properly. Which turned out to be a bit of a challenge so far.So I'm thinking -- am I holding it wrong? Or is there indeed a bug?
Btw, for the interest of readability (because in the page source the json is serialized, thus hard to read), here's the code I'm using to initialize the individual viewers in my Jekyll site:
Think of everything in between the
{% complexstl 16:9 %}
and{% endcomplexstl %}
as the optional init parameters that get passed to theStlViewer
constructor (using a simple scaffold).Btw, the model is: https://wejn.org/assets/2020-12-13-curtain-holder/model-older.stl but there's plenty of other examples in the last few posts on my site (if interested or in need of a few more models).
The text was updated successfully, but these errors were encountered: