Avoid recentering viewport if the bounding box is max size 0, as noticed by @jreinam

This commit is contained in:
Joseph Lenox 2016-11-27 11:34:38 -06:00
parent d47f6d30af
commit d398c27e1f

View File

@ -370,12 +370,15 @@ sub zoom_to_bounding_box {
# bounding box
my $max_size = max(@{$bb->size}) * 2;
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
$self->_camera_target($bb->center);
$self->on_viewport_changed->() if $self->on_viewport_changed;
}
}
sub zoom_to_bed {