Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
fixes #178
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacZhangzhuo committed Oct 6, 2023
1 parent 8bfd9b3 commit ec071a5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Added `F` key for focusing the selected objects. If no object is selected, it will focus the whole scene geometries.

### Changed
* Changed `sphinx` requirement for the development environment. Otherwise, there will be a bug similar to [this](https://github.com/compas-dev/sphinx_compas_theme/issues/20).
* Bug fixed when pressing `F` multiple times, the camera angle shifts.
* Bug fixed in `Camera.zoom_extents` when one single point is selected.

### Removed

Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ m2r2
nbsphinx
pydocstyle
pytest
sphinx
sphinx == 7.1.2
sphinx_compas_theme >=0.15.18
twine
wheel
Expand Down
6 changes: 3 additions & 3 deletions src/compas_view2/scene/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ def zoom_extents(self, objects: List[Object] = None):
max_corner = extents.max(axis=0)
min_corner = extents.min(axis=0)
center = (max_corner + min_corner) / 2
distance = norm(max_corner - min_corner)
distance = max(norm(max_corner - min_corner), 1)

self.target = center
self.position = center + self.position
self.distance = distance * 1.5
vec = (self.target - self.position) / norm(self.target - self.position)
self.position = self.target - vec * distance * 1.5

0 comments on commit ec071a5

Please sign in to comment.