Skip to content

Commit f2c72a5

Browse files
committed
Add textCoord function documentation
1 parent 1d788f5 commit f2c72a5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/MarqueeLabel.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,6 +1447,15 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
14471447
}
14481448
}
14491449

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

0 commit comments

Comments
 (0)