Touch control layout screen: Make the expanded click zone around the controls symmetrical.

Just a minor tweak.
This commit is contained in:
Henrik Rydgård
2020-07-12 10:39:25 +02:00
parent e184ed368d
commit 2e19d7aa0a
+4 -2
View File
@@ -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;
}