File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -204,19 +204,21 @@ typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle) {
204204 @param textNode The text node containing the entity attribute.
205205 @param attribute The attribute that was tapped. Will not be nil.
206206 @param value The value of the tapped attribute.
207+ @param point The point within textNode, in textNode's coordinate system, that was touched to trigger a highlight.
207208 @discussion If not implemented, the default value is NO.
208209 @return YES if the entity attribute should be a link, NO otherwise.
209210 */
210- - (BOOL )textNode : (ASTextNode *)textNode shouldHighlightLinkAttribute : (NSString *)attribute value : (id )value ;
211+ - (BOOL )textNode : (ASTextNode *)textNode shouldHighlightLinkAttribute : (NSString *)attribute value : (id )value atPoint : (CGPoint) point ;
211212
212213/* *
213214 @abstract Indicates to the text node if an attribute is a valid long-press target
214215 @param textNode The text node containing the entity attribute.
215216 @param attribute The attribute that was tapped. Will not be nil.
216217 @param value The value of the tapped attribute.
218+ @param point The point within textNode, in textNode's coordinate system, that was long-pressed.
217219 @discussion If not implemented, the default value is NO.
218220 @return YES if the entity attribute should be treated as a long-press target, NO otherwise.
219221 */
220- - (BOOL )textNode : (ASTextNode *)textNode shouldLongPressLinkAttribute : (NSString *)attribute value : (id )value ;
222+ - (BOOL )textNode : (ASTextNode *)textNode shouldLongPressLinkAttribute : (NSString *)attribute value : (id )value atPoint : (CGPoint) point ;
221223
222224@end
Original file line number Diff line number Diff line change @@ -418,8 +418,8 @@ - (id)_linkAttributeValueAtPoint:(CGPoint)point
418418
419419 // Check if delegate implements optional method, if not assume NO.
420420 // Should the text be highlightable/touchable?
421- if (![_delegate respondsToSelector: @selector (textNode:shouldHighlightLinkAttribute:value: )] ||
422- ![_delegate textNode: self shouldHighlightLinkAttribute: name value: value]) {
421+ if (![_delegate respondsToSelector: @selector (textNode:shouldHighlightLinkAttribute:value:atPoint: )] ||
422+ ![_delegate textNode: self shouldHighlightLinkAttribute: name value: value atPoint: point ]) {
423423 value = nil ;
424424 name = nil ;
425425 }
@@ -465,8 +465,11 @@ - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
465465 }
466466
467467 // Ask our delegate if a long-press on an attribute is relevant
468- if ([self .delegate respondsToSelector: @selector (textNode:shouldLongPressLinkAttribute:value: )]) {
469- return [self .delegate textNode: self shouldLongPressLinkAttribute: _highlightedLinkAttributeName value: _highlightedLinkAttributeValue];
468+ if ([self .delegate respondsToSelector: @selector (textNode:shouldLongPressLinkAttribute:value:atPoint: )]) {
469+ return [self .delegate textNode: self
470+ shouldLongPressLinkAttribute: _highlightedLinkAttributeName
471+ value: _highlightedLinkAttributeValue
472+ atPoint: [gestureRecognizer locationInView: self .view]];
470473 }
471474
472475 // Otherwise we are good to go.
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ - (void)textNode:(ASTextNode *)textNode tappedLinkAttribute:(NSString *)attribut
3030 _tappedLinkValue = value;
3131}
3232
33- - (BOOL )textNode : (ASTextNode *)textNode shouldHighlightLinkAttribute : (NSString *)attribute value : (id )value
33+ - (BOOL )textNode : (ASTextNode *)textNode shouldHighlightLinkAttribute : (NSString *)attribute value : (id )value atPoint : (CGPoint) point
3434{
3535 return YES ;
3636}
You can’t perform that action at this time.
0 commit comments