exyte / fan-menu

Menu with a circular layout based on Macaw
MIT License
728 stars 58 forks source link

Background circle reduce to half #42

Closed Gagan6696 closed 5 years ago

Gagan6696 commented 5 years ago

Hello sir,

I want to show half circle rather than full circle. which code should I need to update ??

amarunko commented 5 years ago

Hi, @Gagan6696, you can change FanMenu.swift:

https://github.com/exyte/fan-menu/blob/10b61761da185a1ca05aefccdb46edde7b6c4455/Sources/FanMenu.swift#L189

you can switch here to any shape

Gagan6696 commented 5 years ago

I already tried this by changing different parameters like reduce radius to half. But unfortunately nothing changed. Could you please define me parameters , which I need to change

shipinev commented 5 years ago

Hey @Gagan6696! I'm sorry for the late response, but here is a solution to this issue. You need to replace form attribute of backgroundCircle shape with a custom path:

backgroundCircle = Shape(
    form: Path(segments: [
        PathSegment(type: .M, data: [0, 0]),
        PathSegment(type: .m, data: [-fanMenu.radius, 0]),
        PathSegment(type: .a, data: [fanMenu.radius, fanMenu.radius, 0, 1, 0, fanMenu.radius * 2, 0])
    ])
)

Result: Screen Shot