summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2018-06-26 17:55:23 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2018-06-26 17:55:23 +0200
commit88c23e243f05696b2c3d56caad8055046e5edcd3 (patch)
tree52c7a6af78daa20f2c3052d67ffb4155933db587
parentc8617565d84d69b1966878debe61b4c712750780 (diff)
Fix control pixel snap rounding using floor() instead of round()
This resulted in small leftwards/upwards movement of controls being faster than it should be. This closes #19763.
-rw-r--r--scene/gui/control.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index a738687a70..0acce4f500 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -1326,8 +1326,8 @@ void Control::_size_changed() {
// We use a little workaround to avoid flickering when moving the pivot with _edit_set_pivot()
if (Math::abs(Math::sin(data.rotation * 4.0f)) < 0.00001f && get_viewport()->is_snap_controls_to_pixels_enabled()) {
- new_size_cache = new_size_cache.floor();
- new_pos_cache = new_pos_cache.floor();
+ new_size_cache = new_size_cache.round();
+ new_pos_cache = new_pos_cache.round();
}
bool pos_changed = new_pos_cache != data.pos_cache;
bool size_changed = new_size_cache != data.size_cache;