Skip to content

Commit

Permalink
Add textCoord function documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
cbpowell committed Aug 9, 2021
1 parent 1d788f5 commit f2c72a5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Sources/MarqueeLabel.swift
Expand Up @@ -1447,6 +1447,15 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
}
}

/**
Function to convert a point from the label view frame coordinates to "text" coordinates, i.e. the equivalent
position in the (possibly) scrolling label. For example, it can be used to convert the coordinates
of a tap point on the MarqueeLabel view into that of the scrolling label, in order to determine the
word or character under the tap point.
If the specified point does not fall inside the bounds of the scrolling label, such as if on a leading
or trailing buffer area, the function will return nil.
*/
open func textCoordinateForFramePoint(_ point:CGPoint) -> CGPoint? {
// Check for presentation layer, if none return input point
guard let presentationLayer = sublabel.layer.presentation() else { return point }
Expand Down

0 comments on commit f2c72a5

Please sign in to comment.