Fix large / unexpected camera movements #502
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Ian Chen [email protected]
🦟 Bug fix
Related issue: gazebosim/gz-sim#1085
Summary
Fixes large / unexpected camera movement when orbiting / panning due to missing mouse events.
More info:
The
Minimal Scene
is responsible for propagating all mouse events to other GUI plugins. However, mouse events were continuously overriden by the latest ones before they can be propagated / processed. This causes important events like a mouse press to be lost. TheInteractive View Control
relies on mouse press pos to determine the anchor point for camera orbiting and panning, so if it misses a mouse press pos, it justs uses the last anchor point for camera movements. When the anchor point is far away, it causes large camera jumps.This gif shows the problem. The first pan motion successfully sets the anchor point (yellow ellipsoid). Subsequent camera orbit and pan motions miss the mouse press events and thus they still use the old anchor point that's on top of the red box.
This PRs fixes the issue by storing mouse events in a list in
Minimal Scene
instead of just the latest event, and makes sure that theInteractive View Control
always handles mouse press events.Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.