From 2e19d7aa0a7013af2f19ebf3829f141c52ed10db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 12 Jul 2020 10:38:53 +0200 Subject: [PATCH] Touch control layout screen: Make the expanded click zone around the controls symmetrical. Just a minor tweak. --- UI/TouchControlLayoutScreen.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/UI/TouchControlLayoutScreen.cpp b/UI/TouchControlLayoutScreen.cpp index a5462dd236..e895ebd384 100644 --- a/UI/TouchControlLayoutScreen.cpp +++ b/UI/TouchControlLayoutScreen.cpp @@ -419,9 +419,11 @@ DragDropButton *ControlLayoutView::getPickedControl(const int x, const int y) { for (size_t i = 0; i < controls_.size(); i++) { DragDropButton *control = controls_[i]; const Bounds &bounds = control->GetBounds(); - const float thresholdFactor = 1.5f; + const float thresholdFactor = 0.25f; + const float thresholdW = thresholdFactor * bounds.w; + const float thresholdH = thresholdFactor * bounds.h; - Bounds tolerantBounds(bounds.x, bounds.y, bounds.w * thresholdFactor, bounds.h * thresholdFactor); + Bounds tolerantBounds(bounds.x - thresholdW * 0.5, bounds.y - thresholdH * 0.5 , bounds.w + thresholdW, bounds.h + thresholdH); if (tolerantBounds.Contains(x, y)) { return control; }