Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rect received in custom shape path in rect is always zero #549

Open
shial4 opened this issue Sep 4, 2023 · 0 comments
Open

Rect received in custom shape path in rect is always zero #549

shial4 opened this issue Sep 4, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@shial4
Copy link

shial4 commented Sep 4, 2023

Describe the bug
rect is always zero path(in rect: CGRect) in size

To Reproduce

  • Tested with TokamakDOM
public struct Arrow: Shape {
    public init() {}
    
    public func path(in rect: CGRect) -> Path {
        print("🅰️", rect)
        return Path { path in
            path.move(to: CGPoint(x: 0, y: rect.height * 0.3))
            path.addLine(to: CGPoint(x: 0, y: rect.height * 0.7))
            path.addLine(to: CGPoint(x: rect.width * 0.6, y: rect.height * 0.6))
            path.addLine(to: CGPoint(x: rect.width * 0.6, y: rect.height * 0.8))
            path.addLine(to: CGPoint(x: rect.width, y: rect.height / 2))
            path.addLine(to: CGPoint(x: rect.width * 0.6, y: rect.height * 0.2 ))
            path.addLine(to: CGPoint(x: rect.width * 0.6, y: rect.height * 0.4 ))
            path.closeSubpath()
        }
    }
}

Expected behavior
Rect has the size of the content.

@shial4 shial4 added the bug Something isn't working label Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants