summaryrefslogtreecommitdiff
path: root/scene/gui/control.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-01-13 13:38:08 +0100
committerGitHub <noreply@github.com>2020-01-13 13:38:08 +0100
commitc72b5dc0bcad7adfbdb95cc3e8ef56d53ab58677 (patch)
tree5a66c6fc63d53191c28d410efaaca6cf5d1d7475 /scene/gui/control.cpp
parente32d2320532c6585e339051ed85dda211311ed87 (diff)
parent100f50b7df7312f8fc56df7fd3e18427678bd957 (diff)
Merge pull request #35073 from akien-mga/zero-scale-shall-not-pass
Control/Light2D: Preventing setting 0 as scale as for Node2D
Diffstat (limited to 'scene/gui/control.cpp')
-rw-r--r--scene/gui/control.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 9a67745e0d..4f499af186 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -2682,6 +2682,11 @@ Vector2 Control::get_pivot_offset() const {
void Control::set_scale(const Vector2 &p_scale) {
data.scale = p_scale;
+ // Avoid having 0 scale values, can lead to errors in physics and rendering.
+ if (data.scale.x == 0)
+ data.scale.x = CMP_EPSILON;
+ if (data.scale.y == 0)
+ data.scale.y = CMP_EPSILON;
update();
_notify_transform();
}