summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorPouleyKetchoupp <pouleyketchoup@gmail.com>2019-11-09 21:16:19 +0100
committerPouleyKetchoupp <pouleyketchoup@gmail.com>2019-11-09 21:16:19 +0100
commit133014c3fb224c195a703b517bf318fc0b0e6f59 (patch)
tree42b7273621ed8c7dbf6728714b0d84a4b24de3b2 /editor
parent78f7cca69e95d266bd77a38edeaca4c6ca19e26b (diff)
Fixed errors when saving scene with a shrunk viewport
Handle viewport size larger than preview size but very close, when the ratio was 1 the size ended up being 0. Fixes #33497
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_node.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index d42345d9a2..178871ccfa 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1065,7 +1065,7 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) {
img->crop_from_point(x, y, vp_size, vp_size);
} else {
int ratio = vp_size / preview_size;
- int size = preview_size * (ratio / 2);
+ int size = preview_size * MAX(1, ratio / 2);
x = (img->get_width() - size) / 2;
y = (img->get_height() - size) / 2;