Skip to content

Commit

Permalink
dynamic pan delta
Browse files Browse the repository at this point in the history
  • Loading branch information
Licini committed Aug 15, 2024
1 parent f9ad50f commit f2653d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* Fixed `GroupObject` `pointcolor` not found error with impliment `exclude_type_list`.
* Fixed `Tag` inconsistent height issue.
* Dynamically adjust camera pan delta based on distacne.

### Removed

Expand Down
3 changes: 2 additions & 1 deletion src/compas_viewer/renderer/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@ def pan(self, dx: float, dy: float):
with each increment the size of :attr:`Camera.pan_delta`.
"""
R = Rotation.from_euler_angles(self.rotation)
T = Translation.from_vector([-dx * self.pandelta * self.scale, dy * self.pandelta * self.scale, 0])
scaled_pandelta = self.pandelta * self.distance / 10
T = Translation.from_vector([-dx * scaled_pandelta, dy * scaled_pandelta, 0])
M = (R * T).matrix
vector = [M[i][3] for i in range(3)]
self.target += vector
Expand Down

0 comments on commit f2653d4

Please sign in to comment.