summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-09-07 11:22:07 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-09-07 11:22:07 -0300
commit1eeda0f32f66b48c8df3b93f333bf702b149ba31 (patch)
treeb274e9ebd9ee64edc0a412ab48d3a2ff98b54f49 /scene/gui
parent895140389a7306eafc9a36f51d892ece0001f223 (diff)
Restored auto snapping of controls to pixels, fixes #10847 and probably several more issues. Made it optional in the project settings but defaults to true.
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/control.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 961fccc804..7bf11e6712 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -1249,6 +1249,10 @@ void Control::_size_changed() {
new_size_cache.height = MAX(minimum_size.height, new_size_cache.height);
}
+ if (get_viewport()->is_snap_controls_to_pixels_enabled()) {
+ new_size_cache =new_size_cache.floor();
+ new_pos_cache = new_pos_cache.floor();
+ }
bool pos_changed = new_pos_cache != data.pos_cache;
bool size_changed = new_size_cache != data.size_cache;