Increased the tappable space of the Checkbox.

This commit is contained in:
Kevin G Christiano 2019-12-09 11:03:31 -05:00
parent aaa8e4132e
commit a7989c589f

View File

@ -351,18 +351,14 @@ import MVMCore
open override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
sendActions(for: touchIsAcceptablyOutside(touches.first) ? .touchUpOutside : .touchUpInside)
sendActions(for: .touchUpInside)
}
func touchIsAcceptablyOutside(_ touch: UITouch?) -> Bool {
let endLocation = touch?.location(in: self)
let x = endLocation?.x ?? 0.0
let y = endLocation?.y ?? 0.0
let faultTolerance: CGFloat = 20.0
let widthLimit = CGFloat(bounds.size.width + faultTolerance)
let heightLimt = CGFloat(bounds.size.height + faultTolerance)
override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
return x < -faultTolerance || y < -faultTolerance || x > widthLimit || y > heightLimt
let faultTolerance: CGFloat = 20.0
let area = bounds.insetBy(dx: -faultTolerance, dy: -faultTolerance)
return area.contains(point)
}
override open func accessibilityActivate() -> Bool {
@ -413,7 +409,7 @@ import MVMCore
FormValidator.setupValidation(molecule: self, delegate: delegateObject?.formValidationProtocol)
guard let dictionary = json else { return }
groupName = dictionary.optionalStringForKey("groupName")
fieldValue = dictionary.optionalStringForKey("value")
if let fieldKey = dictionary[KeyFieldKey] as? String {
@ -470,7 +466,7 @@ import MVMCore
// MARK:- FormValidationProtocol
extension Checkbox: FormValidationFormFieldProtocol {
public func formFieldGroupName() -> String? {
return groupName
}