From 2a19931b93e5dbafc53208725c11e50de5614611 Mon Sep 17 00:00:00 2001 From: brunoherbelin Date: Sun, 12 Jul 2020 17:57:31 +0200 Subject: [PATCH] Bugfix recenter empty view --- View.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/View.cpp b/View.cpp index 0ecdb4f..85273be 100644 --- a/View.cpp +++ b/View.cpp @@ -123,6 +123,10 @@ void View::recenter() // restore default view restoreSettings(); + // nothing else if scene is empty + if (scene.ws()->numChildren() < 1) + return; + // calculate screen area visible in the default view GlmToolkit::AxisAlignedBoundingBox view_box; glm::mat4 modelview = GlmToolkit::transform(scene.root()->translation_, scene.root()->rotation_, scene.root()->scale_);