bs-community / skinview3d

Three.js powered Minecraft skin viewer.
https://skinview3d-demo.vercel.app
MIT License
550 stars 90 forks source link

Disable zoom #126

Closed RSNFreud closed 1 year ago

RSNFreud commented 1 year ago

Is there a way to disable people from zooming in/out? For example set min/max zoom or something

Hacksore commented 1 year ago

You can disable it outright with skinViewer.controls.enableZoom = false.

On the topic of setting zoom ranges seems that maxZoom/minZoom are supported with PerspectiveCamera but I can't get it to work 😅.

https://codesandbox.io/s/skinview3d-zoom-clamp-4she68?file=/src/index.js

Hacksore commented 1 year ago

Oh I reread the docs and it says zoom clamping only works with an OrthographicCamera and this library uses a PerspectiveCamera.

https://github.com/bs-community/skinview3d/blob/52e1ff69e67a1e123ed637ee82fabc0884608bc1/src/viewer.ts#L314

RSNFreud commented 1 year ago

Thanks!