Skip to content

Instantly share code, notes, and snippets.

@agiletortoise
Created April 19, 2020 00:31
Show Gist options
  • Save agiletortoise/90f22a6fa024a80d63b11be6f30b4e8b to your computer and use it in GitHub Desktop.
Save agiletortoise/90f22a6fa024a80d63b11be6f30b4e8b to your computer and use it in GitHub Desktop.
var pathForContextualMenuPointer: UIBezierPath {
let combinedShape = UIBezierPath()
combinedShape.move(to: CGPoint(x: 12.5, y: 0))
combinedShape.addCurve(to: CGPoint(x: 25, y: 12.5), controlPoint1: CGPoint(x: 19.4, y: 0), controlPoint2: CGPoint(x: 25, y: 5.6))
combinedShape.addLine(to: CGPoint(x: 25, y: 12.5))
combinedShape.addLine(to: CGPoint(x: 25, y: 23.01))
combinedShape.addCurve(to: CGPoint(x: 23.02, y: 25), controlPoint1: CGPoint(x: 25, y: 24), controlPoint2: CGPoint(x: 24, y: 25))
combinedShape.addLine(to: CGPoint(x: 23.02, y: 25))
combinedShape.addLine(to: CGPoint(x: 12.5, y: 25))
combinedShape.addCurve(to: CGPoint(x: 0, y: 12.5), controlPoint1: CGPoint(x: 5.6, y: 25), controlPoint2: CGPoint(x: 0, y: 19.4))
combinedShape.addCurve(to: CGPoint(x: 12.5, y: 0), controlPoint1: CGPoint(x: 0, y: 5.6), controlPoint2: CGPoint(x: 5.6, y: 0))
combinedShape.close()
combinedShape.move(to: CGPoint(x: 22, y: 20))
combinedShape.addLine(to: CGPoint(x: 12, y: 20))
combinedShape.addCurve(to: CGPoint(x: 11, y: 21), controlPoint1: CGPoint(x: 11.45, y: 20), controlPoint2: CGPoint(x: 11, y: 20.45))
combinedShape.addCurve(to: CGPoint(x: 12, y: 22), controlPoint1: CGPoint(x: 11, y: 21.55), controlPoint2: CGPoint(x: 11.45, y: 22))
combinedShape.addLine(to: CGPoint(x: 12, y: 22))
combinedShape.addLine(to: CGPoint(x: 22, y: 22))
combinedShape.addCurve(to: CGPoint(x: 23, y: 21), controlPoint1: CGPoint(x: 22.55, y: 22), controlPoint2: CGPoint(x: 23, y: 21.55))
combinedShape.addCurve(to: CGPoint(x: 22, y: 20), controlPoint1: CGPoint(x: 23, y: 20.45), controlPoint2: CGPoint(x: 22.55, y: 20))
combinedShape.addLine(to: CGPoint(x: 22, y: 20))
combinedShape.close()
combinedShape.move(to: CGPoint(x: 22, y: 16))
combinedShape.addLine(to: CGPoint(x: 12, y: 16))
combinedShape.addCurve(to: CGPoint(x: 11, y: 17), controlPoint1: CGPoint(x: 11.45, y: 16), controlPoint2: CGPoint(x: 11, y: 16.45))
combinedShape.addCurve(to: CGPoint(x: 12, y: 18), controlPoint1: CGPoint(x: 11, y: 17.55), controlPoint2: CGPoint(x: 11.45, y: 18))
combinedShape.addLine(to: CGPoint(x: 12, y: 18))
combinedShape.addLine(to: CGPoint(x: 22, y: 18))
combinedShape.addCurve(to: CGPoint(x: 23, y: 17), controlPoint1: CGPoint(x: 22.55, y: 18), controlPoint2: CGPoint(x: 23, y: 17.55))
combinedShape.addCurve(to: CGPoint(x: 22, y: 16), controlPoint1: CGPoint(x: 23, y: 16.45), controlPoint2: CGPoint(x: 22.55, y: 16))
combinedShape.addLine(to: CGPoint(x: 22, y: 16))
combinedShape.close()
combinedShape.move(to: CGPoint(x: 22, y: 12))
combinedShape.addLine(to: CGPoint(x: 12, y: 12))
combinedShape.addCurve(to: CGPoint(x: 11, y: 13), controlPoint1: CGPoint(x: 11.45, y: 12), controlPoint2: CGPoint(x: 11, y: 12.45))
combinedShape.addCurve(to: CGPoint(x: 12, y: 14), controlPoint1: CGPoint(x: 11, y: 13.55), controlPoint2: CGPoint(x: 11.45, y: 14))
combinedShape.addLine(to: CGPoint(x: 12, y: 14))
combinedShape.addLine(to: CGPoint(x: 22, y: 14))
combinedShape.addCurve(to: CGPoint(x: 23, y: 13), controlPoint1: CGPoint(x: 22.55, y: 14), controlPoint2: CGPoint(x: 23, y: 13.55))
combinedShape.addCurve(to: CGPoint(x: 22, y: 12), controlPoint1: CGPoint(x: 23, y: 12.45), controlPoint2: CGPoint(x: 22.55, y: 12))
combinedShape.addLine(to: CGPoint(x: 22, y: 12))
combinedShape.close()
combinedShape.usesEvenOddFillRule = true
let offset: CGFloat = -12.0
let scale: CGFloat = 1.0
let transform = CGAffineTransform(translationX: offset, y: offset).scaledBy(x: scale, y: scale)
combinedShape.apply(transform)
return combinedShape
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment