@@ -40,6 +40,9 @@ public class TouchTrackingUIView: UIView {
4040 /// A boolean value that indicates whatever adding show coordinates label or not
4141 public var isShowLocation : Bool
4242
43+ /// display mode of touched points.
44+ public var displayMode : DisplayMode
45+
4346
4447 var touches : Set < UITouch > = [ ]
4548 var locations : [ CGPoint ] = [ ] {
@@ -67,6 +70,7 @@ public class TouchTrackingUIView: UIView {
6770 /// - shadowOffset: shadow offset of mark on touched point
6871 /// - image: Image to be displayed at the touched point mark
6972 /// - isShowLocation: A boolean value that indicates whatever adding show coordinates label or not
73+ /// - displayMode: display mode of touched points.
7074 public init (
7175 radius: CGFloat = 20 ,
7276 color: UIColor = . red,
@@ -79,7 +83,8 @@ public class TouchTrackingUIView: UIView {
7983 shadowRadius: CGFloat = 3 ,
8084 shadowOffset: CGPoint = . zero,
8185 image: UIImage ? = nil ,
82- isShowLocation: Bool = false
86+ isShowLocation: Bool = false ,
87+ displayMode: DisplayMode = . always
8388 ) {
8489 self . radius = radius
8590 self . color = color
@@ -93,6 +98,7 @@ public class TouchTrackingUIView: UIView {
9398 self . shadowOffset = shadowOffset
9499 self . image = image
95100 self . isShowLocation = isShowLocation
101+ self . displayMode = displayMode
96102
97103 super. init ( frame: . null)
98104
@@ -160,6 +166,15 @@ public class TouchTrackingUIView: UIView {
160166 }
161167
162168 func updatePoints( ) {
169+ let isCaptured = window? . screen. isCaptured ?? false
170+ let shouldDisplay = displayMode. shouldDisplay ( captured: isCaptured)
171+
172+ if !shouldDisplay {
173+ pointWindows. forEach { $0. isHidden = true }
174+ pointWindows = [ ]
175+ return
176+ }
177+
163178 if pointWindows. count > touches. count {
164179 pointWindows [ touches. count..< pointWindows. count] . forEach {
165180 $0. isHidden = true
@@ -187,6 +202,8 @@ public class TouchTrackingUIView: UIView {
187202 }
188203 }
189204
205+ let locations = touches. map { $0. location ( in: nil ) }
206+
190207 zip ( pointWindows, locations) . forEach { window, location in
191208 window. location = location
192209 window. center = . init( x: location. x + offset. x,
0 commit comments