Merge pull request #3591 from lordofhyphens/3589-viewport-divide-by-zero

Avoid recentering viewport if the bounding box is max size 0
This commit is contained in:
Alessandro Ranellucci 2016-12-16 22:02:44 +01:00 committed by GitHub
commit 7472077540

View File

@ -376,6 +376,8 @@ sub zoom_to_bounding_box {
# bounding box
my $max_size = max(@{$bb->size}) * 1.05;
my $min_viewport_size = min($self->GetSizeWH);
if ($max_size != 0) {
# only re-zoom if we have a valid bounding box, avoid a divide by 0 error.
$self->_zoom($min_viewport_size / $max_size);
# center view around bounding box center
@ -383,6 +385,7 @@ sub zoom_to_bounding_box {
$self->on_viewport_changed->() if $self->on_viewport_changed;
}
}
sub zoom_to_bed {
my ($self) = @_;