From f2c72a5f8568579dade6350dc26a482076d3d346 Mon Sep 17 00:00:00 2001 From: Charles Powell Date: Mon, 9 Aug 2021 11:48:48 -0700 Subject: [PATCH] Add textCoord function documentation --- Sources/MarqueeLabel.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Sources/MarqueeLabel.swift b/Sources/MarqueeLabel.swift index 015d393..53195f5 100644 --- a/Sources/MarqueeLabel.swift +++ b/Sources/MarqueeLabel.swift @@ -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 }