Skip to content

Commit

Permalink
Fixed issue where fit to bounds would be lost when changing document (#…
Browse files Browse the repository at this point in the history
…564)

This issue doesn't affect vpype per se as documents are never changed during the lifetime of a viewer, but it does affect vsketch in cases where sketches change their own page size (e.g. the `quick_draw` example.

Fixes #458
  • Loading branch information
abey79 authored Oct 16, 2022
1 parent 5a3b403 commit fe70ed4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Release date: UNRELEASED
### Bug fixes

* Fixed a viewer issue where page width/height of 0 would lead to errors and a blank display (#555)
* Fixed a viewer issue where fitting the document bounds would be lost when bounds change (*vsketch* only) (#564)

### API changes

Expand Down
12 changes: 6 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions vpype_viewer/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ def document(self) -> vp.Document | None:
def document(self, document: vp.Document | None) -> None:
self._document = document
self._layer_visibility.clear()

# keep fitted to the viewport
if self._fit_to_viewport_flag:
self.fit_to_viewport()

self._update()

@property
Expand Down

0 comments on commit fe70ed4

Please sign in to comment.