Refactored new pointer interaction code to be more simple.
This commit is contained in:
parent
bd75df7294
commit
450ddbd364
@ -40,17 +40,11 @@ extension MasterTimelineTitleView: UIPointerInteractionDelegate {
|
|||||||
|
|
||||||
@available(iOS 13.4, *)
|
@available(iOS 13.4, *)
|
||||||
func pointerInteraction(_ interaction: UIPointerInteraction, styleFor region: UIPointerRegion) -> UIPointerStyle? {
|
func pointerInteraction(_ interaction: UIPointerInteraction, styleFor region: UIPointerRegion) -> UIPointerStyle? {
|
||||||
|
var rect = self.frame
|
||||||
let params = UIPreviewParameters()
|
|
||||||
var rect = self.bounds
|
|
||||||
rect.origin.x = rect.origin.x - 10
|
rect.origin.x = rect.origin.x - 10
|
||||||
rect.size.width = rect.width + 20
|
rect.size.width = rect.width + 20
|
||||||
let path = UIBezierPath(roundedRect: rect, cornerRadius: 10.0)
|
|
||||||
params.visiblePath = path
|
|
||||||
|
|
||||||
let preview = UITargetedPreview(view: self, parameters: params)
|
return UIPointerStyle(effect: .automatic(UITargetedPreview(view: self)), shape: .roundedRect(rect))
|
||||||
|
|
||||||
return UIPointerStyle(effect: .automatic(preview), shape: .path(path))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user