Fix poll option tracking unselecting options when location moves in between views
This commit is contained in:
parent
57fb921573
commit
6e5498430f
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue