Moving the model should work without a focus point #678
Labels
good first issue
Good for newcomers
type: feature
New features and improvements to existing features
Fornjot's input/graphics code has the concept of a focus point: the point where the mouse cursor touches the model. This focus point is used to process input: If you rotate the model (move the mouse while pressing the left mouse button) while the mouse hovers over it, the model will be rotated around the focus point. When moving the model (move the mouse while pressing the right mouse button), the model is moved such, that the same point always stays under the mouse cursor, making the movement feel very natural.
Unfortunately, moving the model only works, if the mouse is touching the model (i.e. if there is a focus point). This can be quite confusing, if you want to move the model, but aren't currently touching it with the mouse (either by accident, or because you don't know that you need to touch it).
Moving the model should always work. If there is no focus point, a fallback should be used. This has already been done for rotation, and it would make sense to make sure that both moving and rotation use the same mechanism to compute the fallback point (making sure they are always in sync). I believe that rotation is currently using the coordinate system origin (0/0/0) as the fallback point, which is not ideal. I think it would be better, to use the center point of the models bounding volume.
All input code lives in
fj-viewer
. The movement code lives inmovement.rs
. The rotation code lives inrotation.rs
. TheFocusPoint
struct is defined incamera.rs
. Maybe it makes sense to just replace theFocusPoint
struct with a regularPoint<3>
, and set it to the fallback value, if necessary, right where it is computed incamera.rs
.I'm labeling this as https://github.com/hannobraun/Fornjot/labels/good%20first%20issue, as this issue is focused on input code only, and doesn't require much specific knowledge of Fornjot.
The text was updated successfully, but these errors were encountered: