Replies: 2 comments 9 replies
-
Digging in a little bit - I think I see the culprit, in the private function of "recenter" in the /src/three-components/SmoothControls.ts I see this starting at line 630 of the current master branch:
It's that last line of userAdjustOrbit 0, 0, 1 Which in my opinion, it should again not be going all the way out to the max, it should be going back to the initial value, or at the very least, allow that value to be overridden or defined more explicitly. It just feels like this is not fully baked, or at least not well defined behavior that is not intuitive. Am I off base with this assessment? |
Beta Was this translation helpful? Give feedback.
-
@rmhall Is there a way to fix this issue by ourselves or should we wait for an official update? I'm using this for a personal project and the interaction with the pan enabled makes it very confusing for the user experience. The simplest way would be to do nothing if the user clicks outside, even that is better than the 3D model jumping around. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Scenario:
Using the latest release of 1.12.0
enable-pan is enabled, camera-target and camera-orbit are both set to "auto auto auto", field-of-view is set to "45deg". Model loads and the user interacts with it, pans the model around using shift-click-drag, and/or zooms in and out using the mouseweel or keyboard changing the field-of-view. They then click off the model, and the model as expected returns back to the default center and the field-of-view is reset to the "45deg" value that was originally set.
If min-field-of-view is used, the behavior remains the same and function as expected, just constraining the minimum field-of-view value for there mouse wheel zoom, and when clicking off the model, center point is returned, and the field-of-view returns back to 45deg.
However, if max-field-of-view is used (by itself or with the min-field-of-view), to permit for larger zoom outs, like 180deg, when a user then clicks off the model, instead of returning the field-of-view back to the initial value of 45deg as specified, the field-of-view is instead set to the max-field-of-view of 180deg. If the max-field-of-view is set to a large value like 90 - this happens in a single click and then it zooms out to 90. If the value is set to an even larger value like 180deg, it sometimes takes 2 clicks, which is also confusing.
What is equally odd, is that in this same scenario even if you have not panned the model yet, and just click outside of it, the field-of-view values are also not reset to the default 45deg (they should be ignored because you should already be at that default FOV), but again when max-field-of-view is set, its used to transform to the field-of-view value instead of the default. This feels like it should be completely ignored if the model is already centered and no longer panned or has never been panned or interacted with yet.
In either scenario, it doesn't seem like the correct behavior and does not correspond to this statement about enable-pan:
"Tapping on the model focuses on that point, while tapping off the model zooms back to the original framing." Which is noted here: https://modelviewer.dev/docs/#entrydocs-stagingandcameras-attributes-enablePan
To me, original framing means the initial field-of-view value (along with other initial values), so it should not be using the max-field-of-view, and instead the specifically set default field-of-view value should be used. The mix/max field-of-view values, should be just that, the outer constraints to control the mouse wheel or programatic control over the model, and should not override the default field of view.
This seems like a bug, or at the least unexpected behavior if that was the intention. If it is intentional, I'd like to understand the logic and also is there an easy way to override this behavior to still allow panning, but to override the results of the "click off the model" trigger, so that it will either honor the original field-of-view value and ignore the max-field-of-view value, or is there an event for that click we can subscribe to and override directly? Or could there be an additional property to define the specific FOV value that should be applied when clicking off the model if enable-pan is used? It truly seems like this is unexpected behavior currently.
I would settle for the expected behavior to be that it honors the default field-of-view value and ignores the max-field-of-view, but it might be even more valuable to have an event and a way to override that "click off the model" that resets the pan center/position and camera orbit.
Beta Was this translation helpful? Give feedback.
All reactions