mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 12:25:54 +08:00
Avoid recentering viewport if the bounding box is max size 0, as noticed by @jreinam
This commit is contained in:
parent
d47f6d30af
commit
d398c27e1f
@ -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);
|
||||
$self->_zoom($min_viewport_size / $max_size);
|
||||
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);
|
||||
# center view around bounding box center
|
||||
$self->_camera_target($bb->center);
|
||||
|
||||
$self->on_viewport_changed->() if $self->on_viewport_changed;
|
||||
$self->on_viewport_changed->() if $self->on_viewport_changed;
|
||||
}
|
||||
}
|
||||
|
||||
sub zoom_to_bed {
|
||||
|
Loading…
x
Reference in New Issue
Block a user