Skip to content
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

Fix large / unexpected camera movements #502

Merged
merged 3 commits into from
Nov 16, 2022
Merged

Conversation

iche033
Copy link
Contributor

@iche033 iche033 commented Nov 11, 2022

Signed-off-by: Ian Chen ichen@osrfoundation.org

🦟 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. The Interactive 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.

missing_mouse_events

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 the Interactive View Control always handles mouse press events.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

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.

Signed-off-by: Ian Chen <ichen@osrfoundation.org>
@github-actions github-actions bot added the 🏯 fortress Ignition Fortress label Nov 11, 2022
Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linters

Signed-off-by: Ian Chen <ichen@osrfoundation.org>
@iche033
Copy link
Contributor Author

iche033 commented Nov 11, 2022

linters

fixed. 23d8993

@codecov
Copy link

codecov bot commented Nov 11, 2022

Codecov Report

Merging #502 (f68805b) into ign-gui6 (cdbd53c) will decrease coverage by 0.50%.
The diff coverage is 8.33%.

@@             Coverage Diff              @@
##           ign-gui6     #502      +/-   ##
============================================
- Coverage     67.46%   66.95%   -0.51%     
============================================
  Files            39       39              
  Lines          5286     5290       +4     
============================================
- Hits           3566     3542      -24     
- Misses         1720     1748      +28     
Impacted Files Coverage Δ
...interactive_view_control/InteractiveViewControl.cc 15.51% <0.00%> (-0.37%) ⬇️
src/plugins/minimal_scene/MinimalScene.cc 60.00% <15.38%> (-4.65%) ⬇️
src/plugins/scene3d/Scene3D.cc 49.87% <0.00%> (+0.25%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Contributor

@nkoenig nkoenig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had just one questions. Otherwise, works great.

Signed-off-by: Ian Chen <ichen@osrfoundation.org>
@iche033 iche033 merged commit e6d45da into ign-gui6 Nov 16, 2022
@iche033 iche033 deleted the view_control_mouse_events branch November 16, 2022 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏯 fortress Ignition Fortress
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants