Small changes.
This commit is contained in:
parent
2ec2c2b0b8
commit
9c6ddc2470
@ -254,7 +254,6 @@ public typealias ActionBlock = () -> Void
|
||||
label.addGestureRecognizer(tapGesture)
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
continue
|
||||
}
|
||||
@ -363,8 +362,8 @@ extension Label {
|
||||
@objc func textLinkTapped(_ gesture: UITapGestureRecognizer) {
|
||||
|
||||
for clause in clauses {
|
||||
if gesture.didTapAttributedTextInLabel(self, inRange: clause.range), let action = clause.actionBlock {
|
||||
action()
|
||||
if gesture.didTapAttributedTextInLabel(self, inRange: clause.range) {
|
||||
clause.performAction()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -435,7 +434,6 @@ extension Label {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extension UITapGestureRecognizer {
|
||||
|
||||
func didTapAttributedTextInLabel(_ label: Label, inRange targetRange: NSRange) -> Bool {
|
||||
@ -453,13 +451,6 @@ extension UITapGestureRecognizer {
|
||||
let labelSize = label.bounds.size
|
||||
textContainer.size = labelSize
|
||||
|
||||
// Find the tapped character location and compare it to the specified range
|
||||
// let locationOfTouchInLabel = location(in: label)
|
||||
// let textBoundingBox = layoutManager.usedRect(for: textContainer)
|
||||
// let textContainerOffset = CGPoint(x: (labelSize.width - textBoundingBox.size.width) * 0.5 - textBoundingBox.origin.x,
|
||||
// y: (labelSize.height - textBoundingBox.size.height) * 0.5 - textBoundingBox.origin.y)
|
||||
// let locationOfTouchInTextContainer = CGPoint(x: locationOfTouchInLabel.x - textContainerOffset.x,
|
||||
// y: locationOfTouchInLabel.y - textContainerOffset.y)
|
||||
let indexOfCharacter = layoutManager.characterIndex(for: location(in: label), in: textContainer, fractionOfDistanceBetweenInsertionPoints: nil)
|
||||
|
||||
return NSLocationInRange(indexOfCharacter, targetRange)
|
||||
|
||||
@ -213,8 +213,7 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
|
||||
actionBlock = { [weak self, weak delegateObject] in
|
||||
var performAction = true
|
||||
|
||||
if let wSelf = self,
|
||||
let wButtonDelegate = (delegateObject as? MVMCoreUIDelegateObject)?.buttonDelegate,
|
||||
if let wSelf = self, let wButtonDelegate = (delegateObject as? MVMCoreUIDelegateObject)?.buttonDelegate,
|
||||
wButtonDelegate.responds(to: #selector(ButtonObjectDelegate.button(_:shouldPerformActionWithMap:additionalData:))) {
|
||||
performAction = wButtonDelegate.button?(wSelf, shouldPerformActionWithMap: actionMap, additionalData: additionalData) ?? false
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user