From 6e5498430f0a24fb9f17be2e124fd157691f27c7 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Wed, 15 Feb 2023 18:57:00 -0500 Subject: [PATCH] Fix poll option tracking unselecting options when location moves in between views --- Tusker/Views/Poll/PollOptionsView.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Tusker/Views/Poll/PollOptionsView.swift b/Tusker/Views/Poll/PollOptionsView.swift index 3f5afd0e..8526b271 100644 --- a/Tusker/Views/Poll/PollOptionsView.swift +++ b/Tusker/Views/Poll/PollOptionsView.swift @@ -121,9 +121,14 @@ class PollOptionsView: UIControl { } override func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool { + let location = touch.location(in: self) var newIndex: Int? = nil for (index, view) in options.enumerated() { - if view.point(inside: touch.location(in: view), with: event) { + var frame = view.frame + if index != options.count - 1 { + frame = frame.inset(by: UIEdgeInsets(top: 0, left: 0, bottom: -stack.spacing, right: 0)) + } + if frame.contains(location) { newIndex = index break }